summaryrefslogtreecommitdiffstats
path: root/lib/class/user.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-06 17:02:56 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-08-06 17:02:56 +0000
commiteb2b8261794cadde0becbcfc50a0049f52dc05f2 (patch)
tree34300380dc5287cfabcf25c3991fa863a387dfb5 /lib/class/user.class.php
parent8b733244acee4f2416d78569f7a403488397e69c (diff)
downloadampache-eb2b8261794cadde0becbcfc50a0049f52dc05f2.tar.gz
ampache-eb2b8261794cadde0becbcfc50a0049f52dc05f2.tar.bz2
ampache-eb2b8261794cadde0becbcfc50a0049f52dc05f2.zip
make the ip history only clear the old stuff sometimes, also fix rounding issues on the downsampling
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r--lib/class/user.class.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 19eabfe1..00e7e34d 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -569,10 +569,12 @@ class User extends database_object {
$sql = "INSERT INTO `ip_history` (`ip`,`user`,`date`) VALUES ('$ip','$user','$date')";
$db_results = Dba::query($sql);
- /* Clean up old records */
- $date = time() - (86400*Config::get('user_ip_cardinality'));
- $sql = "DELETE FROM `ip_history` WHERE `date` < $date";
- $db_results = Dba::query($sql);
+ /* Clean up old records... sometimes */
+ if (rand(1,100) > 60) {
+ $date = time() - (86400*Config::get('user_ip_cardinality'));
+ $sql = "DELETE FROM `ip_history` WHERE `date` < $date";
+ $db_results = Dba::query($sql);
+ }
return true;