]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
correctly gc sessions
authorEvan Prodromou <evan@controlyourself.ca>
Tue, 21 Jul 2009 18:31:34 +0000 (11:31 -0700)
committerEvan Prodromou <evan@controlyourself.ca>
Tue, 21 Jul 2009 18:31:34 +0000 (11:31 -0700)
classes/Session.php

index 93fd99baa817ee2a6ddd75c7e16b95094917f746..ac80279c5e300aab9429ffb4e367a00910d434f2 100644 (file)
@@ -106,14 +106,11 @@ class Session extends Memcached_DataObject
     {
         self::logdeb("garbage collection (maxlifetime = $maxlifetime)");
 
-        $epoch = time() - $maxlifetime;
-
-        $qry = 'DELETE FROM session ' .
-          'WHERE modified < "'.$epoch.'"';
+        $epoch = common_sql_date(time() - $maxlifetime);
 
         $session = new Session();
-
-        $result = $session->query($qry);
+        $session->whereAdd('modified < "'.$epoch.'"');
+        $result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY);
 
         self::logdeb("garbage collection result = $result");
     }