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);
}
}
@@ -1072,36 +1072,62 @@
* @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. We delay the trigger_error to _drupal_bootstrap_full()
// to prevent calling watchdog early in the bootstrap.
- $errors_triggered = &drupal_static(__FUNCTION__, array());
+ $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])) {
$errors_triggered[$type][$name][$error_type] = TRUE;
+
+ if ($errors_invoke_triggered) {
+ _drupal_get_filename_fallback_trigger_error($type, $name, $error_type);
+ }
}
}
/**
* Triggers the errors that had been registered earlier.
*
- * @see _drupal_get_filename_fallback_trigger_error()
+ * @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', array());
+ $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) {
- 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);
- }
+ _drupal_get_filename_fallback_trigger_error($type, $name, $error_type);
}
}
}
+
+ $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);
+ }
}
/**