From bd4d1426cdd3692281b9797a23e4998492fcd585 Mon Sep 17 00:00:00 2001 From: "roman.lesnikov@gmail.com" Date: Thu, 17 Nov 2022 14:29:46 +0200 Subject: [PATCH] #4127 - Add 'Last Activity' date in Accounts Manager --- inc/classes/BxDolSessionQuery.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/classes/BxDolSessionQuery.php b/inc/classes/BxDolSessionQuery.php index 3fa5209e52..efc501b7a1 100644 --- a/inc/classes/BxDolSessionQuery.php +++ b/inc/classes/BxDolSessionQuery.php @@ -63,14 +63,15 @@ function delete($sId) } function deleteExpired() { - $sSql = $this->prepare("SELECT `user_id`, `date` FROM `" . $this->sTable . "` WHERE `date` < (UNIX_TIMESTAMP() - ?)", BX_DOL_SESSION_LIFETIME); + $iTime = time() - BX_DOL_SESSION_LIFETIME; + $sSql = $this->prepare("SELECT `user_id`, `date` FROM `" . $this->sTable . "` WHERE `date` < ?", $iTime); $aRows = $this->getAll($sSql); foreach ($aRows as $aRow) { $this->updateLastActivityAccount($aRow['user_id'], $aRow['date']); } - $sSql = $this->prepare("DELETE FROM `" . $this->sTable . "` WHERE `date` < (UNIX_TIMESTAMP() - ?)", BX_DOL_SESSION_LIFETIME); + $sSql = $this->prepare("DELETE FROM `" . $this->sTable . "` WHERE `date` < ?", $iTime); $iRet = (int)$this->query($sSql); if ($iRet) $this->query("OPTIMIZE TABLE `" . $this->sTable . "`");