]> 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 a92ce405b518f34dbe03c93a90c6591d4d2e9eb7..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,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()