Skip to content
Snippets Groups Projects
Commit f98273f9 authored by Dries Buytaert's avatar Dries Buytaert Committed by Dries Buytaert
Browse files

- Patch #1081266 by mfb: avoid re-scanning module directory when multiple modules are missing.

parent fb97b53f
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -850,7 +850,7 @@ function drupal_settings_initialize() { ...@@ -850,7 +850,7 @@ function drupal_settings_initialize() {
function drupal_get_filename($type, $name, $filename = NULL) { function drupal_get_filename($type, $name, $filename = NULL) {
// The location of files will not change during the request, so do not use // The location of files will not change during the request, so do not use
// drupal_static(). // drupal_static().
static $files = array(); static $files = array(), $dirs = array();
if (!isset($files[$type])) { if (!isset($files[$type])) {
$files[$type] = array(); $files[$type] = array();
...@@ -896,16 +896,19 @@ function drupal_get_filename($type, $name, $filename = NULL) { ...@@ -896,16 +896,19 @@ function drupal_get_filename($type, $name, $filename = NULL) {
$extension = $type; $extension = $type;
} }
if (!function_exists('drupal_system_listing')) { if (!isset($dirs[$dir][$extension])) {
require_once DRUPAL_ROOT . '/includes/common.inc'; $dirs[$dir][$extension] = TRUE;
} if (!function_exists('drupal_system_listing')) {
// Scan the appropriate directories for all files with the requested require_once DRUPAL_ROOT . '/includes/common.inc';
// extension, not just the file we are currently looking for. This }
// prevents unnecessary scans from being repeated when this function is // Scan the appropriate directories for all files with the requested
// called more than once in the same page request. // extension, not just the file we are currently looking for. This
$matches = drupal_system_listing("/^" . DRUPAL_PHP_FUNCTION_PATTERN . "\.$extension$/", $dir, 'name', 0); // prevents unnecessary scans from being repeated when this function is
foreach ($matches as $matched_name => $file) { // called more than once in the same page request.
$files[$type][$matched_name] = $file->uri; $matches = drupal_system_listing("/^" . DRUPAL_PHP_FUNCTION_PATTERN . "\.$extension$/", $dir, 'name', 0);
foreach ($matches as $matched_name => $file) {
$files[$type][$matched_name] = $file->uri;
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment