Empty commit

This commit is contained in:
Git 2012-04-24 08:00:23 +00:00
parent 078b5553b2
commit 6bc378e094

View File

@ -221,27 +221,33 @@
if(($PeerStats = $Cache->get_value('stats_peers')) === false) { if(($PeerStats = $Cache->get_value('stats_peers')) === false) {
//Cache lock! //Cache lock!
$Lock = $Cache->get_value('stats_peers_lock'); $PeerStatsLocked = $Cache->get_value('stats_peers_lock');
if($Lock) { if(!$PeerStatsLocked) {
?><script type="script/javascript">setTimeout('window.location="http://<?=NONSSL_SITE_URL?><?=$_SERVER['REQUEST_URI']?>"', 5)</script><? $Cache->cache_value('stats_peers_lock', 1, 30);
} else {
$Cache->cache_value('stats_peers_lock', '1', 10);
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid) FROM xbt_files_users WHERE active=1 GROUP BY Type"); $DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid) FROM xbt_files_users WHERE active=1 GROUP BY Type");
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false); $PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
$SeederCount = isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0; $SeederCount = $PeerCount['Seeding'][1] ?: 0;
$LeecherCount = isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0; $LeecherCount = $PeerCount['Leeching'][1] ?: 0;
$Cache->cache_value('stats_peers',array($LeecherCount,$SeederCount),0); $Cache->cache_value('stats_peers', array($LeecherCount,$SeederCount), 0);
$Cache->delete_value('stats_peers_lock');
} }
} else { } else {
$PeerStatsLocked = false;
list($LeecherCount,$SeederCount) = $PeerStats; list($LeecherCount,$SeederCount) = $PeerStats;
} }
$Ratio = ratio($SeederCount, $LeecherCount); if(!$PeerStatsLocked) {
$PeerCount = $SeederCount + $LeecherCount; $Ratio = ratio($SeederCount, $LeecherCount);
$PeerCount = number_format($SeederCount + $LeecherCount);
$SeederCount = number_format($SeederCount);
$LeecherCount = number_format($LeecherCount);
} else {
$PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
}
?> ?>
<li>Peers: <?=number_format($PeerCount) ?></li> <li>Peers: <?=$PeerCount?></li>
<li>Seeders: <?=number_format($SeederCount) ?></li> <li>Seeders: <?=$SeederCount?></li>
<li>Leechers: <?=number_format($LeecherCount) ?></li> <li>Leechers: <?=$LeecherCount?></li>
<li>Seeder/Leecher Ratio: <?=$Ratio?></li> <li>Seeder/Leecher Ratio: <?=$Ratio?></li>
</ul> </ul>
</div> </div>