[UPDATE] Removed redundant calls
This commit is contained in:
parent
4c7fe3387d
commit
1074c8c0bf
@ -6,32 +6,15 @@ if (!defined('SECURITY')) die('Hacking attempt');
|
|||||||
if ($user->isAuthenticated()) {
|
if ($user->isAuthenticated()) {
|
||||||
if (! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300;
|
if (! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300;
|
||||||
// Defaults to get rid of PHP Notice warnings
|
// Defaults to get rid of PHP Notice warnings
|
||||||
|
$dNetworkHashrate = 0;
|
||||||
$dDifficulty = 1;
|
$dDifficulty = 1;
|
||||||
$aRoundShares = 1;
|
$aRoundShares = 1;
|
||||||
|
|
||||||
// Only run these if the user is logged in
|
// Only run these if the user is logged in
|
||||||
$aRoundShares = $statistics->getRoundShares();
|
$aRoundShares = $statistics->getRoundShares();
|
||||||
if ($bitcoin->can_connect() === true) {
|
if ($bitcoin->can_connect() === true) {
|
||||||
$dDifficulty = $bitcoin->query('getdifficulty');
|
$dDifficulty = $bitcoin->getdifficulty();
|
||||||
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
|
$dNetworkHashrate = $bitcoin->getnetworkhashps();
|
||||||
$dDifficulty = $dDifficulty['proof-of-work'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always fetch this since we need for ministats header
|
|
||||||
$aRoundShares = $statistics->getRoundShares();
|
|
||||||
if ($bitcoin->can_connect() === true) {
|
|
||||||
$dDifficulty = $bitcoin->query('getdifficulty');
|
|
||||||
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
|
|
||||||
$dDifficulty = $dDifficulty['proof-of-work'];
|
|
||||||
try { $dNetworkHashrate = $bitcoin->query('getnetworkhashps') / 1000; } catch (Exception $e) {
|
|
||||||
// Maybe we are SHA
|
|
||||||
try { $dNetworkHashrate = $bitcoin->query('gethashespersec') / 1000; } catch (Exception $e) {
|
|
||||||
$dNetworkHashrate = 0;
|
|
||||||
}
|
|
||||||
$dNetworkHashrate = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$dNetworkHashrate = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch some data
|
// Fetch some data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user