correctly gc sessions

This commit is contained in:
Evan Prodromou 2009-07-21 11:31:34 -07:00
parent c74943e598
commit 84fb846939

View File

@ -106,14 +106,11 @@ class Session extends Memcached_DataObject
{
self::logdeb("garbage collection (maxlifetime = $maxlifetime)");
$epoch = time() - $maxlifetime;
$qry = 'DELETE FROM session ' .
'WHERE modified < "'.$epoch.'"';
$epoch = common_sql_date(time() - $maxlifetime);
$session = new Session();
$result = $session->query($qry);
$session->whereAdd('modified < "'.$epoch.'"');
$result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY);
self::logdeb("garbage collection result = $result");
}