diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-08-02 11:18:41 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-08-02 11:18:56 -0400 |
commit | b27af3247d4e0a13a1cd8b29e3938e8d81fa3d22 (patch) | |
tree | 9d064d9cec4b606f072bc9e0b62ad6bb64f64c53 /classes/Session.php | |
parent | f342db586d2d95035c53581bebba66eb7e7f7eec (diff) |
don't delete during select
Diffstat (limited to 'classes/Session.php')
-rw-r--r-- | classes/Session.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/classes/Session.php b/classes/Session.php index a92ce405b..5ec509f5f 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -108,20 +108,24 @@ class Session extends Memcached_DataObject $epoch = common_sql_date(time() - $maxlifetime); + $ids = array(); + $session = new Session(); $session->whereAdd('modified < "'.$epoch.'"'); + $session->selectAdd(); + $session->selectAdd('id'); $session->find(); while ($session->fetch()) { - $other = new Session(); - $other->id = $session->id; - self::logdeb("Collecting session $other->id"); - $result = $other->delete(); - self::logdeb("garbage collection result = $result"); + $ids[] = $session->id; } $session->free(); + + foreach ($ids as $id) { + self::destroy($id); + } } static function setSaveHandler() |