[ADDED] User notifications for disabled crons

Fixes #1201 once merged
This commit is contained in:
Sebastian Grewe 2014-02-06 14:20:40 +01:00
parent c8fbc369cf
commit 8a050ba9af
4 changed files with 56 additions and 19 deletions

View File

@ -0,0 +1,17 @@
<?php
// Small helper array that may be used on some page controllers to
// fetch the crons we wish to monitor
$aMonitorCrons = array('statistics','payouts','token_cleanup','archive_cleanup','blockupdate','findblock','notifications','tickerupdate','liquid_payout');
switch ($config['payout_system']) {
case 'pplns':
$aMonitorCrons[] = $config['payout_system'] . '_payout';
break;
case 'pps':
$aMonitorCrons[] = $config['payout_system'] . '_payout';
break;
case 'prop':
$aMonitorCrons[] = 'proportional_payout';
break;
}

View File

@ -18,12 +18,13 @@ if ($bitcoin->can_connect() === true){
$version['CURRENT'] = array('DB' => DB_VERSION, 'CONFIG' => CONFIG_VERSION, 'CORE' => MPOS_VERSION);
$version['INSTALLED'] = array('DB' => $setting->getValue('DB_VERSION'), 'CONFIG' => $config['version'], 'CORE' => MPOS_VERSION);
// Fetch cron information
$aCrons = array('statistics','payouts','token_cleanup','archive_cleanup','blockupdate','findblock','notifications','tickerupdate');
// Fetch our cron list $aMonitorCrons
require_once(INCLUDE_DIR . '/config/monitor_crons.inc.php');
// Data array for template
$cron_errors = 0;
$cron_disabled = 0;
foreach ($aCrons as $strCron) {
foreach ($aMonitorCrons as $strCron) {
$status = $monitoring->getStatus($strCron . '_status');
if ($status['value'] != 0)
$cron_errors++;

View File

@ -7,24 +7,11 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
die("404 Page not found");
}
// Default crons to monitor
$aCrons = array('statistics','payouts','token_cleanup','archive_cleanup','blockupdate','findblock','notifications','tickerupdate','liquid_payout');
// Special cases, only add them if activated
switch ($config['payout_system']) {
case 'pplns':
$aCrons[] = $config['payout_system'] . '_payout';
break;
case 'pps':
$aCrons[] = $config['payout_system'] . '_payout';
break;
case 'prop':
$aCrons[] = 'proportional_payout';
break;
}
// Load our cron list $aMonitorCrons
require_once(INCLUDE_DIR . '/config/monitor_crons.inc.php');
// Data array for template
foreach ($aCrons as $strCron) {
foreach ($aMonitorCrons as $strCron) {
$aCronStatus[$strCron] = array(
'disabled' => $monitoring->getStatus($strCron . '_disabled'),
'exit' => $monitoring->getStatus($strCron . '_status'),

View File

@ -172,6 +172,38 @@ if ($motd = $setting->getValue('system_motd'))
// So we can display additional info
$smarty->assign('DEBUG', $config['DEBUG']);
// Lets check for our cron status and render a message
require_once(INCLUDE_DIR . '/config/monitor_crons.inc.php');
$bMessage = false;
$aCronMessage[] = 'We are investingating issues in the backend. Your shares and hashrate are safe and we will fix things ASAP.</br><br/>';
foreach ($aMonitorCrons as $strCron) {
if ($monitoring->isDisabled($strCron) == 1) {
$bMessage = true;
switch ($strCron) {
case 'payouts':
$aCronMessage[] = '<li> Payouts disabled, you will not receive any coins to your offline wallet for the time being</li>';
break;
case 'findblock':
$aCronMessage[] = '<li> Findblocks disabled, new blocks will currently not show up in the frontend</li>';
break;
case 'blockupdate':
$aCronMessage[] = '<li> Blockupdate disabled, blocks and transactions confirmations are delayed</li>';
break;
case 'pplns_payout':
$aCronMessage[] = '<li> PPLNS payout disabled, round credit transactions are delayed</li>';
break;
case 'prop_payout':
$aCronMessage[] = '<li> Proportional payout disabled, round credit transactions are delayed</li>';
break;
case 'pps_payout':
$aCronMessage[] = '<li> PPS payout disabled, share credit transactions are delayed</li>';
break;
}
}
}
if ($bMessage)
$_SESSION['POPUP'][] = array('CONTENT' => implode($aCronMessage, ''));
// Make it available in Smarty
$smarty->assign('PATH', 'site_assets/' . THEME);
$smarty->assign('GLOBALASSETS', 'site_assets/global');