From 11d97212edf88fa6e089e83811bd19eb1b8926b3 Mon Sep 17 00:00:00 2001 From: grimpirate Date: Tue, 22 Oct 2024 02:25:43 -0400 Subject: [PATCH] refactor: cleanup `DatabaseHandler::gc()` for session (#9230) * Removal of unneeded operations/variables * Update system/Session/Handlers/DatabaseHandler.php --------- Co-authored-by: Michal Sniatala --- system/Session/Handlers/DatabaseHandler.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/Session/Handlers/DatabaseHandler.php b/system/Session/Handlers/DatabaseHandler.php index 2d1d2fbbe97e..d36e9592cec0 100644 --- a/system/Session/Handlers/DatabaseHandler.php +++ b/system/Session/Handlers/DatabaseHandler.php @@ -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(); }