diff -u b/core/includes/module.inc b/core/includes/module.inc --- b/core/includes/module.inc +++ b/core/includes/module.inc @@ -144,7 +144,7 @@ } } else { - $lists = _system_list_rebuild(); + $lists = _system_list_prepare(); } // We only return the module names here since module_list() doesn't need // the filename itself. @@ -156,10 +156,7 @@ $lists = $cached->data; } else { - if (_system_list_rebuild(TRUE) && $type == 'module_enabled') { - return drupal_map_assoc(array_keys(config('system.module')->get())); - } - $lists = _system_list_rebuild(); + $lists = _system_list_prepare(); $lists['bootstrap'] = array_keys($lists['bootstrap']); } foreach ($lists['filepaths'] as $item) { @@ -171,15 +168,13 @@ } /** - * Rebuild the system list data structure. + * Prepares the system list data structure. + * + * @return + * An associative array of modules and themes, keyed by list type: bootstrap, + * module_enabled, theme, filepaths. */ -function _system_list_rebuild($test_only = FALSE) { - static $in_rebuild = FALSE; - - if ($test_only) { - return $in_rebuild; - } - $in_rebuild = TRUE; +function _system_list_prepare() { // The module name (rather than the filename) is used as the fallback // weighting in order to guarantee consistent behavior across different // Drupal installations, which might have modules installed in different