From 1074c8c0bfff711304372aab13bff07934b44bd8 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Fri, 6 Dec 2013 14:35:28 +0100 Subject: [PATCH] [UPDATE] Removed redundant calls --- public/include/pages/dashboard.inc.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/public/include/pages/dashboard.inc.php b/public/include/pages/dashboard.inc.php index 22a4edec..e66558a4 100644 --- a/public/include/pages/dashboard.inc.php +++ b/public/include/pages/dashboard.inc.php @@ -6,32 +6,15 @@ if (!defined('SECURITY')) die('Hacking attempt'); if ($user->isAuthenticated()) { if (! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300; // Defaults to get rid of PHP Notice warnings + $dNetworkHashrate = 0; $dDifficulty = 1; $aRoundShares = 1; // Only run these if the user is logged in $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']; - } - - // 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; + $dDifficulty = $bitcoin->getdifficulty(); + $dNetworkHashrate = $bitcoin->getnetworkhashps(); } // Fetch some data