Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.756.2.79
diff -u -p -r1.756.2.79 common.inc
--- includes/common.inc	4 Mar 2010 00:15:28 -0000	1.756.2.79
+++ includes/common.inc	6 Apr 2010 16:40:00 -0000
@@ -3692,14 +3692,7 @@ function drupal_flush_all_caches() {
   drupal_clear_css_cache();
   drupal_clear_js_cache();
 
-  // 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_theme_data();
-  }
-  else {
-    system_theme_data();
-  }
+  system_theme_data();
 
   drupal_rebuild_theme_registry();
   menu_rebuild();
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.585.2.49
diff -u -p -r1.585.2.49 system.module
--- modules/system/system.module	4 Mar 2010 00:15:28 -0000	1.585.2.49
+++ modules/system/system.module	6 Apr 2010 16:40:01 -0000
@@ -809,6 +809,11 @@ function system_theme_data() {
   // Scan the installation theme .info files and their engines.
   $themes = _system_theme_data();
 
+  // 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')
+    return $themes;
+
   // Extract current files from database.
   system_get_files_database($themes, 'theme');
 
