From: Evan Prodromou Date: Sun, 2 Aug 2009 15:18:41 +0000 (-0400) Subject: don't delete during select X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8157336a0d5da46889d2c06a7ea451651abcb964;p=quix0rs-gnu-social.git don't delete during select --- diff --git a/classes/Session.php b/classes/Session.php index a92ce405b5..5ec509f5f9 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()