Commit 4a89d4cc authored by webchick's avatar webchick
Browse files

#605374 by catch: Don't add non-existing files to the registry.

parent 28bca620
...@@ -123,24 +123,27 @@ function registry_get_parsed_files() { ...@@ -123,24 +123,27 @@ function registry_get_parsed_files() {
function _registry_parse_files($files) { function _registry_parse_files($files) {
$parsed_files = array(); $parsed_files = array();
foreach ($files as $filename => $file) { foreach ($files as $filename => $file) {
$filectime = filectime($filename); if (file_exists($filename)) {
$filemtime = filemtime($filename); $filectime = filectime($filename);
$modified_file = !isset($file['filectime']) || !isset($file['filemtime']) $filemtime = filemtime($filename);
|| $filectime != $file['filectime'] || $filemtime != $file['filemtime'];
if ($modified_file) { $modified_file = !isset($file['filectime']) || !isset($file['filemtime'])
$contents = file_get_contents($filename); || $filectime != $file['filectime'] || $filemtime != $file['filemtime'];
$parsed_files[] = $filename; if ($modified_file) {
// We update the filectime/filemtime after we've saved the files resources $contents = file_get_contents($filename);
// rather than here, so if we don't make it through this rebuild, the next $parsed_files[] = $filename;
// run will reparse the file. // We update the filectime/filemtime after we've saved the files resources
_registry_parse_file($filename, $contents, $file['module'], $file['weight']); // rather than here, so if we don't make it through this rebuild, the next
db_merge('registry_file') // run will reparse the file.
->key(array('filename' => $filename)) _registry_parse_file($filename, $contents, $file['module'], $file['weight']);
->fields(array( db_merge('registry_file')
'filectime' => $filectime, ->key(array('filename' => $filename))
'filemtime' => $filemtime, ->fields(array(
)) 'filectime' => $filectime,
->execute(); 'filemtime' => $filemtime,
))
->execute();
}
} }
} }
return $parsed_files; return $parsed_files;
......
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