refactor: cleanup DatabaseHandler::gc() for session (#9230)

* Removal of unneeded operations/variables

* Update system/Session/Handlers/DatabaseHandler.php

---------

Co-authored-by: Michal Sniatala <michal@sniatala.pl>
This commit is contained in:
grimpirate 2024-10-22 02:25:43 -04:00 committed by GitHub
parent 4a7fbd1229
commit 11d97212ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -282,12 +282,9 @@ class DatabaseHandler extends BaseHandler
#[ReturnTypeWillChange]
public function gc($max_lifetime)
{
$separator = ' ';
$interval = implode($separator, ['', "{$max_lifetime} second", '']);
return $this->db->table($this->table)->where(
'timestamp <',
"now() - INTERVAL {$interval}",
"now() - INTERVAL {$max_lifetime} second",
false
)->delete() ? 1 : $this->fail();
}