Commit cf8ef30a authored by Gábor Hojtsy's avatar Gábor Hojtsy

#141727 follow up by dvessel: fix maintenance theme in updates

parent 442fe519
......@@ -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;
}
}
......
......@@ -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;
......
......@@ -32,6 +32,17 @@ function install_main() {
// Set up $language, so t() caller functions will still work.
drupal_init_language();
// Load module basics (needed for hook invokes).
include_once './includes/module.inc';
$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');
// Set up theme system for the maintenance page.
drupal_maintenance_theme();
// Check existing settings.php.
$verify = install_verify_settings();
......@@ -63,14 +74,6 @@ function install_main() {
$task = NULL;
}
// Load module basics (needed for hook invokes).
include_once './includes/module.inc';
$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');
// Decide which profile to use.
if (!empty($_GET['profile'])) {
$profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
......@@ -104,7 +107,6 @@ function install_main() {
// If any error messages are set now, it means a requirement problem.
$messages = drupal_set_message();
if (!empty($messages['error'])) {
drupal_maintenance_theme();
install_task_list('requirements');
drupal_set_title(st('Requirements problem'));
print theme('install_page', '');
......@@ -191,7 +193,6 @@ function install_change_settings($profile = 'default', $install_locale = '') {
// We always need this because we want to run form_get_errors.
include_once './includes/form.inc';
drupal_maintenance_theme();
install_task_list('database');
if ($db_url == 'mysql://username:password@localhost/databasename') {
......@@ -444,7 +445,6 @@ function install_select_profile() {
}
}
drupal_maintenance_theme();
install_task_list('profile-select');
drupal_set_title(st('Select an installation profile'));
......@@ -510,7 +510,6 @@ function install_select_locale($profilename) {
// the user know what he is doing.
if (count($locales) == 1) {
if ($profilename == 'default') {
drupal_maintenance_theme();
install_task_list('locale-select');
drupal_set_title(st('Choose language'));
if (!empty($_GET['localize'])) {
......@@ -552,7 +551,6 @@ function install_select_locale($profilename) {
}
}
drupal_maintenance_theme();
install_task_list('locale-select');
drupal_set_title(st('Choose language'));
......@@ -592,7 +590,6 @@ function install_select_locale_form(&$form_state, $locales) {
* Show an error page when there are no profiles available.
*/
function install_no_profile_error() {
drupal_maintenance_theme();
install_task_list('profile-select');
drupal_set_title(st('No profiles available'));
print theme('install_page', '<p>'. st('We were unable to find any installer profiles. Installer profiles tell us what modules to enable and what schema to install in the database. A profile is necessary to continue with the installation process.') .'</p>');
......@@ -606,7 +603,6 @@ function install_no_profile_error() {
function install_already_done_error() {
global $base_url;
drupal_maintenance_theme();
drupal_set_title(st('Drupal already installed'));
print theme('install_page', st('<ul><li>To start over, you must empty your existing database.</li><li>To install to a different database, edit the appropriate <em>settings.php</em> file in the <em>sites</em> folder.</li><li>To upgrade an existing installation, proceed to the <a href="@base-url/update.php">update script</a>.</li><li>View your <a href="@base-url">existing site</a>.</li></ul>', array('@base-url' => $base_url)));
exit;
......@@ -627,7 +623,6 @@ function install_tasks($profile, $task) {
$url = $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile;
// Build a page for final tasks.
drupal_maintenance_theme();
if (empty($task)) {
variable_set('install_task', 'locale-initial-import');
$task = 'locale-initial-import';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment