diff options
author | Dries <dries@buytaert.net> | 2011-10-16 12:43:15 -0400 |
---|---|---|
committer | Dries <dries@buytaert.net> | 2011-10-16 12:43:15 -0400 |
commit | a11b4c61473976f99a49af318e65569a443155f4 (patch) | |
tree | 1348ae172c9632b62c1381d1e90bed519843d632 /includes | |
parent | 19ac9357bbb419c3dac515888f43480a2c794d80 (diff) | |
download | brdo-a11b4c61473976f99a49af318e65569a443155f4.tar.gz brdo-a11b4c61473976f99a49af318e65569a443155f4.tar.bz2 |
- Patch #1081266 by mfb: avoid re-scanning module directory when multiple modules are missing.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 323293050..b67139e14 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -826,7 +826,7 @@ function drupal_settings_initialize() { function drupal_get_filename($type, $name, $filename = NULL) { // The location of files will not change during the request, so do not use // drupal_static(). - static $files = array(); + static $files = array(), $dirs = array(); if (!isset($files[$type])) { $files[$type] = array(); @@ -872,16 +872,19 @@ function drupal_get_filename($type, $name, $filename = NULL) { $extension = $type; } - if (!function_exists('drupal_system_listing')) { - require_once DRUPAL_ROOT . '/includes/common.inc'; - } - // Scan the appropriate directories for all files with the requested - // extension, not just the file we are currently looking for. This - // prevents unnecessary scans from being repeated when this function is - // called more than once in the same page request. - $matches = drupal_system_listing("/^" . DRUPAL_PHP_FUNCTION_PATTERN . "\.$extension$/", $dir, 'name', 0); - foreach ($matches as $matched_name => $file) { - $files[$type][$matched_name] = $file->uri; + if (!isset($dirs[$dir][$extension])) { + $dirs[$dir][$extension] = TRUE; + if (!function_exists('drupal_system_listing')) { + require_once DRUPAL_ROOT . '/includes/common.inc'; + } + // Scan the appropriate directories for all files with the requested + // extension, not just the file we are currently looking for. This + // prevents unnecessary scans from being repeated when this function is + // called more than once in the same page request. + $matches = drupal_system_listing("/^" . DRUPAL_PHP_FUNCTION_PATTERN . "\.$extension$/", $dir, 'name', 0); + foreach ($matches as $matched_name => $file) { + $files[$type][$matched_name] = $file->uri; + } } } } |