diff -u b/includes/bootstrap.inc b/includes/bootstrap.inc
--- b/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -948,7 +948,7 @@
if ($trigger_error) {
$error_type = $filename === FALSE ? 'missing' : 'moved';
if ($error_type == 'missing' || !$database_unavailable) {
- _drupal_get_filename_fallback_trigger_error($type, $name, $error_type);
+ _drupal_get_filename_fallback_trigger_error_register($type, $name, $error_type);
}
}
@@ -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,19 +1069,64 @@
*
* @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) {
+function _drupal_get_filename_fallback_trigger_error_register($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('_drupal_get_filename_fallback_trigger_error_register', array());
+ $errors_invoke_triggered = &drupal_static('_drupal_get_filename_fallback_trigger_error_invoke', FALSE);
+
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);
+ $errors_triggered[$type][$name][$error_type] = TRUE;
+
+ if ($errors_invoke_triggered) {
+ _drupal_get_filename_fallback_trigger_error($type, $name, $error_type);
}
- 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);
+ }
+}
+
+/**
+ * Triggers the errors that had been registered earlier.
+ *
+ * @see _drupal_get_filename_fallback_trigger_error_register()
+ */
+function _drupal_get_filename_fallback_trigger_error_invoke() {
+ $errors_triggered = &drupal_static('_drupal_get_filename_fallback_trigger_error_register', array());
+ $errors_invoke_triggered = &drupal_static('_drupal_get_filename_fallback_trigger_error_invoke', FALSE);
+
+ foreach ($errors_triggered as $type => $modules) {
+ foreach ($modules as $name => $types) {
+ foreach (array_keys($types) as $error_type) {
+ _drupal_get_filename_fallback_trigger_error($type, $name, $error_type);
+ }
}
- $errors_triggered[$type][$name][$error_type] = TRUE;
+ }
+
+ $errors_invoke_triggered = TRUE;
+}
+
+/**
+ * Directly call a trigger_error().
+ *
+ * @param $type
+ * The type of the item (theme, theme_engine, module, profile).
+ * @param $name
+ * The name of the item for which the filename is requested.
+ * @param $error_type
+ * The type of the error ('missing' or 'moved').
+ *
+ * @see _drupal_get_filename_fallback_trigger_error_invoke()
+ * @see _drupal_get_filename_fallback_trigger_error_register()
+ */
+function _drupal_get_filename_fallback_trigger_error($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);
}
}
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();
}
/**