? a.patch
? sites/default/settings.php
Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.202
diff -u -p -r1.202 install.php
--- install.php	25 Aug 2009 21:53:46 -0000	1.202
+++ install.php	29 Aug 2009 19:54:11 -0000
@@ -1294,7 +1294,7 @@ function install_bootstrap_full(&$instal
  */
 function install_profile_modules(&$install_state) {
   $modules = variable_get('install_profile_modules', array());
-  $files = system_get_module_data();
+  $files = system_rebuild_module_data();
   variable_del('install_profile_modules');
   $operations = array();
   foreach ($modules as $module) {
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.977
diff -u -p -r1.977 common.inc
--- includes/common.inc	26 Aug 2009 15:00:17 -0000	1.977
+++ includes/common.inc	29 Aug 2009 19:54:12 -0000
@@ -4932,10 +4932,10 @@ function drupal_flush_all_caches() {
   // If invoked from update.php, we must not update the theme information in the
   // database, or this will result in all themes being disabled.
   if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
-    _system_get_theme_data();
+    _system_rebuild_theme_data();
   }
   else {
-    system_get_theme_data();
+    system_rebuild_theme_data();
   }
 
   drupal_theme_rebuild();
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.110
diff -u -p -r1.110 install.inc
--- includes/install.inc	24 Aug 2009 03:13:44 -0000	1.110
+++ includes/install.inc	29 Aug 2009 19:54:12 -0000
@@ -551,7 +551,7 @@ function drupal_verify_profile($install_
  *   Normally just testing wants to set this to TRUE.
  */
 function drupal_install_modules($module_list = array(), $disable_modules_installed_hook = FALSE) {
-  $files = system_get_module_data();
+  $files = system_rebuild_module_data();
   $module_list = array_flip(array_values($module_list));
   do {
     $moved = FALSE;
@@ -645,7 +645,7 @@ function drupal_install_system() {
     ->execute();
   // Now that we've installed things properly, bootstrap the full Drupal environment
   drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-  system_get_module_data();
+  system_rebuild_module_data();
 }
 
 /**
Index: includes/registry.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/registry.inc,v
retrieving revision 1.24
diff -u -p -r1.24 registry.inc
--- includes/registry.inc	24 Aug 2009 00:14:18 -0000	1.24
+++ includes/registry.inc	29 Aug 2009 19:54:12 -0000
@@ -35,7 +35,7 @@ function _registry_rebuild() {
   require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/query.inc';
 
   // Get current list of modules and their files.
-  $modules = system_get_module_data();
+  $modules = system_rebuild_module_data();
   // Get the list of files we are going to parse.
   $files = array();
   foreach ($modules as &$module) {
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.517
diff -u -p -r1.517 theme.inc
--- includes/theme.inc	29 Aug 2009 04:16:14 -0000	1.517
+++ includes/theme.inc	29 Aug 2009 19:54:12 -0000
@@ -549,7 +549,7 @@ function list_themes($refresh = FALSE) {
     }
     else {
       // Scan the installation when the database should not be read.
-      $themes = _system_get_theme_data();
+      $themes = _system_rebuild_theme_data();
     }
 
     foreach ($themes as $theme) {
Index: includes/theme.maintenance.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v
retrieving revision 1.38
diff -u -p -r1.38 theme.maintenance.inc
--- includes/theme.maintenance.inc	26 Aug 2009 10:53:45 -0000	1.38
+++ includes/theme.maintenance.inc	29 Aug 2009 19:54:12 -0000
@@ -221,7 +221,7 @@ function template_preprocess_maintenance
 
   global $theme;
   // Retrieve the theme data to list all available regions.
-  $theme_data = _system_get_theme_data();
+  $theme_data = _system_rebuild_theme_data();
   $regions = $theme_data[$theme]->info['regions'];
 
   // Get all region content set with drupal_add_region_content().
Index: includes/update.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/update.inc,v
retrieving revision 1.5
diff -u -p -r1.5 update.inc
--- includes/update.inc	22 Aug 2009 18:24:14 -0000	1.5
+++ includes/update.inc	29 Aug 2009 19:54:12 -0000
@@ -151,8 +151,8 @@ function update_check_incompatibility($n
 
   // Store values of expensive functions for future use.
   if (empty($themes) || empty($modules)) {
-    $themes = _system_get_theme_data();
-    $modules = system_get_module_data();
+    $themes = _system_rebuild_theme_data();
+    $modules = system_rebuild_module_data();
   }
 
   if ($type == 'module' && isset($modules[$name])) {
Index: modules/help/help.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/help/help.admin.inc,v
retrieving revision 1.9
diff -u -p -r1.9 help.admin.inc
--- modules/help/help.admin.inc	6 Jun 2009 16:05:26 -0000	1.9
+++ modules/help/help.admin.inc	29 Aug 2009 19:54:12 -0000
@@ -47,7 +47,7 @@ function help_page($name) {
 
 function help_links_as_list() {
   $empty_arg = drupal_help_arg();
-  $module_info = system_get_module_data();
+  $module_info = system_rebuild_module_data();
 
   $modules = array();
   foreach (module_implements('help', TRUE) as $module) {
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.197
diff -u -p -r1.197 system.admin.inc
--- modules/system/system.admin.inc	26 Aug 2009 10:53:45 -0000	1.197
+++ modules/system/system.admin.inc	29 Aug 2009 19:54:12 -0000
@@ -146,12 +146,11 @@ function system_admin_menu_block_page() 
  */
 function system_admin_by_module() {
 
-  $modules = system_get_module_data();
+  $module_info = system_get_info('module');
   $menu_items = array();
   $help_arg = module_exists('help') ? drupal_help_arg() : FALSE;
 
-  foreach ($modules as $file) {
-    $module = $file->name;
+  foreach ($module_info as $module => $info) {
     if ($module == 'help') {
       continue;
     }
@@ -169,7 +168,7 @@ function system_admin_by_module() {
       // Sort.
       ksort($admin_tasks);
 
-      $menu_items[$file->info['name']] = array($file->info['description'], $admin_tasks);
+      $menu_items[$info['name']] = array($info['description'], $admin_tasks);
     }
   }
   return theme('system_admin_by_module', $menu_items);
@@ -200,7 +199,7 @@ function system_settings_overview() {
  */
 function system_themes_form() {
 
-  $themes = system_get_theme_data();
+  $themes = system_rebuild_theme_data();
   uasort($themes, 'system_sort_modules_by_info_name');
 
   $status = array();
@@ -388,7 +387,7 @@ function system_theme_settings(&$form_st
   if ($key) {
     $settings = theme_get_settings($key);
     $var = str_replace('/', '_', 'theme_' . $key . '_settings');
-    $themes = system_get_theme_data();
+    $themes = system_rebuild_theme_data();
     $features = $themes[$key]->info['features'];
   }
   else {
@@ -635,7 +634,7 @@ function _system_is_incompatible(&$incom
  */
 function system_modules($form_state = array()) {
   // Get current list of modules.
-  $files = system_get_module_data();
+  $files = system_rebuild_module_data();
 
   // Remove hidden modules from display list.
   foreach ($files as $filename => $file) {
@@ -826,7 +825,7 @@ function _system_modules_build_row($info
  * Display confirmation form for required modules.
  *
  * @param $modules
- *   Array of module file objects as returned from system_get_module_data().
+ *   Array of module file objects as returned from system_rebuild_module_data().
  * @param $storage
  *   The contents of $form_state['storage']; an array with two
  *   elements: the list of required modules and the list of status
@@ -884,7 +883,7 @@ function system_modules_submit($form, &$
 
   // Get a list of all modules, it will be used to find which module requires
   // which.
-  $files = system_get_module_data();
+  $files = system_rebuild_module_data();
 
   // The modules to be enabled.
   $modules_to_be_enabled = array();
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.67
diff -u -p -r1.67 system.api.php
--- modules/system/system.api.php	29 Aug 2009 06:57:27 -0000	1.67
+++ modules/system/system.api.php	29 Aug 2009 19:54:12 -0000
@@ -669,9 +669,10 @@ function hook_mail_alter(&$message) {
 /**
  * Alter the information parsed from module and theme .info files
  *
- * This hook is invoked in _system_get_module_data() and in _system_get_theme_data().
- * A module may implement this hook in order to add to or alter the data
- * generated by reading the .info file with drupal_parse_info_file().
+ * This hook is invoked in _system_rebuild_module_data() and in
+ * _system_rebuild_theme_data(). A module may implement this hook in order to
+ * add to or alter the data generated by reading the .info file with
+ * drupal_parse_info_file().
  *
  * @param &$info
  *   The .info file contents, passed by reference so that it can be altered.
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.383
diff -u -p -r1.383 system.install
--- modules/system/system.install	29 Aug 2009 10:38:58 -0000	1.383
+++ modules/system/system.install	29 Aug 2009 19:54:12 -0000
@@ -341,7 +341,7 @@ function system_install() {
   }
 
   // Load system theme data appropriately.
-  system_get_theme_data();
+  system_rebuild_theme_data();
 
   // Inserting uid 0 here confuses MySQL -- the next user might be created as
   // uid 2 which is not what we want. So we insert the first user here, the
@@ -2090,7 +2090,7 @@ function system_update_7021() {
   variable_del('site_footer');
 
   // Rebuild theme data, so the new 'help' region is identified.
-  system_get_theme_data();
+  system_rebuild_theme_data();
 
   return $ret;
 }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.780
diff -u -p -r1.780 system.module
--- modules/system/system.module	29 Aug 2009 05:46:04 -0000	1.780
+++ modules/system/system.module	29 Aug 2009 19:54:12 -0000
@@ -1842,12 +1842,42 @@ function system_update_files_database(&$
 }
 
 /**
+ * Returns an array of information about active modules or themes.
+ *
+ * This function returns the information from the {system} table corresponding
+ * to the cached contents of the .info file for each active module or theme.
+ * If the $rebuild parameter is TRUE, the data in the table is rebuilt to be
+ * sure it reflects the current files on disk.
+ *
+ * @param $type
+ *   Either 'module' or 'theme'.
+ * @param $rebuild
+ *   Optional boolean. If TRUE, the data in the database will be rebuilt
+ *   before being fetched.
+ *
+ * @return
+ *   An associative array of module or theme information keyed by name.
+ */
+function system_get_info($type, $rebuild = FALSE) {
+  $info = array();
+  if ($rebuild && ($type == 'module' || $type == 'theme')) {
+    $rebuild_function = "system_rebuild_{$type}_data";
+    $rebuild_function();
+  }
+  $result = db_query('SELECT name, info FROM {system} WHERE type = :type AND status = 1', array(':type' => $type));
+  foreach ($result as $item) {
+    $info[$item->name] = unserialize($item->info);
+  }
+  return $info;
+}
+
+/**
  * Helper function to scan and collect module .info data.
  *
  * @return
  *   An associative array of module information.
  */
-function _system_get_module_data() {
+function _system_rebuild_module_data() {
   // Find modules
   $modules = drupal_system_listing('/\.module$/', 'modules', 'name', 0);
 
@@ -1898,13 +1928,13 @@ function _system_get_module_data() {
 }
 
 /**
- * Collect data about all currently available modules.
+ * Rebuild, save, and return data about all currently available modules.
  *
  * @return
  *   Array of all available modules and their data.
  */
-function system_get_module_data() {
-  $modules = _system_get_module_data();
+function system_rebuild_module_data() {
+  $modules = _system_rebuild_module_data();
   ksort($modules);
   system_get_files_database($modules, 'module');
   system_update_files_database($modules, 'module');
@@ -1934,7 +1964,7 @@ function system_get_module_data() {
  * @return
  *   An associative array of themes information.
  */
-function _system_get_theme_data() {
+function _system_rebuild_theme_data() {
   $themes_info = &drupal_static(__FUNCTION__, array());
 
   if (empty($themes_info)) {
@@ -2060,13 +2090,13 @@ function _system_get_theme_data() {
 }
 
 /**
- * Collect data about all currently available themes.
+ * Rebuild, save, and return data about all currently available themes.
  *
  * @return
  *   Array of all available themes and their data.
  */
-function system_get_theme_data() {
-  $themes = _system_get_theme_data();
+function system_rebuild_theme_data() {
+  $themes = _system_rebuild_theme_data();
   ksort($themes);
   system_get_files_database($themes, 'theme');
   system_update_files_database($themes, 'theme');
Index: modules/update/update.compare.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.compare.inc,v
retrieving revision 1.29
diff -u -p -r1.29 update.compare.inc
--- modules/update/update.compare.inc	24 Aug 2009 00:42:34 -0000	1.29
+++ modules/update/update.compare.inc	29 Aug 2009 19:54:12 -0000
@@ -36,8 +36,8 @@ function update_get_projects() {
     $projects = update_project_cache('update_project_projects');
     if (empty($projects)) {
       // Still empty, so we have to rebuild the cache.
-      $module_data = system_get_module_data();
-      $theme_data = system_get_theme_data();
+      $module_data = system_rebuild_module_data();
+      $theme_data = system_rebuild_theme_data();
       _update_process_info_list($projects, $module_data, 'module', TRUE);
       _update_process_info_list($projects, $theme_data, 'theme', TRUE);
       if (variable_get('update_check_disabled', FALSE)) {
