diff -u b/includes/bootstrap.inc b/includes/bootstrap.inc --- b/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -899,9 +899,15 @@ $missing = array(); try { if (function_exists('cache_get')) { - $cache = cache_get('drupal_get_filename:missing'); + $cache = cache_get('drupal_get_filename:missing', 'cache_bootstrap'); if (!empty($cache->data)) { - $missing = $cache->data; + // Merge the changes already done in the current request (including + // the setting of missing records to NULL) into the values saved + // in persistent cache. + $missing = $cache->data + $missing; + // Set a flag so we know that we've already done a merge with values + // in cache_get(). + $missing['#cache_merge_done'] = TRUE; } } } @@ -917,7 +923,7 @@ } else { // File is not available anymore at its new location. Re-do file scan. - unset($missing[$type][$name]); + $missing[$type][$name] = NULL; $missing['#write_cache'] = TRUE; } } @@ -957,7 +963,7 @@ if (!isset($missing[$type][$name])) { // Add the missing file to a temporary cache and throw an alert. // This cache will be cleared on module/theme rebuild. - $missing[$type][$name] = FALSE; + $missing[$type][$name] = TRUE; $missing['#write_cache'] = TRUE; } trigger_error(format_string('The following @type is missing from the file system: @name. For more information, see the documentation page.', array('@type' => $type, '@name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215')), E_USER_WARNING); @@ -976,7 +982,13 @@ } $missing = &drupal_static('drupal_get_filename:missing'); if (isset($missing['#write_cache'])) { - unset($missing['#write_cache']); + if (!isset($missing['#cache_merge_done'])) { + $cache = cache_get('drupal_get_filename:missing', 'cache_bootstrap'); + if (isset($cache->data)) { + $missing = $cache->data + $missing; + } + } + $missing['#write_cache'] = NULL; cache_set('drupal_get_filename:missing', $missing, 'cache_bootstrap'); } } @@ -2537,11 +2549,6 @@ // the install or upgrade process. spl_autoload_register('drupal_autoload_class'); spl_autoload_register('drupal_autoload_interface'); - - // Reset the drupal_get_filename() static missing filenames cache as it - // may have previously been initialized without the database being - // available. - drupal_static_reset('drupal_get_filename:missing'); } /** diff -u b/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test --- b/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -382,7 +382,7 @@ } /** - * Whether the filename test triggered the right error. + * Whether the filename test triggered the right error. * * Used by BootstrapGetFilenameTestCase::testDrupalGetFilename(). *