Index: includes/theme.maintenance.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v
retrieving revision 1.54
diff -u -p -5 -r1.54 theme.maintenance.inc
--- includes/theme.maintenance.inc	25 Feb 2010 20:57:39 -0000	1.54
+++ includes/theme.maintenance.inc	2 Mar 2010 12:49:59 -0000
@@ -28,24 +28,24 @@ function _drupal_maintenance_theme() {
   require_once DRUPAL_ROOT . '/includes/unicode.inc';
   require_once DRUPAL_ROOT . '/includes/file.inc';
   require_once DRUPAL_ROOT . '/includes/module.inc';
   unicode_check();
 
+  if (!function_exists('db_is_active')) {
+    // Because we are operating in a crippled environment, we need to
+    // bootstrap just enough to allow hook invocations to work.
+    require_once DRUPAL_ROOT . '/includes/database/database.inc';
+    $module_list['system']['filename'] = 'modules/system/system.module';
+    module_list(TRUE, FALSE, FALSE, $module_list);
+    drupal_load('module', 'system');
+  }
+
   // Install and update pages are treated differently to prevent theming overrides.
   if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
     $custom_theme = (isset($conf['maintenance_theme']) ? $conf['maintenance_theme'] : 'seven');
   }
   else {
-    if (!db_is_active()) {
-      // Because we are operating in a crippled environment, we need to
-      // bootstrap just enough to allow hook invocations to work.
-      require_once DRUPAL_ROOT . '/includes/database/database.inc';
-      $module_list['system']['filename'] = 'modules/system/system.module';
-      module_list(TRUE, FALSE, FALSE, $module_list);
-      drupal_load('module', 'system');
-    }
-
     // We use the default theme as the maintenance theme. If a default theme
     // isn't specified in the database or in settings.php, we use Garland.
     $custom_theme = variable_get('maintenance_theme', variable_get('theme_default', 'garland'));
   }
 
