Skip to content

Commit b769b7b

Browse files
Cari Spruiellisitnikov
authored andcommitted
MAGETWO-51292: [GITHUB] OAuth Token Exchange Expiration Period Is Not Calculated Correctly #3449
- changed SQL to use UTC_TIMESTAMP to correctly calculate datetime diffs without adjusting for time zone
1 parent 0b6c6ba commit b769b7b

File tree

1 file changed

+2
-2
lines changed
  • app/code/Magento/Integration/Model/ResourceModel/Oauth

1 file changed

+2
-2
lines changed

app/code/Magento/Integration/Model/ResourceModel/Oauth/Consumer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getTimeInSecondsSinceCreation($consumerId)
5656
$select = $connection->select()
5757
->from($this->getMainTable())
5858
->reset(\Magento\Framework\DB\Select::COLUMNS)
59-
->columns(new \Zend_Db_Expr('CURRENT_TIMESTAMP() - created_at'))
59+
->columns(new \Zend_Db_Expr('UTC_TIMESTAMP() - created_at'))
6060
->where('entity_id = ?', $consumerId);
6161

6262
return $connection->fetchOne($select);
@@ -74,7 +74,7 @@ public function getTimeInSecondsSinceTokenExchangeStarted($consumerId)
7474
$select = $connection->select()
7575
->from($this->getMainTable())
7676
->reset(\Magento\Framework\DB\Select::COLUMNS)
77-
->columns(new \Zend_Db_Expr('CURRENT_TIMESTAMP() - updated_at'))
77+
->columns(new \Zend_Db_Expr('UTC_TIMESTAMP() - updated_at'))
7878
->where('entity_id = ?', $consumerId);
7979

8080
return $connection->fetchOne($select);

0 commit comments

Comments
 (0)