]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Session.php
change Laconica and Control Yourself to StatusNet in PHP files
[quix0rs-gnu-social.git] / classes / Session.php
index ac80279c5e300aab9429ffb4e367a00910d434f2..a94a5dbb995ae6617a1e461033a8776248e9bbd2 100644 (file)
@@ -2,8 +2,8 @@
 /**
  * Table Definition for session
  *
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2009, Control Yourself, Inc.
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -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()