Fixed session garbage collector
This commit is contained in:
parent
21712c5c23
commit
94d797b4b7
|
@ -159,7 +159,26 @@ function pandora_session_gc($max_lifetime=300)
|
|||
global $config;
|
||||
|
||||
if (isset($config['session_timeout'])) {
|
||||
$max_lifetime = $config['session_timeout'];
|
||||
$session_timeout = $config['session_timeout'];
|
||||
} else {
|
||||
// if $config doesn`t work ...
|
||||
$session_timeout = db_get_value(
|
||||
'value',
|
||||
'tconfig',
|
||||
'token',
|
||||
'session_timeout'
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($session_timeout)) {
|
||||
if ($session_timeout == -1) {
|
||||
// The session expires in 10 years
|
||||
$session_timeout = 315576000;
|
||||
} else {
|
||||
$session_timeout *= 60;
|
||||
}
|
||||
|
||||
$max_lifetime = $session_timeout;
|
||||
}
|
||||
|
||||
$time_limit = (time() - $max_lifetime);
|
||||
|
@ -171,6 +190,11 @@ function pandora_session_gc($max_lifetime=300)
|
|||
]
|
||||
);
|
||||
|
||||
// Deleting cron and empty sessions.
|
||||
$sql = "DELETE FROM tsessions_php WHERE
|
||||
data IS NULL OR id_session REGEXP '^cron-'";
|
||||
db_process_sql($sql);
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue