diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index 5a374ca9..439350b8 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -7,14 +7,32 @@ if (!defined('SECURITY')) // Globally available variables $debug->append('Global smarty variables', 3); +if (!$iRoundShares = $memcache->get('iRoundShares')) { + $debug->append('Fetching iRoundShares from database'); + $iRoundShares = $share->getRoundShares(); + $memcache->set('iRoundShares', $iRoundShares, 60); +} + +if (!$iCurrentActiveWorkers = $memcache->get('iCurrentActiveWorkers')) { + $debug->append('Fetching iCurrentActiveWorkers from database'); + $iCurrentActiveWorkers = $worker->getCountAllActiveWorkers(); + $memcache->set('iCurrentActiveWorkers', $iCurrentActiveWorkers, 60); +} + +if (!$iCurrentPoolHashrate = $memcache->get('iCurrentPoolHashrate')) { + $debug->append('Fetching iCurrentPoolHashrate from database'); + $iCurrentPoolHashrate = $statistics->getCurrentHashrate(); + $memcache->set('iCurrentPoolHashrate', $iCurrentPoolHashrate, 60); +} + $aGlobal = array( 'userdata' => $_SESSION['USERDATA']['id'] ? $user->getUserData($_SESSION['USERDATA']['id']) : array(), 'slogan' => $settings->getValue('slogan'), 'websitename' => $settings->getValue('websitename'), 'ltc_usd' => $settings->getValue('btcesell'), - 'hashrate' => $settings->getValue('currenthashrate'), - 'workers' => $worker->getCountAllActiveWorkers(), - 'currentroundshares' => $settings->getValue('currentroundshares'), + 'hashrate' => $iCurrentPoolHashrate, + 'workers' => $iCurrentActiveWorkers, + 'currentroundshares' => $iRoundShares, 'statstime' => $settings->getValue('statstime'), 'motd' => $settings->getValue('motd'), 'confirmations' => $config['confirmations']