diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-07-21 11:31:34 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-07-21 11:32:01 -0700 |
commit | eb5679b0297738649b982dfb66af5021bb03be19 (patch) | |
tree | 1c9ece85eb7e8ba32a9f106b6af7df3c267aa3f1 | |
parent | 0333caf421308a61e5f76f334653ceeb0577c6c9 (diff) |
correctly gc sessions
-rw-r--r-- | classes/Session.php | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/classes/Session.php b/classes/Session.php index 93fd99baa..ac80279c5 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -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"); } |