From cf8ef30aa1baeb39da4c189853e051e17969aba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Fri, 30 Nov 2007 23:09:14 +0000 Subject: #141727 follow up by dvessel: fix maintenance theme in updates --- includes/theme.inc | 10 ++++++++-- includes/theme.maintenance.inc | 18 +++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index 41eab6e3f..e46f7f411 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -416,7 +416,8 @@ function list_themes($refresh = FALSE) { $list = array(); $themes = array(); // Extract from the database only when it is available. - if (db_is_active() && db_table_exists('system')) { + // Also check that the site is not in the middle of an install or update. + if (db_is_active() && !defined('MAINTENANCE_MODE')) { $result = db_query("SELECT * FROM {system} WHERE type = '%s'", 'theme'); while ($theme = db_fetch_object($result)) { if (file_exists($theme->filename)) { @@ -426,7 +427,7 @@ function list_themes($refresh = FALSE) { } } else { - // When the database is unavailable, scan the installation. + // Scan the installation when the database should not be read. $themes = _system_theme_data(); } @@ -449,6 +450,11 @@ function list_themes($refresh = FALSE) { if (isset($theme->info['base theme'])) { $theme->base_theme = $theme->info['base theme']; } + // Status is normally retrieved from the database. Add zero values when + // read from the installation directory to prevent notices. + if (!isset($theme->status)) { + $theme->status = 0; + } $list[$theme->name] = $theme; } } diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc index cfc34e09b..142ae91ee 100644 --- a/includes/theme.maintenance.inc +++ b/includes/theme.maintenance.inc @@ -31,23 +31,23 @@ function _drupal_maintenance_theme() { require_once './includes/database.inc'; unicode_check(); - // 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'); - - $themes = list_themes(); - // Install and update pages are treated differently to prevent theming overrides. if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) { $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'); + $theme = variable_get('maintenance_theme', 'minnelli'); } + $themes = list_themes(); + // Store the identifier for retrieving theme settings with. $theme_key = $theme; -- cgit v1.2.3