Commit 53d73327 authored by Robert Lyon's avatar Robert Lyon
Browse files

Logout setting of cookie breaks upgrade from pre 1.9 to 1.9+ (Bug #1353153)

If the user who is upgrading the site is logged into the site and is a
member of a normal (not mahara) institution it causes the upgrade to
break because the upgrade process tries to log them out and logout()
function tries to set a cookie and the cookie needs info from the
config_institution table and it doesn't exist yet.

Change-Id: Ib8bb83fc1b774cec5636af6009ebf9906349bca3
Signed-off-by: Robert Lyon's avatarRobert Lyon <>
parent 30a3e92f
......@@ -1472,8 +1472,13 @@ class LiveUser extends User {
* Logs the current user out
public function logout () {
// add long-term cookie to record institution user last used
set_cookie('lastinstitution', $this->sitepages_institutionname_by_theme('loggedouthome'), '2240561472', true);
// Add long-term cookie to record institution user last used.
// We can only do if the institution_config table exists,
// which it will not if we are upgrading from pre 1.9 so we check when
// the institution_config table was added.
if (get_config('version') >= '2014010800') {
set_cookie('lastinstitution', $this->sitepages_institutionname_by_theme('loggedouthome'), '2240561472', true);
require_once(get_config('libroot') . 'ddl.php');
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