Commit 42e17a14 authored by catch's avatar catch
Browse files

Issue #1470656 by Damien Tournoud, amateescu: Fixed Registry rebuild should...

Issue #1470656 by Damien Tournoud, amateescu: Fixed Registry rebuild should not parse the same file twice in the same request.
parent 42251b6b
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment