diff -u b/includes/bootstrap.inc b/includes/bootstrap.inc --- b/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -959,30 +959,32 @@ // Check whether this file had previously moved from the path listed in the // {system} table. if (isset($file_scans[$type][$name]) && is_string($file_scans[$type][$name]) && file_exists($file_scans[$type][$name])) { - // We found the file at the cached location. - return $file_scans[$type][$name]; + // The file exists at the location cached in a previous file scan. + $filename_from_file_scan = $file_scans[$type][$name]; } - // Unless the module had been marked as missing, perform a file scan. - if (!(isset($file_scans[$type][$name]) && $file_scans[$type][$name] === FALSE)) { + elseif (!(isset($file_scans[$type][$name]) && $file_scans[$type][$name] === FALSE)) { $filename_from_file_scan = _drupal_get_filename_perform_file_scan($type, $name); } + if (isset($filename_from_file_scan)) { // Check whether the file we found was listed as being in another // location in the {system} table. $system_filepaths = &drupal_static('system_filepaths'); if (isset($system_filepaths[$type][$name]) && $system_filepaths[$type][$name] != $filename_from_file_scan) { - // This file has moved. Store its new location in the file scan cache. - $file_scans[$type][$name] = $filename_from_file_scan[$type][$name]; // Make sure our change to the file scan cache will be written to // the persistent cache. - $file_scans['#write_cache'] = TRUE; + if ($file_scans[$type][$name] != $filename_from_file_scan) { + $file_scans['#write_cache'] = TRUE; + } + // This file has moved. Store its new location in the file scan cache. + $file_scans[$type][$name] = $filename_from_file_scan; + // Create a user-level warning. trigger_error(format_string('The following %type has moved on the file system: %name. In order to fix this, clear caches or put the file back in its original location. For more information, see the documentation page.', array('%type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215')), E_USER_WARNING); } return $filename_from_file_scan; } else { - trigger_error(format_string('The following %type is missing from the file system: %name. In order to fix this, put the file back in its original location or uninstall the module. For more information, see the documentation page.', array('%type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215')), E_USER_WARNING); // Make sure our change to the file scan cache will be written to // the persistent cache. if (!(isset($file_scans[$type][$name]) && $file_scans[$type][$name] === FALSE)) { @@ -990,6 +992,8 @@ } // Mark the file as missing. $file_scans[$type][$name] = FALSE; + // Create a user-level warning. + trigger_error(format_string('The following %type is missing from the file system: %name. In order to fix this, put the file back in its original location or uninstall the module. For more information, see the documentation page.', array('%type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215')), E_USER_WARNING); } }