connection = $connection; $this->time = $timeFactory; $this->tokenProvider = $tokenProvider; } public function getName(): string { return 'Update OAuth token expiration times'; } public function run(IOutput $output) { $qb = $this->connection->getQueryBuilder(); $qb->select('*') ->from('oauth2_access_tokens'); $cursor = $qb->execute(); while ($row = $cursor->fetch()) { $token = AccessToken::fromRow($row); try { $appToken = $this->tokenProvider->getTokenById($token->getTokenId()); $appToken->setExpires($this->time->getTime() + 3600); $this->tokenProvider->updateToken($appToken); } catch (InvalidTokenException $e) { //Skip this token } } $cursor->closeCursor(); } }