Skip to content

Commit

Permalink
Dev Renamed lastLogin field
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Mar 26, 2021
1 parent 43c52d3 commit 0556d22
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

$config['versionnumber'] = '4.4.14';
$config['dbversionnumber'] = 442;
$config['dbversionnumber'] = 443;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
Expand Down
2 changes: 1 addition & 1 deletion application/core/LSUserIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected function postLogin()
}

//At last store the login time in the user table
$user->lastLogin = date('Y-m-d H:i:s');
$user->last_login = date('Y-m-d H:i:s');
$user->save();
}

Expand Down
5 changes: 5 additions & 0 deletions application/helpers/update/updatedb_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3783,6 +3783,11 @@ function ($v) {
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 442), "stg_name='DBVersion'");
$oTransaction->commit();
}
if ($iOldDBVersion < 443) {
$oDB->createCommand()->renameColumn('{{users}}', 'lastLogin', 'last_login');
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 443), "stg_name='DBVersion'");
$oTransaction->commit();

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Mar 26, 2021

Collaborator

This is why we need to refactor this function into command object pattern instead. Too easy to forget something.

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Mar 26, 2021

Collaborator

Also, wasn't this tested in a separate branch?

}
} catch (Exception $e) {
Yii::app()->setConfig('Updating', false);
$oTransaction->rollback();
Expand Down
4 changes: 2 additions & 2 deletions application/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function attributeLabels()
'dateformat' => gT('Date format'),
'created' => gT('Created at'),
'modified' => gT('Modified at'),
'lastLogin' => gT('Last recorded login'),
'last_login' => gT('Last recorded login'),
];
}

Expand Down Expand Up @@ -741,7 +741,7 @@ function ($oRoleMapping) {
public function getLastloginFormatted()
{

$lastLogin = $this->lastLogin;
$lastLogin = $this->last_login;
if ($lastLogin == null) {
return '---';
}
Expand Down
2 changes: 1 addition & 1 deletion installer/create-database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ function populateDatabase($oDB)
'questionselectormode' => "string(7) NOT NULL default 'default'",
'one_time_pw' => "text",
'dateformat' => "integer NOT NULL DEFAULT 1",
'lastLogin' => "datetime NULL",
'last_login' => "datetime NULL",
'created' => "datetime",
'modified' => "datetime",
), $options);
Expand Down

0 comments on commit 0556d22

Please sign in to comment.