diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index c10d7f17bc2af..202b85ee51774 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -128,6 +128,8 @@ public function updateTokenActivity(IToken $token) { // Update token only once per minute $token->setLastActivity($now); $this->mapper->update($token); + } elseif (!empty($token->getUpdatedFields())) { + $this->mapper->update($token); } } diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index b9cfce6c86930..a4b6832b3d320 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -221,8 +221,15 @@ public function updateTokenActivity(IToken $token) { /** @var PublicKeyToken $token */ $now = $this->time->getTime(); if ($token->getLastActivity() < ($now - $activityInterval)) { + $updateFull = !empty($token->getUpdatedFields()); $token->setLastActivity($now); - $this->mapper->updateActivity($token, $now); + if ($updateFull) { + $this->mapper->update($token); + } else { + $this->mapper->updateActivity($token, $now); + } + } elseif (!empty($token->getUpdatedFields())) { + $this->mapper->update($token); } }