Rolling release in progress... (Alert when minor release are available)
This commit is contained in:
parent
8b650c12c5
commit
c29cc92587
|
@ -230,9 +230,17 @@ config_check();
|
|||
//======================================================
|
||||
|
||||
|
||||
|
||||
$check_minor_release_available = false;
|
||||
$pandora_management = check_acl($config['id_user'], 0, "PM");
|
||||
|
||||
if (is_user_admin($config['id_user'])) {
|
||||
$check_minor_release_available = db_check_minor_relase_available ();
|
||||
|
||||
if ($check_minor_release_available) {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update', 'minor release/s available');
|
||||
}
|
||||
}
|
||||
|
||||
if ($config["alert_cnt"] > 0) {
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
||||
|
|
|
@ -56,7 +56,21 @@ $no_login_msg = "";
|
|||
// Don't change the format, it is parsed by applications
|
||||
switch($info) {
|
||||
case 'version':
|
||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version;
|
||||
if (!$config["minor_release_open"]) {
|
||||
$config["minor_release_open"] = 0;
|
||||
}
|
||||
if (enterprise_installed()) {
|
||||
if (!$config["minor_release_enterprise"]) {
|
||||
$config["minor_release_enterprise"] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["minor_release_enterprise"];
|
||||
}
|
||||
else {
|
||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["minor_release_open"];
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -1273,4 +1273,89 @@ function db_process_file ($path, $handle_error = true) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for minor release files.
|
||||
*
|
||||
* @return bool Return if minor release is available or not
|
||||
*/
|
||||
function db_check_minor_relase_available () {
|
||||
global $config;
|
||||
|
||||
$dir = $config["homedir"]."/extras/mr";
|
||||
|
||||
$have_ent_minor = false;
|
||||
$have_open_minor = false;
|
||||
|
||||
if (file_exists($dir) && is_dir($dir)) {
|
||||
if (is_readable($dir)) {
|
||||
$files = scandir($dir); // Get all the files from the directory ordered by asc
|
||||
if ($files !== false) {
|
||||
// Enterprise installed
|
||||
if (enterprise_installed()) {
|
||||
$pattern = "/^\d+\.open.sql$/";
|
||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
||||
$pattern = "/\.open.sql$/";
|
||||
$replacement = "";
|
||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
|
||||
|
||||
$sqlfiles = null;
|
||||
|
||||
if ($sqlfiles_num) {
|
||||
foreach ($sqlfiles_num as $sqlfile_num) {
|
||||
$file = "$dir/$sqlfile_num.sql";
|
||||
if ($config["minor_release_open"] < $sqlfile_num) {
|
||||
$have_open_minor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pattern2 = "/^\d+\.ent.sql$/";
|
||||
$sqlfiles2 = preg_grep($pattern2, $files); // Get the name of the correct files
|
||||
$files = null;
|
||||
$pattern2 = "/\.ent.sql$/";
|
||||
$replacement2 = "";
|
||||
$sqlfiles_num2 = preg_replace($pattern2, $replacement2, $sqlfiles2); // Get the number of the file
|
||||
|
||||
$sqlfiles2 = null;
|
||||
|
||||
if ($sqlfiles_num2) {
|
||||
foreach ($sqlfiles_num2 as $sqlfile_num2) {
|
||||
$file = "$dir/$sqlfile_num2.sql";
|
||||
if ($config["minor_release_enterprise"] < $sqlfile_num2) {
|
||||
$have_ent_minor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$pattern = "/^\d+\.open.sql$/";
|
||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
||||
$files = null;
|
||||
$pattern = "/\.open.sql$/";
|
||||
$replacement = "";
|
||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
|
||||
|
||||
$sqlfiles = null;
|
||||
|
||||
if ($sqlfiles_num) {
|
||||
foreach ($sqlfiles_num as $sqlfile_num) {
|
||||
$file = "$dir/$sqlfile_num.sql";
|
||||
if ($config["minor_release"] < $sqlfile_num) {
|
||||
$have_open_minor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($have_open_minor || $have_ent_minor) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -108,7 +108,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||
('minor_release_open', 0);
|
||||
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
|
Loading…
Reference in New Issue