don't delete during select
This commit is contained in:
parent
f342db586d
commit
b27af3247d
@ -108,20 +108,24 @@ class Session extends Memcached_DataObject
|
|||||||
|
|
||||||
$epoch = common_sql_date(time() - $maxlifetime);
|
$epoch = common_sql_date(time() - $maxlifetime);
|
||||||
|
|
||||||
|
$ids = array();
|
||||||
|
|
||||||
$session = new Session();
|
$session = new Session();
|
||||||
$session->whereAdd('modified < "'.$epoch.'"');
|
$session->whereAdd('modified < "'.$epoch.'"');
|
||||||
|
$session->selectAdd();
|
||||||
|
$session->selectAdd('id');
|
||||||
|
|
||||||
$session->find();
|
$session->find();
|
||||||
|
|
||||||
while ($session->fetch()) {
|
while ($session->fetch()) {
|
||||||
$other = new Session();
|
$ids[] = $session->id;
|
||||||
$other->id = $session->id;
|
|
||||||
self::logdeb("Collecting session $other->id");
|
|
||||||
$result = $other->delete();
|
|
||||||
self::logdeb("garbage collection result = $result");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$session->free();
|
$session->free();
|
||||||
|
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
self::destroy($id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function setSaveHandler()
|
static function setSaveHandler()
|
||||||
|
Loading…
Reference in New Issue
Block a user