diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-26 00:19:55 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-26 00:19:55 +0000 |
commit | 4a89d4cc4462efba390414509e9f1fdc5ea0c8c3 (patch) | |
tree | 607e8cf2c461af05d9b1e85f0ff1e33a3756920b /includes/registry.inc | |
parent | 28bca620e10451095b2321a77358384f282caa2b (diff) | |
download | brdo-4a89d4cc4462efba390414509e9f1fdc5ea0c8c3.tar.gz brdo-4a89d4cc4462efba390414509e9f1fdc5ea0c8c3.tar.bz2 |
#605374 by catch: Don't add non-existing files to the registry.
Diffstat (limited to 'includes/registry.inc')
-rw-r--r-- | includes/registry.inc | 39 |
1 files changed, 21 insertions, 18 deletions
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; |