Skip to content

Commit

Permalink
#4127 - Add 'Last Activity' date in Accounts Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
romanlesnikov committed Nov 17, 2022
1 parent 960ce0e commit bd4d142
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inc/classes/BxDolSessionQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . "`");
Expand Down

0 comments on commit bd4d142

Please sign in to comment.