From fb4810d6251788b1023f9c4354be9e83c4c720d2 Mon Sep 17 00:00:00 2001 From: "What.CD" Date: Tue, 24 May 2011 08:00:09 +0000 Subject: [PATCH] Prevent the merging of non-music groups Include empty values in cache debug table Clear cache when replying to staff pm Internal cache is useless in get_artists and get_groups --- sections/tools/data/economic_stats.php | 16 ++++++++++++---- sections/userhistory/ip_history.php | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sections/tools/data/economic_stats.php b/sections/tools/data/economic_stats.php index ee1bc8b2..eb41579a 100644 --- a/sections/tools/data/economic_stats.php +++ b/sections/tools/data/economic_stats.php @@ -38,12 +38,20 @@ list($AvailableBounty) = $DB->next_record(); $DB->query("SELECT SUM(Snatched), COUNT(ID) FROM torrents"); list($TotalSnatches, $TotalTorrents) = $DB->next_record(); // This is the total number of snatches for torrents that still exist + + $DB->query("SELECT COUNT(uid) FROM xbt_snatched"); list($TotalOverallSnatches) = $DB->next_record(); - $DB->query("SELECT COUNT(fid) FROM xbt_files_users WHERE remaining=0"); - list($TotalSeeders) = $DB->next_record(); - $DB->query("SELECT COUNT(fid) FROM xbt_files_users"); - list($TotalPeers) = $DB->next_record(); + + if(($PeerStats = $Cache->get_value('stats_peers')) === false) { + $DB->query("SELECT COUNT(fid) FROM xbt_files_users WHERE remaining=0"); + list($TotalSeeders) = $DB->next_record(); + $DB->query("SELECT COUNT(fid) FROM xbt_files_users WHERE remaining>0"); + list($TotalLeechers) = $DB->next_record(); + } else { + list($TotalLeechers,$TotalSeeders) = $PeerStats; + } + $TotalPeers = $TotalLeechers + $TotalSeeders; $DB->query("SELECT COUNT(ID) FROM users_main WHERE(SELECT COUNT(uid) FROM xbt_files_users WHERE uid=users_main.ID)>0"); list($TotalPeerUsers) = $DB->next_record(); $Cache->cache_value('new_economic_stats', diff --git a/sections/userhistory/ip_history.php b/sections/userhistory/ip_history.php index eeba95ed..46a071f8 100644 --- a/sections/userhistory/ip_history.php +++ b/sections/userhistory/ip_history.php @@ -107,7 +107,9 @@ function ShowIPs(rowname) { } ?> - ()
+ + ()
+ ('.count($UserIDs).')' : '(0)')?>