]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
don't delete during select
authorEvan Prodromou <evan@controlyourself.ca>
Sun, 2 Aug 2009 15:18:41 +0000 (11:18 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Sun, 2 Aug 2009 15:18:41 +0000 (11:18 -0400)
classes/Session.php

index a92ce405b518f34dbe03c93a90c6591d4d2e9eb7..5ec509f5f9ebbbf950a71f5a77280368fb9499bf 100644 (file)
@@ -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()