]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Merge pull request #12311 from matthiasmoritz/event-details-do-not-render-correctly...
[friendica.git] / src / Model / User.php
index 73c380561c9c80786e5a98e8f615da7da7dced95..40384b619beb3ec1c7a6c2a0c1fe51c6234630fc 100644 (file)
@@ -665,6 +665,26 @@ class User
                return $user;
        }
 
+       /**
+        * Update the day of the last activity of the given user
+        *
+        * @param integer $uid
+        * @return void
+        */
+       public static function updateLastActivity(int $uid)
+       {
+               $user = User::getById($uid, ['last-activity']);
+               if (empty($user)) {
+                       return;
+               }
+
+               $current_day = DateTimeFormat::utcNow('Y-m-d');
+
+               if ($user['last-activity'] != $current_day) {
+                       User::update(['last-activity' => $current_day], $uid);
+               }
+       }
+
        /**
         * Generates a human-readable random password
         *