diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-08-06 17:02:56 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-08-06 17:02:56 +0000 |
commit | eb2b8261794cadde0becbcfc50a0049f52dc05f2 (patch) | |
tree | 34300380dc5287cfabcf25c3991fa863a387dfb5 /lib | |
parent | 8b733244acee4f2416d78569f7a403488397e69c (diff) | |
download | ampache-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')
-rw-r--r-- | lib/class/stream.class.php | 2 | ||||
-rw-r--r-- | lib/class/user.class.php | 10 | ||||
-rw-r--r-- | lib/log.lib.php | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index 1800990d..511f450b 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -587,7 +587,7 @@ class Stream { /* Never Upsample a song */ if (($sample_rate*1000) > $song->bitrate) { - $sample_rate = self::validate_bitrate($song->bitrate)/1000; + $sample_rate = self::validate_bitrate($song->bitrate/1000); $sample_ratio = '1'; } else { 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; diff --git a/lib/log.lib.php b/lib/log.lib.php index b0e06745..02ddb1a3 100644 --- a/lib/log.lib.php +++ b/lib/log.lib.php @@ -38,7 +38,7 @@ function log_event($username='Unknown',$event_name,$event_description,$log_name= $log_write = error_log($log_line, 3, $log_filename); if (!$log_write) { - echo "Error: Unable to write to log ($log_filename) Please check your log_path variable in ampache.cfg.php"; + echo "Warning: Unable to write to log ($log_filename) Please check your log_path variable in ampache.cfg.php"; } } // log_event |