Merge branch 'ent-4679-notificacion-supervisor-server-no-actualizado' into 'develop'

Added notify when Console and Server have version mismatch

See merge request artica/pandorafms!2770
This commit is contained in:
Daniel Rodriguez 2019-10-07 15:59:16 +02:00
commit dc01b3e22e
1 changed files with 43 additions and 0 deletions

View File

@ -209,6 +209,12 @@ class ConsoleSupervisor
$this->getUMMessages();
/*
* Check if the Server and Console has
* the same versions.
*/
$this->checkConsoleServerVersions();
}
@ -435,6 +441,12 @@ class ConsoleSupervisor
$this->getUMMessages();
/*
* Check if the Server and Console has
* the same versions.
*/
$this->checkConsoleServerVersions();
}
@ -2334,4 +2346,35 @@ class ConsoleSupervisor
}
/**
* Check if all servers and console versions are the same
*
* @return void
*/
public function checkConsoleServerVersions()
{
global $config;
// List all servers except satellite server
$server_version_list = db_get_all_rows_sql(
'SELECT name, version FROM tserver WHERE server_type != '.SERVER_TYPE_ENTERPRISE_SATELLITE
);
foreach ($server_version_list as $server) {
if (strpos($server['version'], $config['current_package_enterprise']) === false) {
$title_ver_misaligned = $server['name'].' version misaligned with Console';
$message_ver_misaligned = 'Server '.$server['name'].' and this console have different versions. This might cause several malfunctions. Please, update this server.';
$this->notify(
[
'type' => 'NOTIF.SERVER.MISALIGNED',
'title' => __($title_ver_misaligned),
'message' => __($message_ver_misaligned),
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
]
);
}
}
}
}