Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-07-20 17:43:42 +0300
committerRobin Appelman <robin@icewind.nl>2022-07-20 17:43:42 +0300
commit9e34a2112920c89ed531291b52065e4421ed071d (patch)
tree9d232207b6009bbd0affee8fe233144b81265cca
parentde08b53b4eaa69621de0e863071c55671e74441c (diff)
only update last login timestamp with minute percisionlast-login-minute
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/User/User.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index c5306d1df27..7f7d6273e30 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -244,10 +244,15 @@ class User implements IUser {
* 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;
}