Minor fixes and status check

Former-commit-id: 47a7e75579927c0ac109f303b77ebcc273334581
This commit is contained in:
fbsanchez 2019-02-19 11:13:07 +01:00
parent 906ba091e1
commit 85371424ee
3 changed files with 68 additions and 2 deletions

View File

@ -501,6 +501,7 @@ class ConsoleSupervisor
case 'NOTIF.UPDATEMANAGER.OPENSETUP':
case 'NOTIF.UPDATEMANAGER.UPDATE':
case 'NOTIF.UPDATEMANAGER.MINOR':
case 'NOTIF.CRON.CONFIGURED':
default:
// NOTIF.SERVER.STATUS.
// NOTIF.SERVER.STATUS.ID_SERVER.
@ -1379,7 +1380,10 @@ class ConsoleSupervisor
[
'type' => 'NOTIF.PANDORADB',
'title' => __('Database maintance problem'),
'message' => __('Your database is not maintained correctly. It seems that more than 48hrs have passed without proper maintenance. Please review documents of %s on how to perform this maintenance process (DB Tool) and enable it as soon as possible.', get_product_name()),
'message' => __(
'Your database is not maintained correctly. It seems that more than 48hrs have passed without proper maintenance. Please review documents of %s on how to perform this maintenance process (DB Tool) and enable it as soon as possible.',
io_safe_output(get_product_name())
),
'url' => ui_get_full_url(
'index.php?sec=general&sec2=godmode/setup/setup&section=perf'
),
@ -2081,4 +2085,54 @@ class ConsoleSupervisor
}
/**
* Check if CRON utility has been configured.
*
* @return void
*/
public function checkCronRunning()
{
global $config;
// 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 .= '<pre>* * * * * &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>';
}
if (isset($config['cron_last_run']) === true) {
$message_conf_cron .= __('Last execution').': ';
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']);
}
$this->notify(
[
'type' => 'NOTIF.CRON.CONFIGURED',
'title' => __('DiscoveryConsoleTasks is not configured.'),
'message' => __($message_conf_cron),
'url' => ui_get_full_url(
'index.php?extension_in_menu=gservers&sec=extensions&sec2=enterprise/extensions/cron'
),
]
);
} else {
$this->cleanNotifications('NOTIF.CRON.CONFIGURED');
}
}
}

View File

@ -2676,6 +2676,11 @@ function config_check()
if (license_free()) {
$supervisor = new ConsoleSupervisor(false);
$supervisor->run();
} else if ($config['cron_last_run'] == 0
|| (get_system_time() - $config['cron_last_run']) > 3600
) {
$supervisor = new ConsoleSupervisor(false);
$supervisor->checkCronRunning();
}
}

View File

@ -4305,6 +4305,7 @@ div#dialog_messages table th:last-child {
position: absolute;
width: 400px;
margin-top: -5px;
border-radius: 5px;
}
#notification-wrapper::before {
content: "";
@ -4338,12 +4339,15 @@ div#dialog_messages table th:last-child {
background: whitesmoke;
height: 100px;
margin: 7px;
border: #cccccc solid 1px;
border: #e4e4e4 solid 1px;
display: flex;
flex-flow: row nowrap;
align-items: center;
padding: 5px;
}
.notification-item:hover {
border: #ccc solid 1px;
}
.notification-item > * {
padding-left: 15px;
pointer-events: none;
@ -4357,6 +4361,9 @@ div#dialog_messages table th:last-child {
width: 87%;
display: flex;
flex-flow: column nowrap;
overflow: hidden;
max-height: 83px;
line-height: 1.4em;
}
.notification-item img {
max-width: 100%;