diff -u b/core/includes/module.inc b/core/includes/module.inc --- b/core/includes/module.inc +++ b/core/includes/module.inc @@ -189,8 +189,14 @@ $enabled_modules = config('system.module')->get(); _system_list_warm('module', 'system', 'core/modules/system.module', TRUE); system_list_reset(); - $module_data = system_rebuild_module_data(FALSE); - $theme_data = system_rebuild_theme_data(FALSE); + $module_file_list = state()->get('system.module_file_list'); + $theme_data = state()->get('system.themes'); + // As themes do not need to be installed to be used during installation the + // state entry for system.themes might not exist. This will be resolved by + // http://drupal.org/node/1067408. + if (empty($theme_data)) { + $theme_data = system_rebuild_theme_data(FALSE); + } $lists = array( 'bootstrap' => array(), 'module_enabled' => array(), @@ -240,7 +246,7 @@ foreach ($enabled_modules as $name => $weight) { // Build a list of all enabled modules. $lists['module_enabled'][$name] = $name; - $filename = $module_data[$name]->filename; + $filename = $module_file_list[$name]; // Build a list of filenames so drupal_get_filename can use it. $lists['filepaths'][] = array( 'type' => 'module', diff -u b/core/modules/system/system.module b/core/modules/system/system.module --- b/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2811,6 +2811,7 @@ // reference from system_list_reset() during the rebuild. if (!isset($modules_cache['data'])) { $modules = _system_rebuild_module_data(); + $module_file_list = array(); ksort($modules); // Add status, weight and schema. foreach ($modules as $module => $record) { @@ -2819,6 +2820,7 @@ $record->weight = 0; $record->status = 0; $record->schema_version = SCHEMA_UNINSTALLED; + $module_file_list[$module] = $record->filename; } // Enabled status and weights. foreach (config('system.module')->get() as $module => $weight) { @@ -2831,6 +2833,9 @@ system_list_reset(); } $modules_cache['data'] = $modules; + // Store module filenames so that if can be retrieved during system_list() + // without a rebuild. + state()->set('system.module_file_list', $module_file_list); } // Running the info alter function is not possible before full bootstrap. if (!isset($modules_cache['info_alter']) && drupal_get_bootstrap_phase() >= DRUPAL_BOOTSTRAP_CODE) { @@ -3006,6 +3011,9 @@ if ($reset) { system_list_reset(); } + // Store theme data so that if can be retrieved during system_list() without + // a rebuild. + state()->set('system.themes', $themes); return $themes; }