diff -u b/includes/bootstrap.inc b/includes/bootstrap.inc --- b/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1058,7 +1058,7 @@ } /** - * Triggers a user-level warning for missing or unexpectedly moved files. + * Registers a user-level warning for missing or unexpectedly moved files. * * @param $type * The type of the item (theme, theme_engine, module, profile). @@ -1069,22 +1069,41 @@ * * @see drupal_get_filename() * @see _drupal_get_filename_fallback() + * @see _drupal_get_filename_fallback_trigger_error_invoke() + * @see _drupal_bootstrap_full() */ function _drupal_get_filename_fallback_trigger_error($type, $name, $error_type) { // Make sure we only show any missing or moved file errors only once per - // request. - static $errors_triggered = array(); + // request. We delay the trigger_error to _drupal_bootstrap_full() + // to prevent calling watchdog early in the bootstrap. + $errors_triggered = &drupal_static(__FUNCTION__, array()); + if (empty($errors_triggered[$type][$name][$error_type])) { - if ($error_type == 'missing') { - trigger_error(format_string('The following @type is missing from the file system: %name. In order to fix this, put the @type 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); - } - elseif ($error_type == 'moved') { - trigger_error(format_string('The following @type has moved within the file system: %name. In order to fix this, clear caches or put the @type 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); - } $errors_triggered[$type][$name][$error_type] = TRUE; } } +/** + * Triggers the errors that had been registered earlier. + * + * @see _drupal_get_filename_fallback_trigger_error() + */ +function _drupal_get_filename_fallback_trigger_error_invoke() { + $errors_triggered = &drupal_static('_drupal_get_filename_fallback_trigger_error', array()); + foreach ($errors_triggered as $type => $modules) { + foreach ($modules as $name => $types) { + foreach (array_keys($types) as $error_type) { + if ($error_type == 'missing') { + trigger_error(format_string('The following @type is missing from the file system: %name. In order to fix this, put the @type 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); + } + elseif ($error_type == 'moved') { + trigger_error(format_string('The following @type has moved within the file system: %name. In order to fix this, clear caches or put the @type 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); + } + } + } + } +} + /** * Writes the file scan cache to the persistent cache. * diff -u b/includes/common.inc b/includes/common.inc --- b/includes/common.inc +++ b/includes/common.inc @@ -2757,7 +2757,6 @@ _registry_check_code(REGISTRY_WRITE_LOOKUP_CACHE); drupal_cache_system_paths(); module_implements_write_cache(); - drupal_file_scan_write_cache(); system_run_automated_cron(); } @@ -2768,6 +2767,7 @@ _registry_check_code(REGISTRY_WRITE_LOOKUP_CACHE); drupal_cache_system_paths(); module_implements_write_cache(); + drupal_file_scan_write_cache(); system_run_automated_cron(); } @@ -5270,6 +5270,8 @@ drupal_theme_initialize(); module_invoke_all('init'); } + + _drupal_get_filename_fallback_trigger_error_invoke(); } /**