From 4da8f54f8482e0694c0d0007a6df2d4e1f4aa977 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 25 Feb 2019 11:29:39 +0100 Subject: [PATCH] Updated message warnings in Tasklist Former-commit-id: 9f8324e4f882e14451bda7034b1ff081c14a7a41 --- .../wizards/DiscoveryTaskList.class.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 8112ff3a19..934279ea47 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -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 .= '
* * * * * <user> 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 >> ';
+                    $message_conf_cron .= $config['homedir'].'/pandora_console.log
'; + } + + if (isset($config['cron_last_run']) === true + && $config['cron_last_run'] > 0 + ) { + $message_conf_cron .= '

'.__('Last execution').': '; + $message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']).'

'; + $message_conf_cron .= '

'; + $message_conf_cron .= __('Please check process is no locked.').'

'; + } + + ui_print_warning_message($message_conf_cron, '', false); + } + } + $ret = $this->showListConsoleTask(); $ret2 = $this->showList();