summaryrefslogtreecommitdiff
path: root/classes/Session.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Session.php')
-rw-r--r--classes/Session.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/classes/Session.php b/classes/Session.php
index ac80279c5..5ec509f5f 100644
--- a/classes/Session.php
+++ b/classes/Session.php
@@ -108,11 +108,24 @@ class Session extends Memcached_DataObject
$epoch = common_sql_date(time() - $maxlifetime);
+ $ids = array();
+
$session = new Session();
$session->whereAdd('modified < "'.$epoch.'"');
- $result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY);
+ $session->selectAdd();
+ $session->selectAdd('id');
+
+ $session->find();
+
+ while ($session->fetch()) {
+ $ids[] = $session->id;
+ }
+
+ $session->free();
- self::logdeb("garbage collection result = $result");
+ foreach ($ids as $id) {
+ self::destroy($id);
+ }
}
static function setSaveHandler()