Updated message warnings in Tasklist

Former-commit-id: 9f8324e4f882e14451bda7034b1ff081c14a7a41
This commit is contained in:
fbsanchez 2019-02-25 11:29:39 +01:00
parent 13e49f92db
commit 4da8f54f84
1 changed files with 34 additions and 0 deletions

View File

@ -113,6 +113,40 @@ class DiscoveryTaskList extends Wizard
return $this->deleteTask();
}
if (enterprise_installed()) {
// This check only applies to enterprise users.
// Check if DiscoveryCronTasks is running. Warn user if not.
if ($config['cron_last_run'] == 0
|| (get_system_time() - $config['cron_last_run']) > 3600
) {
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly');
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
$message_conf_cron .= __('Discovery relies on a proper setup of cron, the time-based scheduling service');
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
$message_conf_cron .= '<b><pre style="color: #333;">* * * * * &lt;user&gt; wget -q -O - --no-check-certificate ';
$message_conf_cron .= str_replace(
ENTERPRISE_DIR.'/meta/',
'',
ui_get_full_url(false)
);
$message_conf_cron .= ENTERPRISE_DIR.'/'.EXTENSIONS_DIR;
$message_conf_cron .= '/cron/cron.php &gt;&gt; ';
$message_conf_cron .= $config['homedir'].'/pandora_console.log</pre></b>';
}
if (isset($config['cron_last_run']) === true
&& $config['cron_last_run'] > 0
) {
$message_conf_cron .= '<p style="color: #333;">'.__('Last execution').': ';
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']).'</p>';
$message_conf_cron .= '<p style="color: #333;">';
$message_conf_cron .= __('Please check process is no locked.').'</p>';
}
ui_print_warning_message($message_conf_cron, '', false);
}
}
$ret = $this->showListConsoleTask();
$ret2 = $this->showList();