]> source.dussan.org Git - nextcloud-server.git/commitdiff
only update last login timestamp with minute percision 33293/head
authorRobin Appelman <robin@icewind.nl>
Wed, 20 Jul 2022 14:43:42 +0000 (16:43 +0200)
committerRobin Appelman <robin@icewind.nl>
Wed, 20 Jul 2022 14:43:42 +0000 (16:43 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/User/User.php

index c5306d1df273cfe8c8692732be9a0b00b2fe30b7..7f7d6273e306b7c0e2baa1ee90232e3b95323f61 100644 (file)
@@ -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;
        }