Open
Description
Hello!
I found a method modSessionHandler::gc(), that must delete old sessions, but it seems that it is never used.
I think, that is why my modx_session table takes 1gb and contains 500 000 records.
For me i wrote a simple script, that randomly deletes old sessions:
$rand = rand(1, 100);
if ($rand === 1) {
$gcMaxlifetime = (integer) $modx->getOption('session_gc_maxlifetime', null, @ini_get('session.gc_maxlifetime'), true);
$access = time() - $gcMaxlifetime;
$modx->exec("
DELETE FROM {$modx->getTableName('modSession')} WHERE `access` < {$access};
OPTIMIZE TABLE {$modx->getTableName('modSession')};
");
}