Skip to content

Commit

Permalink
refactor: cleanup DatabaseHandler::gc() for session (codeigniter4#9230
Browse files Browse the repository at this point in the history
)

* Removal of unneeded operations/variables

* Update system/Session/Handlers/DatabaseHandler.php

---------

Co-authored-by: Michal Sniatala <[email protected]>
  • Loading branch information
grimpirate and michalsn authored Oct 22, 2024
1 parent 4a7fbd1 commit 11d9721
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions system/Session/Handlers/DatabaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,9 @@ public function destroy($id): bool
#[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();
}
Expand Down

0 comments on commit 11d9721

Please sign in to comment.