Index: includes/theme.maintenance.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v
retrieving revision 1.10
diff -u -p -r1.10 theme.maintenance.inc
--- includes/theme.maintenance.inc	24 Jan 2008 09:42:50 -0000	1.10
+++ includes/theme.maintenance.inc	12 Jul 2009 23:38:18 -0000
@@ -36,12 +36,15 @@ function _drupal_maintenance_theme() {
     $theme = 'minnelli';
   }
   else {
-    // Load module basics (needed for hook invokes).
-    $module_list['system']['filename'] = 'modules/system/system.module';
-    $module_list['filter']['filename'] = 'modules/filter/filter.module';
-    module_list(TRUE, FALSE, FALSE, $module_list);
-    drupal_load('module', 'system');
-    drupal_load('module', 'filter');
+    if (!db_is_active()) {
+      // Because we are operating in a crippled environment, we need to
+      // bootstrap just enough to allow hook invocations to work.
+      $module_list['system']['filename'] = 'modules/system/system.module';
+      $module_list['filter']['filename'] = 'modules/filter/filter.module';
+      module_list(TRUE, FALSE, FALSE, $module_list);
+      drupal_load('module', 'system');
+      drupal_load('module', 'filter');
+    }
 
     $theme = variable_get('maintenance_theme', 'minnelli');
   }
