Commit e2890beb authored by Richard Mansfield's avatar Richard Mansfield

Fix upgrade when not logged in

parent 281728d3
......@@ -333,6 +333,9 @@ function auth_setup () {
($siteclosed && !$cfgsiteclosed)
|| (!$siteclosed && $cfgsiteclosed)) {
set_config('siteclosed', $siteclosed);
if ($config->disablelogin) {
set_config('disablelogin', 1);
}
}
// Check the time that the session is set to log out. If the user does
......
......@@ -213,7 +213,7 @@ if (get_config('siteclosed')) {
if ($USER->is_logged_in()) {
$USER->logout();
}
if (!defined('HOME')) {
if (!defined('HOME') && !defined('INSTALLER')) {
redirect();
}
}
......
......@@ -408,6 +408,7 @@ $string['unreadmessages'] = 'unread messages';
$string['unreadmessage'] = 'unread message';
$string['siteclosed'] = 'The site is temporarily closed for a database upgrade. Site administrators may log in.';
$string['siteclosedlogindisabled'] = 'The site is temporarily closed for a database upgrade. <a href="%s">Perform the upgrade now.</a>';
// footer
$string['termsandconditions'] = 'Terms and Conditions';
......
......@@ -368,7 +368,14 @@ EOF;
$smarty->assign('SESSKEY', $USER->get('sesskey'));
$smarty->assign_by_ref('JAVASCRIPT', $javascript_array);
$smarty->assign_by_ref('HEADERS', $headers);
$smarty->assign('SITECLOSED', get_config('siteclosed'));
if (get_config('siteclosed')) {
if (get_config('disablelogin')) {
$smarty->assign('SITECLOSED', get_string('siteclosedlogindisabled', 'mahara', get_config('wwwroot') . 'admin/upgrade.php'));
}
else {
$smarty->assign('SITECLOSED', get_string('siteclosed'));
}
}
if ((!isset($extraconfig['pagehelp']) || $extraconfig['pagehelp'] !== false)
and $help = has_page_help()) {
......
......@@ -32,7 +32,7 @@
</head>
<body>
{if $USERMASQUERADING}<div class="sitemessage"><img src="{theme_path location='images/icon_problem.gif'}" alt="">{$masqueradedetails} {$becomeyouagain}</div>{/if}
{if $SITECLOSED}<div class="sitemessage center">{str tag=siteclosed}</div>{/if}
{if $SITECLOSED}<div class="sitemessage center">{$SITECLOSED}</div>{/if}
<div id="container">
<div id="loading_box" class="hidden"></div>
<div id="topwrapper">
......
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