Index: includes/theme.maintenance.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v
retrieving revision 1.46
diff -u -p -r1.46 theme.maintenance.inc
--- includes/theme.maintenance.inc	19 Nov 2009 15:50:23 -0000	1.46
+++ includes/theme.maintenance.inc	21 Nov 2009 04:48:38 -0000
@@ -15,7 +15,7 @@
  * "maintenance_theme" key in the $conf variable in settings.php.
  */
 function _drupal_maintenance_theme() {
-  global $theme, $theme_key;
+  global $theme, $theme_key, $conf;
 
   // If $theme is already set, assume the others are set too, and do nothing.
   if (isset($theme)) {
@@ -33,7 +33,7 @@ function _drupal_maintenance_theme() {
 
   // Install and update pages are treated differently to prevent theming overrides.
   if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
-    $custom_theme = 'seven';
+    $custom_theme = (isset($conf['maintenance_theme']) ? $conf['maintenance_theme'] : 'seven');
   }
   else {
     if (!db_is_active()) {
@@ -46,7 +46,9 @@ function _drupal_maintenance_theme() {
       drupal_load('module', 'filter');
     }
 
-    $custom_theme = variable_get('maintenance_theme', 'minnelli');
+    // 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 Minnelli.
+    $custom_theme = variable_get('maintenance_theme', variable_get('theme_default', 'minnelli'));
   }
 
   $themes = list_themes();
@@ -199,13 +201,18 @@ function theme_update_page($variables) {
     $variables['messages'] .= theme('status_messages', array('display' => 'warning'));
   }
 
-  // This was called as a theme hook (not template), so we need to
-  // fix path_to_theme() for the template, to point at the actual
-  // theme rather than system module as owner of the hook.
-  global $theme_path;
-  $theme_path = 'themes/seven';
+  // This was called as a theme hook (not template), so we need to fix
+  // path_to_theme() for the template, to point at the actual theme rather than
+  // system module as owner of the hook. Additionally, figure out the
+  // maintenance page template to use.
+  global $theme_path, $theme_info, $base_theme_info;
+  $theme_path = dirname($theme_info->uri);
+  $base_themes = $base_theme_info;
+  while (!file_exists($theme_path . '/maintenance-page.tpl.php') && $base_theme = array_shift($base_themes)) {
+    $theme_path = dirname($base_theme->uri);
+  }
 
-  return theme_render_template('themes/seven/maintenance-page.tpl.php', $variables);
+  return theme_render_template($theme_path . '/maintenance-page.tpl.php', $variables);
 }
 
 /**
Index: modules/simpletest/tests/menu.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu.test,v
retrieving revision 1.22
diff -u -p -r1.22 menu.test
--- modules/simpletest/tests/menu.test	19 Nov 2009 15:50:23 -0000	1.22
+++ modules/simpletest/tests/menu.test	21 Nov 2009 04:56:45 -0000
@@ -60,7 +60,7 @@ class MenuIncTestCase extends DrupalWebT
     // For a regular user, the fact that the site is in maintenance mode means
     // we expect the theme callback system to be bypassed entirely.
     $this->drupalGet('menu-test/theme-callback/use-admin-theme');
-    $this->assertRaw('minnelli/minnelli.css', t("The maintenance theme's CSS appears on the page."));
+    $this->assertRaw('garland/style.css', t("The maintenance theme's CSS appears on the page."));
 
     // An administrator, however, should continue to see the requested theme.
     $admin_user = $this->drupalCreateUser(array('access site in maintenance mode'));
