From 4a89d4cc4462efba390414509e9f1fdc5ea0c8c3 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Fri, 26 Feb 2010 00:19:55 +0000 Subject: #605374 by catch: Don't add non-existing files to the registry. --- includes/registry.inc | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'includes/registry.inc') diff --git a/includes/registry.inc b/includes/registry.inc index 16b869b76..5af4d4aa1 100644 --- a/includes/registry.inc +++ b/includes/registry.inc @@ -123,24 +123,27 @@ function registry_get_parsed_files() { function _registry_parse_files($files) { $parsed_files = array(); foreach ($files as $filename => $file) { - $filectime = filectime($filename); - $filemtime = filemtime($filename); - $modified_file = !isset($file['filectime']) || !isset($file['filemtime']) - || $filectime != $file['filectime'] || $filemtime != $file['filemtime']; - if ($modified_file) { - $contents = file_get_contents($filename); - $parsed_files[] = $filename; - // We update the filectime/filemtime after we've saved the files resources - // rather than here, so if we don't make it through this rebuild, the next - // run will reparse the file. - _registry_parse_file($filename, $contents, $file['module'], $file['weight']); - db_merge('registry_file') - ->key(array('filename' => $filename)) - ->fields(array( - 'filectime' => $filectime, - 'filemtime' => $filemtime, - )) - ->execute(); + if (file_exists($filename)) { + $filectime = filectime($filename); + $filemtime = filemtime($filename); + + $modified_file = !isset($file['filectime']) || !isset($file['filemtime']) + || $filectime != $file['filectime'] || $filemtime != $file['filemtime']; + if ($modified_file) { + $contents = file_get_contents($filename); + $parsed_files[] = $filename; + // We update the filectime/filemtime after we've saved the files resources + // rather than here, so if we don't make it through this rebuild, the next + // run will reparse the file. + _registry_parse_file($filename, $contents, $file['module'], $file['weight']); + db_merge('registry_file') + ->key(array('filename' => $filename)) + ->fields(array( + 'filectime' => $filectime, + 'filemtime' => $filemtime, + )) + ->execute(); + } } } return $parsed_files; -- cgit v1.2.3