diff --git a/core/includes/registry.inc b/core/includes/registry.inc index 2316444..0fc2c57 100644 --- a/core/includes/registry.inc +++ b/core/includes/registry.inc @@ -29,6 +29,11 @@ function _registry_update() { $connection_info = Database::getConnectionInfo(); $driver = $connection_info['default']['driver']; + // During the first registry rebuild in a request, we check all the files. + // During subsequent rebuilds, we only add new files. It makes the rebuilding + // process faster during installation of modules. + static $check_existing_files = TRUE; + // Get current list of modules and their files. $modules = db_query("SELECT * FROM {system} WHERE type = 'module'")->fetchAll(); // Get the list of files we are going to parse. @@ -59,7 +64,14 @@ function _registry_update() { foreach (registry_get_parsed_files() as $filename => $file) { // Add the hash for those files we have already parsed. if (isset($files[$filename])) { - $files[$filename]['hash'] = $file['hash']; + if ($check_existing_files) { + $files[$filename]['hash'] = $file['hash']; + } + else { + // Ignore that file for this request, it has been parsed previously + // and it is unlikely it has changed. + unset($files[$filename]); + } } else { // Flush the registry of resources in files that are no longer on disc @@ -95,6 +107,10 @@ function _registry_update() { throw $e; } + // During the next run in this request, don't bother re-checking existing + // files. + $check_existing_files = FALSE; + // We have some unchanged resources, warm up the cache - no need to pay // for looking them up again. if (count($unchanged_resources) > 0) {