diff -u b/includes/bootstrap.inc b/includes/bootstrap.inc
--- b/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -979,8 +979,8 @@
}
// This file has moved. Store its new location in the file scan cache.
$file_scans[$type][$name] = $filename_from_file_scan;
- // Create a user-level warning.
- trigger_error(format_string('The following %type has moved on the file system: %name. In order to fix this, clear caches or put the file 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);
+ // Create a user-level warning about the moved file.
+ _drupal_get_filename_fallback_create_error($type, $name, 'moved');
}
return $filename_from_file_scan;
}
@@ -992,8 +992,35 @@
}
// Mark the file as missing.
$file_scans[$type][$name] = FALSE;
- // Create a user-level warning.
- trigger_error(format_string('The following %type is missing from the file system: %name. In order to fix this, put the file back in its original location or uninstall the module. For more information, see the documentation page.', array('%type' => $type, '%name' => $name, '@documentation' => 'https://www.drupal.org/node/2487215')), E_USER_WARNING);
+ // Create a user-level warning about the missing file.
+ _drupal_get_filename_fallback_create_error($type, $name, 'missing');
+ }
+}
+
+/**
+ * Helper function for _drupal_get_filename_fallback().
+ *
+ * Creates a user-level warning when a missing or moved file is detected in
+ * _drupal_get_filename_fallback().
+ *
+ * @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').
+ */
+function _drupal_get_filename_fallback_create_error($type, $name, $error_type) {
+ // Make sure we only show any missing/moved file error only once per request.
+ static $errors_created = array();
+ if (empty($errors_shown[$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 file back in its original location or uninstall the module. 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 on the file system: %name. In order to fix this, clear caches or put the file 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_created[$type][$name][$error_type] = TRUE;
}
}