diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-31 18:12:12 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-31 18:12:12 +0000 |
commit | f0f191c0786c329ca30bdfaa7a15fdc10fd2f5a9 (patch) | |
tree | 2d3fbe1a45846e44e64d1ccfcfdf9ea3a0c96a0b /lib/class/stream.class.php | |
parent | 87d14792fd28b1e5cef413d6634dcf9524fd0253 (diff) | |
download | ampache-f0f191c0786c329ca30bdfaa7a15fdc10fd2f5a9.tar.gz ampache-f0f191c0786c329ca30bdfaa7a15fdc10fd2f5a9.tar.bz2 ampache-f0f191c0786c329ca30bdfaa7a15fdc10fd2f5a9.zip |
slight tweak to do gcing a little more often, might scale this back later
Diffstat (limited to 'lib/class/stream.class.php')
-rw-r--r-- | lib/class/stream.class.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index fe40de79..d13271dd 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -139,6 +139,24 @@ class Stream { } // session_exists /** + * gc_session + * This function performes the garbage collection stuff, run on extend and on now playing refresh + */ + public static function gc_session($ip='',$agent='',$uid='',$sid='') { + + $time = time(); + $sql = "DELETE FROM `session_stream` WHERE `expire` < '$time'"; + $db_results = Dba::query($sql); + + // We need all of this to run this query + if ($ip AND $agent AND $uid AND $sid) { + $sql = "DELETE FROM `session_stream` WHERE `ip`='$ip' AND `agent`='$agent' AND `user`='$uid' AND `id` != '$sid'"; + $db_results = Dba::query($sql); + } + + } // gc_session + + /** * extend_session * This takes the passed sid and does a replace into also setting the user * agent and IP also do a little GC in this function @@ -155,8 +173,7 @@ class Stream { "WHERE `id`='$sid'"; $db_results = Dba::query($sql); - $sql = "DELETE FROM `session_stream` WHERE `ip`='$ip' AND `agent`='$agent' AND `user`='$uid' AND `id` != '$sid'"; - $db_results = Dba::query($sql); + self::gc_session($ip,$agent,$uid,$sid); return true; |