Skip to content

Commit 5cc585a

Browse files
committed
Merge branch 'master' into wip-version-7
2 parents 963683e + ac4a475 commit 5cc585a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Repositories/AccessTokenRepository.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,18 @@ public function removeExpired(): void
245245
{
246246
$accessTokenTableName = $this->getTableName();
247247
$refreshTokenTableName = $this->database->applyPrefix(RefreshTokenRepository::TABLE_NAME);
248+
$now = $this->helpers->dateTime()->getUtc()->format(DateFormatsEnum::DB_DATETIME->value);
248249

249250
// Delete expired access tokens, but only if the corresponding refresh token is also expired.
250251
$this->database->write(
251252
"DELETE FROM $accessTokenTableName WHERE expires_at < :now AND
252253
NOT EXISTS (
253254
SELECT 1 FROM {$refreshTokenTableName}
254-
WHERE $accessTokenTableName.id = $refreshTokenTableName.access_token_id AND expires_at > :now
255+
WHERE $accessTokenTableName.id = $refreshTokenTableName.access_token_id AND expires_at > :now2
255256
)",
256257
[
257-
'now' => $this->helpers->dateTime()->getUtc()->format(DateFormatsEnum::DB_DATETIME->value),
258+
'now' => $now,
259+
'now2' => $now,
258260
],
259261
);
260262
}

0 commit comments

Comments
 (0)