Commit a8c9fa3e authored by Nigel McNie's avatar Nigel McNie

lastlastlogin, at request of Ray.

Haven't tested SSO updating it yet.
parent 7300bd94
......@@ -62,6 +62,7 @@ class User {
'expiry' => null,
'expirymailsent' => 0,
'lastlogin' => null,
'lastlastlogin' => null,
'lastauthinstance' => null,
'inactivemailsent' => 0,
'staff' => 0,
......@@ -107,6 +108,7 @@ class User {
*,
' . db_format_tsfield('expiry') . ',
' . db_format_tsfield('lastlogin') . ',
' . db_format_tsfield('lastlastlogin') . ',
' . db_format_tsfield('suspendedctime') . '
FROM
{usr}
......@@ -142,6 +144,7 @@ class User {
*,
' . db_format_tsfield('expiry') . ',
' . db_format_tsfield('lastlogin') . ',
' . db_format_tsfield('lastlastlogin') . ',
' . db_format_tsfield('suspendedctime') . '
FROM
{usr}
......@@ -205,6 +208,7 @@ class User {
u.*,
' . db_format_tsfield('u.expiry', 'expiry') . ',
' . db_format_tsfield('u.lastlogin', 'lastlogin') . ',
' . db_format_tsfield('u.lastlastlogin', 'lastlastlogin') . ',
' . db_format_tsfield('u.suspendedctime', 'suspendedctime') . '
FROM {usr} u
LEFT JOIN {auth_remote_user} r ON u.id = r.localusr
......@@ -224,6 +228,7 @@ class User {
*,
' . db_format_tsfield('expiry') . ',
' . db_format_tsfield('lastlogin') . ',
' . db_format_tsfield('lastlastlogin') . ',
' . db_format_tsfield('suspendedctime') . '
FROM
{usr}
......@@ -394,7 +399,7 @@ class User {
$this->stdclass = new StdClass;
reset($this->defaults);
foreach (array_keys($this->defaults) as $k) {
if ($k == 'expiry' || $k == 'lastlogin' || $k == 'suspendedctime') {
if ($k == 'expiry' || $k == 'lastlogin' || $k == 'lastlastlogin' || $k == 'suspendedctime') {
$this->stdclass->{$k} = db_format_timestamp($this->get($k));
} else {
$this->stdclass->{$k} = $this->get($k);//(is_null($this->get($k))? 'NULL' : $this->get($k));
......@@ -660,6 +665,7 @@ class LiveUser extends User {
*,
' . db_format_tsfield('expiry') . ',
' . db_format_tsfield('lastlogin') . ',
' . db_format_tsfield('lastlastlogin') . ',
' . db_format_tsfield('suspendedctime') . '
FROM
{usr}
......@@ -753,6 +759,7 @@ class LiveUser extends User {
$this->populate($user);
session_regenerate_id(true);
$this->lastlastlogin = $this->lastlogin;
$this->lastlogin = time();
$this->sessionid = session_id();
$this->logout_time = time() + get_config('session_timeout');
......
......@@ -245,6 +245,7 @@ class AuthXmlrpc extends Auth {
$this->import_user_settings($user, $remoteuser);
$user->lastlastlogin = $user->lastlogin;
$user->lastlogin = time();
//TODO: import institution's per-user-quota?:
......
......@@ -81,6 +81,7 @@
<FIELD NAME="expiry" TYPE="datetime" NOTNULL="false"/>
<FIELD NAME="expirymailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="lastlogin" TYPE="datetime" NOTNULL="false"/>
<FIELD NAME="lastlastlogin" TYPE="datetime" NOTNULL="false"/>
<FIELD NAME="inactivemailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="staff" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
......
......@@ -1363,6 +1363,13 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2008091602) {
$table = new XMLDBTable('usr');
$field = new XMLDBField('lastlastlogin');
$field->setAttributes(XMLDB_TYPE_DATETIME, null, null);
add_field($table, $field);
}
return $status;
}
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2008091601;
$config->version = 2008091602;
$config->release = '1.1.0alpha2dev';
$config->minupgradefrom = 2007080700;
$config->minupgraderelease = '0.8.0 (release tag 0.8.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