Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
only update last login timestamp with minute percision
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Jul 20, 2022
commit 9e34a2112920c89ed531291b52065e4421ed071d
13 changes: 9 additions & 4 deletions lib/private/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,15 @@ public function getLastLogin() {
* updates the timestamp of the most recent login of this user
*/
public function updateLastLoginTimestamp() {
$firstTimeLogin = ($this->getLastLogin() === 0);
$this->lastLogin = time();
$this->config->setUserValue(
$this->uid, 'login', 'lastLogin', (string)$this->lastLogin);
$previousLogin = $this->getLastLogin();
$now = time();
$firstTimeLogin = $previousLogin === 0;

if ($now - $previousLogin > 60) {
$this->lastLogin = time();
$this->config->setUserValue(
$this->uid, 'login', 'lastLogin', (string)$this->lastLogin);
}

return $firstTimeLogin;
}
Expand Down