diff --git a/admin/index.php b/admin/index.php index 58966ede86d..203497d079a 100644 --- a/admin/index.php +++ b/admin/index.php @@ -241,6 +241,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()); @@ -271,9 +278,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'); @@ -351,8 +355,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(); @@ -386,8 +388,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); @@ -425,8 +425,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();