From 875ac87206dddea2be55b357936d778bd031cd80 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Thu, 25 Aug 2022 15:12:35 +0100 Subject: [PATCH] Replace deprecated getTimeRaw with time --- ext/oauth-client/CRM/OAuth/MailSetup.php | 4 ++-- ext/oauth-client/Civi/Api4/Action/OAuthSysToken/Refresh.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/oauth-client/CRM/OAuth/MailSetup.php b/ext/oauth-client/CRM/OAuth/MailSetup.php index 127f69255d..99450579d8 100644 --- a/ext/oauth-client/CRM/OAuth/MailSetup.php +++ b/ext/oauth-client/CRM/OAuth/MailSetup.php @@ -158,8 +158,8 @@ class CRM_OAuth_MailSetup { return; } // Not certain if 'refresh' will complain about staleness. Doesn't hurt to double-check. - if (empty($token['access_token']) || $token['expires'] < CRM_Utils_Time::getTimeRaw()) { - throw new \OAuthException("Found invalid token for mail store #" . $mailSettings['id']); + if (empty($token['access_token']) || $token['expires'] < CRM_Utils_Time::time()) { + throw new \Civi\OAuth\OAuthException("Found invalid token for mail store #" . $mailSettings['id']); } $mailSettings['auth'] = 'XOAuth2'; diff --git a/ext/oauth-client/Civi/Api4/Action/OAuthSysToken/Refresh.php b/ext/oauth-client/Civi/Api4/Action/OAuthSysToken/Refresh.php index 008eaca1ae..3c75a94556 100644 --- a/ext/oauth-client/Civi/Api4/Action/OAuthSysToken/Refresh.php +++ b/ext/oauth-client/Civi/Api4/Action/OAuthSysToken/Refresh.php @@ -50,7 +50,7 @@ class Refresh extends BasicBatchAction { } protected function doTask($row) { - if ($this->threshold >= 0 && \CRM_Utils_Time::getTimeRaw() < $row['expires'] - $this->threshold) { + if ($this->threshold >= 0 && \CRM_Utils_Time::time() < $row['expires'] - $this->threshold) { return $this->filterReturn($row); } -- 2.25.1