Commit 410e6e62 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Drop lastauthinstance column from usr table (bug 3154)

parent 7645954e
......@@ -81,7 +81,6 @@ if ($institution || $add) {
db_begin();
foreach ($authinstanceids as $id) {
delete_records('auth_instance_config', 'instance', $id);
execute_sql('UPDATE {usr} SET lastauthinstance = NULL WHERE lastauthinstance = ?', array($id));
}
delete_records('auth_instance', 'institution', $values['i']);
delete_records('host', 'institution', $values['i']);
......@@ -425,7 +424,6 @@ function institution_submit(Pieform $form, $values) {
}
foreach($values['authplugin']['deletearray'] as $instanceid) {
execute_sql('UPDATE {usr} SET lastauthinstance = NULL WHERE lastauthinstance = ?', array($instanceid));
delete_records('auth_remote_user', 'authinstance', $instanceid);
delete_records('auth_instance_config', 'instance', $instanceid);
delete_records('auth_instance', 'id', $instanceid);
......
......@@ -64,7 +64,6 @@ class User {
'lastlogin' => null,
'lastlastlogin' => null,
'lastaccess' => null, /* Is not necessarily updated every request, see accesstimeupdatefrequency config variable */
'lastauthinstance' => null,
'inactivemailsent' => 0,
'staff' => 0,
'admin' => 0,
......@@ -799,7 +798,6 @@ class LiveUser extends User {
}
$auth = AuthFactory::create($instanceid);
if ($auth->authenticate_user_account($user, $password)) {
$user->lastauthinstance = $auth->instanceid;
$this->authenticate($user, $auth->instanceid);
// Check for a suspended institution
......@@ -924,7 +922,6 @@ class LiveUser extends User {
*/
public function reanimate($id, $instanceid) {
if ($user = get_record('usr','id',$id)) {
$user->lastauthinstance = $instanceid;
$this->authenticate($user, $instanceid);
return true;
}
......
......@@ -105,11 +105,9 @@
<FIELD NAME="quotaused" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="authinstance" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" />
<FIELD NAME="sessionid" TYPE="char" LENGTH="32" NOTNULL="false" DEFAULT="" />
<FIELD NAME="lastauthinstance" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="NULL" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="lastauthinstancefk" TYPE="foreign" FIELDS="lastauthinstance" REFTABLE="auth_instance" REFFIELDS="id" />
<KEY NAME="authinstancefk" TYPE="foreign" FIELDS="authinstance" REFTABLE="auth_instance" REFFIELDS="id" />
</KEYS>
<INDEXES>
......
......@@ -1113,6 +1113,12 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2009070900) {
$table = new XMLDBTable('usr');
$field = new XMLDBField('lastauthinstance');
drop_field($table, $field);
}
return $status;
}
......
......@@ -760,7 +760,7 @@ function delete_user($userid) {
// by deleted users.
$authinst = get_field('auth_instance', 'id', 'institution', 'mahara', 'authname', 'internal');
if ($authinst) {
$deleterec->authinstance = $deleterec->lastauthinstance = $authinst;
$deleterec->authinstance = $authinst;
}
update_record('usr', $deleterec);
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009070700;
$config->version = 2009070900;
$config->release = '1.2.0alpha3dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
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