diff --git a/public/include/classes/bitcoinwrapper.class.php b/public/include/classes/bitcoinwrapper.class.php index 7231c252..9f2ad861 100644 --- a/public/include/classes/bitcoinwrapper.class.php +++ b/public/include/classes/bitcoinwrapper.class.php @@ -5,12 +5,13 @@ if (!defined('SECURITY')) die('Hacking attempt'); class BitcoinWrapper extends BitcoinClient { - var $type, $username, $password, $host, $memcache; - public function __construct($type, $username, $password, $host, $memcache) { + public function __construct($type, $username, $password, $host, $debug, $memcache) { $this->type = $type; $this->username = $username; $this->password = $password; $this->host = $host; + // $this->debug is already used + $this->oDebug = $debug; $this->memcache = $memcache; return parent::__construct($this->type, $this->username, $this->password, $this->host); } @@ -18,14 +19,17 @@ class BitcoinWrapper extends BitcoinClient { * Wrap variouns methods to add caching **/ public function getblockcount() { + $this->oDebug->append("STA " . __METHOD__, 4); if ($data = $this->memcache->get(__FUNCTION__)) return $data; return $this->memcache->setCache(__FUNCTION__, parent::getblockcount()); } public function getdifficulty() { + $this->oDebug->append("STA " . __METHOD__, 4); if ($data = $this->memcache->get(__FUNCTION__)) return $data; return $this->memcache->setCache(__FUNCTION__, parent::getdifficulty()); } public function getestimatedtime($iCurrentPoolHashrate) { + $this->oDebug->append("STA " . __METHOD__, 4); if ($iCurrentPoolHashrate == 0) return 0; if ($data = $this->memcache->get(__FUNCTION__)) return $data; $dDifficulty = parent::getdifficulty(); @@ -34,4 +38,4 @@ class BitcoinWrapper extends BitcoinClient { } // Load this wrapper -$bitcoin = new BitcoinWrapper($config['wallet']['type'], $config['wallet']['username'], $config['wallet']['password'], $config['wallet']['host'], $memcache); +$bitcoin = new BitcoinWrapper($config['wallet']['type'], $config['wallet']['username'], $config['wallet']['password'], $config['wallet']['host'], $debug, $memcache); diff --git a/public/include/pages/statistics/pool.inc.php b/public/include/pages/statistics/pool.inc.php index 238b00b5..a256d2cf 100644 --- a/public/include/pages/statistics/pool.inc.php +++ b/public/include/pages/statistics/pool.inc.php @@ -6,14 +6,8 @@ if (!defined('SECURITY')) // Fetch data from litecoind if ($bitcoin->can_connect() === true){ - if (!$dDifficulty = $memcache->get('dDifficulty')) { - $dDifficulty = $bitcoin->query('getdifficulty'); - $memcache->set('dDifficulty', $dDifficulty); - } - if (!$iBlock = $memcache->get('iBlock')) { - $iBlock = $bitcoin->query('getblockcount'); - $memcache->set('iBlock', $iBlock); - } + $dDifficulty = $bitcoin->getdifficulty(); + $iBlock = $bitcoin->getblockcount(); } else { $iDifficulty = 1; $iBlock = 0; @@ -24,7 +18,7 @@ if ($bitcoin->can_connect() === true){ $aContributorsShares = $statistics->getTopContributors('shares', 15); // Top hash contributors - $aContributorsHashes = $statistics->getTopContributors('hashes', 15); +$aContributorsHashes = $statistics->getTopContributors('hashes', 15); // Grab the last 10 blocks found $iLimit = 10; diff --git a/public/include/pages/statistics/user.inc.php b/public/include/pages/statistics/user.inc.php index 41316beb..3a344c70 100644 --- a/public/include/pages/statistics/user.inc.php +++ b/public/include/pages/statistics/user.inc.php @@ -6,14 +6,8 @@ if (!defined('SECURITY')) // Fetch data from litecoind if ($bitcoin->can_connect() === true){ - if (!$dDifficulty = $memcache->get('dDifficulty')) { - $dDifficulty = $bitcoin->query('getdifficulty'); - $memcache->set('dDifficulty', $dDifficulty); - } - if (!$iBlock = $memcache->get('iBlock')) { - $iBlock = $bitcoin->query('getblockcount'); - $memcache->set('iBlock', $iBlock); - } + $dDifficulty = $bitcoin->getdifficulty(); + $iBlock = $bitcoin->getblockcount(); } else { $iDifficulty = 1; $iBlock = 0;