From 1a361486a9a8ea88c2f3cfeb9acd8a2b7d21b9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Wed, 2 Apr 2014 11:59:43 +0800 Subject: [PATCH] MDL-44882 always set maintenance mode on non-cached admin pages This should resolve all issues with themes during upgrades. --- admin/index.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/admin/index.php b/admin/index.php index d31eeac6f52..4947c5e381a 100644 --- a/admin/index.php +++ b/admin/index.php @@ -237,6 +237,13 @@ if (!core_tables_exist()) { // Check version of Moodle code on disk compared with database // and upgrade if possible. +if (!$cache) { + // Do not try to do anything fancy in non-cached mode, + // this prevents themes from fetching data from non-existent tables. + $PAGE->set_pagelayout('maintenance'); + $PAGE->set_popup_notification_allowed(false); +} + $stradministration = get_string('administration'); $PAGE->set_context(context_system::instance()); @@ -267,9 +274,6 @@ if (!$cache and $version > $CFG->version) { // upgrade // We then purge the regular caches. purge_all_caches(); - $PAGE->set_pagelayout('maintenance'); - $PAGE->set_popup_notification_allowed(false); - /** @var core_admin_renderer $output */ $output = $PAGE->get_renderer('core', 'admin'); @@ -347,8 +351,6 @@ if (!$cache and $version > $CFG->version) { // upgrade // Always verify plugin dependencies! $failed = array(); if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) { - $PAGE->set_pagelayout('maintenance'); - $PAGE->set_popup_notification_allowed(false); $reloadurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0)); echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl); die(); @@ -382,8 +384,6 @@ if (!$cache and moodle_needs_upgrading()) { if (!$confirmplugins) { $strplugincheck = get_string('plugincheck'); - $PAGE->set_pagelayout('maintenance'); - $PAGE->set_popup_notification_allowed(false); $PAGE->navbar->add($strplugincheck); $PAGE->set_title($strplugincheck); $PAGE->set_heading($strplugincheck); @@ -421,8 +421,6 @@ if (!$cache and moodle_needs_upgrading()) { // Make sure plugin dependencies are always checked. $failed = array(); if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) { - $PAGE->set_pagelayout('maintenance'); - $PAGE->set_popup_notification_allowed(false); $reloadurl = new moodle_url('/admin/index.php', array('cache' => 0)); echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl); die();