diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 993b377..169366e 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1093,12 +1093,11 @@ function _drupal_get_filename_fallback_trigger_error($type, $name, $error_type) * cleared in system_list_reset() (i.e. after a module/theme rebuild). */ function drupal_file_scan_write_cache() { - // Only write to the persistent cache if we are fully bootstrapped. - if (drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL) { - return; - } + // Only write to the persistent cache if requested, and if we know that any + // data previously in the cache was successfully loaded and merged in by + // _drupal_file_scan_cache(). $file_scans = &_drupal_file_scan_cache(); - if (isset($file_scans['#write_cache'])) { + if (isset($file_scans['#write_cache']) && isset($file_scans['#cache_merge_done'])) { unset($file_scans['#write_cache']); cache_set('_drupal_file_scan_cache', $file_scans, 'cache_bootstrap'); }