From ab2a62efa39fdf3efcf423b4f8dcc29d1c3eafa1 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 30 Apr 2014 15:23:22 +0200 Subject: [PATCH] [REMOVED] Getnavbardata API --- public/include/config/admin_settings.inc.php | 14 ---- .../include/pages/api/getnavbardata.inc.php | 76 ------------------- 2 files changed, 90 deletions(-) delete mode 100644 public/include/pages/api/getnavbardata.inc.php diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index 9ed22091..b5839ef7 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -364,20 +364,6 @@ $aSettings['system'][] = array( 'name' => 'disable_dashboard_api', 'value' => $setting->getValue('disable_dashboard_api'), 'tooltip' => 'Disable dashboard API entirely to reduce server load.' ); -$aSettings['system'][] = array( - 'display' => 'Disable Live Navbar', 'type' => 'select', - 'options' => array( 0 => 'No', 1 => 'Yes'), - 'default' => 0, - 'name' => 'disable_navbar', 'value' => $setting->getValue('disable_navbar'), - 'tooltip' => 'Disable live updates on the navbar to reduce server load.' -); -$aSettings['system'][] = array( - 'display' => 'Disable Navbar API', 'type' => 'select', - 'options' => array( 0 => 'No', 1 => 'Yes'), - 'default' => 0, - 'name' => 'disable_navbar_api', 'value' => $setting->getValue('disable_navbar_api'), - 'tooltip' => 'Disable navbar API entirely to reduce server load. Used in pool stats and navbar mini stats.' -); $aSettings['system'][] = array( 'display' => 'Disable TX Summaries', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes'), diff --git a/public/include/pages/api/getnavbardata.inc.php b/public/include/pages/api/getnavbardata.inc.php deleted file mode 100644 index 24ab357e..00000000 --- a/public/include/pages/api/getnavbardata.inc.php +++ /dev/null @@ -1,76 +0,0 @@ -getValue('disable_navbar_api')) { - echo $api->get_json(array('error' => 'disabled')); - die(); -} - -// System load check -if ($load = @sys_getloadavg()) { - if (isset($config['system']['load']['max']) && $load[0] > $config['system']['load']['max']) { - header('HTTP/1.1 503 Too busy, try again later'); - die('Server too busy. Please try again later.'); - } -} - -// Fetch RPC information -if ($bitcoin->can_connect() === true) { - $dNetworkHashrate = $bitcoin->getnetworkhashps(); - $dDifficulty = $bitcoin->getdifficulty(); - $iBlock = $bitcoin->getblockcount(); -} else { - $dNetworkHashrate = 0; - $dDifficulty = 1; - $iBlock = 0; -} - -// Some settings -if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300; -if ( ! $dPoolHashrateModifier = $setting->getValue('statistics_pool_hashrate_modifier') ) $dPoolHashrateModifier = 1; -if ( ! $dNetworkHashrateModifier = $setting->getValue('statistics_network_hashrate_modifier') ) $dNetworkHashrateModifier = 1; - -// Fetch raw data -$statistics->setGetCache(false); -$dPoolHashrate = $statistics->getCurrentHashrate($interval); -if ($dPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $dPoolHashrate; -$statistics->setGetCache(true); - -// Small helper -$aHashunits = array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ); - -// Apply pool modifiers -$dPoolHashrateAdjusted = $dPoolHashrate * $dPoolHashrateModifier; -$dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier; - -// Use caches for this one -$aRoundShares = $statistics->getRoundShares(); - -$iTotalRoundShares = $aRoundShares['valid'] + $aRoundShares['invalid']; -if ($iTotalRoundShares > 0) { - $dPoolInvalidPercent = round($aRoundShares['invalid'] / $iTotalRoundShares * 100, 2); -} else { - $dUserInvalidPercent = 0; - $dPoolInvalidPercent = 0; -} - -// Round progress -$iEstShares = $statistics->getEstimatedShares($dDifficulty); -if ($iEstShares > 0 && $aRoundShares['valid'] > 0) { - $dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2); -} else { - $dEstPercent = 0; -} - -// Output JSON format -$data = array( - 'raw' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'pool' => array( 'hashrate' => $dPoolHashrate ) ), - 'pool' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'hashrate' => $dPoolHashrateAdjusted, 'estimated' => $iEstShares, 'progress' => $dEstPercent ), - 'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ) -); -echo $api->get_json($data); - -// Supress master template -$supress_master = 1; -?>