This commit is contained in:
Sebastian Grewe 2013-11-11 14:42:11 +01:00
commit 33958919c6
8 changed files with 22 additions and 9 deletions

View File

@ -40,6 +40,12 @@ if (empty($aAllBlocks)) {
$count = 0;
foreach ($aAllBlocks as $iIndex => $aBlock) {
// If we have unaccounted blocks without share_ids, they might not have been inserted yet
if (!$aBlock['share_id']) {
$log->logError('E0062: Block has no share_id, not running payouts');
$monitoring->endCronjob($cron_name, 'E0062', 0, true);
}
// We support some dynamic share targets but fall back to our fixed value
// Re-calculate after each run due to re-targets in this loop
if ($config['pplns']['shares']['type'] == 'blockavg' && $block->getBlockCount() > 0) {
@ -50,6 +56,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$pplns_target = $config['pplns']['shares']['default'];
}
// Fetch our last paid block information
if ($iLastBlockId = $setting->getValue('last_accounted_block_id')) {
$aLastAccountedBlock = $block->getBlockById($iLastBlockId);
} else {

View File

@ -42,6 +42,13 @@ $count = 0;
// Table header for account shares
$log->logInfo("ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tDonation\tFee");
foreach ($aAllBlocks as $iIndex => $aBlock) {
// If we have unaccounted blocks without share_ids, they might not have been inserted yet
if (!$aBlock['share_id']) {
$log->logError('E0062: Block has no share_id, not running payouts');
$monitoring->endCronjob($cron_name, 'E0062', 0, true);
}
// Fetch last paid block information
if ($iLastBlockId = $setting->getValue('last_accounted_block_id')) {
$aLastAccountedBlock = $block->getBlockById($iLastBlockId);
} else {

View File

@ -30,9 +30,7 @@ class Statistics extends Base {
$this->debug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
$stmt = $this->mysqli->prepare("
SELECT
time FROM " . $this->block->getTableName() . "
ORDER BY id ASC LIMIT 1");
SELECT IFNULL(MIN(time), 0) AS time FROM " . $this->block->getTableName());
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_object()->time;
return false;

View File

@ -65,4 +65,5 @@ $aErrorCodes['E0058'] = 'Worker name and/or password must not be empty';
$aErrorCodes['E0059'] = 'Worker already exists';
$aErrorCodes['E0060'] = 'Failed to add new worker';
$aErrorCodes['E0061'] = 'Failed to delete worker';
$aErrorCodes['E0062'] = 'Block has no share_id, not running payouts';
?>

View File

@ -5,7 +5,7 @@ if (!defined('SECURITY')) die('Hacking attempt');
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$debug->append('No cached version available, fetching from backend', 3);
if ($setting->getValue('monitoring_uptimerobot_private_key')) {
if ($setting->getValue('monitoring_uptimerobot_api_keys')) {
if ($aStatus = $monitoring->getUptimeRobotStatus()) {
$smarty->assign("STATUS", $aStatus);
$smarty->assign("UPDATED", $setting->getValue('monitoring_uptimerobot_lastcheck'));

View File

@ -69,7 +69,7 @@ $aGlobal = array(
'accounts' => $config['accounts'],
'disable_invitations' => $setting->getValue('disable_invitations'),
'disable_notifications' => $setting->getValue('disable_notifications'),
'monitoring_uptimerobot_private_key' => $setting->getValue('monitoring_uptimerobot_private_key'),
'monitoring_uptimerobot_api_keys' => $setting->getValue('monitoring_uptimerobot_api_keys'),
'statistics_ajax_refresh_interval' => $statistics_ajax_refresh_interval,
'price' => array( 'currency' => $config['price']['currency'] ),
'targetdiff' => $config['difficulty'],

View File

@ -33,7 +33,7 @@
<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=blocks">Block Stats</a></li>
<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=graphs">Hashrate Graphs</a></li>
<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=round">Round Stats</a></li>
{if $GLOBAL.config.monitoring_uptimerobot_private_key|default:"0"}<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime Stats</a></li>{/if}
{if $GLOBAL.config.monitoring_uptimerobot_api_keys|default:"0"}<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime Stats</a></li>{/if}
</ul>
</li>
{else}
@ -49,7 +49,7 @@
<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=round">Round Stats</a></li>
{/if}
{if $GLOBAL.acl.uptime.statistics}
{if $GLOBAL.config.monitoring_uptimerobot_private_key|default:"0"}<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime Stats</a></li>{/if}
{if $GLOBAL.config.monitoring_uptimerobot_api_keys|default:"0"}<li><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime Stats</a></li>{/if}
{/if}
</ul>
{/if}

View File

@ -33,7 +33,7 @@
<li class="icon-th-large"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=blocks">Blocks</a></li>
<li class="icon-chart"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=graphs">Graphs</a></li>
<li class="icon-record"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=round">Round</a></li>
{if $GLOBAL.config.monitoring_uptimerobot_private_key|default:"0"}<li class="icon-bell"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime</a></li>{/if}
{if $GLOBAL.config.monitoring_uptimerobot_api_keys|default:"0"}<li class="icon-bell"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime</a></li>{/if}
</ul>
{else}
<h3>Statistics</h3>
@ -50,7 +50,7 @@
<li class="icon-chart"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=round">Round</a></li>
{/if}
{if $GLOBAL.acl.uptime.statistics}
{if $GLOBAL.config.monitoring_uptimerobot_private_key|default:"0"}<li class="icon-bell"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime</a></li>{/if}
{if $GLOBAL.config.monitoring_uptimerobot_api_keys|default:"0"}<li class="icon-bell"><a href="{$smarty.server.PHP_SELF}?page=statistics&action=uptime">Uptime</a></li>{/if}
{/if}
</ul>
{/if}