From dd798d6f52adb312dbf59c5821525aa256935df9 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 28 Mar 2022 15:09:21 +0200 Subject: [PATCH] UMC LTS --- pandora_console/godmode/um_client/index.php | 5 +- .../update_manager/update_manager.setup.php | 80 +++++++++++++------ 2 files changed, 58 insertions(+), 27 deletions(-) diff --git a/pandora_console/godmode/um_client/index.php b/pandora_console/godmode/um_client/index.php index ad92f67064..2452eace1d 100644 --- a/pandora_console/godmode/um_client/index.php +++ b/pandora_console/godmode/um_client/index.php @@ -390,12 +390,13 @@ $ui = new Manager( ui_get_full_url('ajax.php'), 'godmode/um_client/index', [ + 'lts' => (bool) $config['lts_updates'], 'url' => $url_update_manager, 'insecure' => $insecure, 'license' => $license, 'limit_count' => ((is_array($license_data) === true) ? $license_data['count_enabled'] : null), - 'language' => ((is_array($config) === true) ? $config['language'] : null), - 'timezone' => ((is_array($config) === true) ? $config['timezone'] : null), + 'language' => $config['language'], + 'timezone' => $config['timezone'], 'homedir' => $homedir, 'dbconnection' => $dbconnection, 'historydb' => $dbhHistory, diff --git a/pandora_console/godmode/update_manager/update_manager.setup.php b/pandora_console/godmode/update_manager/update_manager.setup.php index d203ce6db8..e282028f9f 100644 --- a/pandora_console/godmode/update_manager/update_manager.setup.php +++ b/pandora_console/godmode/update_manager/update_manager.setup.php @@ -97,6 +97,10 @@ if (!$action_update_url_update_manager) { 'allow_offline_patches', $config['allow_offline_patches'] ); + $lts_updates = get_parameter_switch( + 'lts_updates', + $config['lts_updates'] + ); if ($action_update_url_update_manager) { $result = config_update_value( @@ -145,6 +149,13 @@ if (!$action_update_url_update_manager) { ); } + if ($result) { + $result = config_update_value( + 'lts_updates', + $lts_updates + ); + } + if ($result && license_free()) { $result = config_update_value( 'identification_reminder', @@ -166,6 +177,7 @@ if (!$action_update_url_update_manager) { $update_manager_proxy_user = get_parameter('update_manager_proxy_user', ''); $update_manager_proxy_password = get_parameter('update_manager_proxy_password', ''); $allow_offline_patches = get_parameter_switch('allow_offline_patches', false); + $lts_updates = get_parameter_switch('lts_updates', false); if ($action_update_url_update_manager) { @@ -215,6 +227,13 @@ if (!$action_update_url_update_manager) { ); } + if ($result) { + $result = config_update_value( + 'lts_updates', + $lts_updates + ); + } + if ($result && license_free()) { $result = config_update_value('identification_reminder', $identification_reminder); } @@ -244,12 +263,13 @@ $table = new stdClass(); $table->width = '100%'; $table->class = 'databox filters'; -$table->style[0] = 'font-weight: bolder;width:250px'; +$i = 0; +$table->style[$i] = 'font-weight: bolder;width:250px'; $url_update_manager = update_manager_get_url(); -$table->data[0][0] = __('URL update manager:'); -$table->data[0][1] = html_print_input_text( +$table->data[$i][0] = __('URL update manager:'); +$table->data[$i++][1] = html_print_input_text( 'url_update_manager', $url_update_manager, __('URL update manager'), @@ -258,8 +278,8 @@ $table->data[0][1] = html_print_input_text( true ); -$table->data[1][0] = __('Use secured update manager:'); -$table->data[1][1] = html_print_input( +$table->data[$i][0] = __('Use secured update manager:'); +$table->data[$i++][1] = html_print_input( [ 'type' => 'switch', 'name' => 'secure_update_manager', @@ -267,8 +287,8 @@ $table->data[1][1] = html_print_input( ] ); -$table->data[2][0] = __('Proxy server:'); -$table->data[2][1] = html_print_input_text( +$table->data[$i][0] = __('Proxy server:'); +$table->data[$i++][1] = html_print_input_text( 'update_manager_proxy_server', $update_manager_proxy_server, __('Proxy server'), @@ -277,8 +297,8 @@ $table->data[2][1] = html_print_input_text( true ); -$table->data[3][0] = __('Proxy port:'); -$table->data[3][1] = html_print_input_text( +$table->data[$i][0] = __('Proxy port:'); +$table->data[$i++][1] = html_print_input_text( 'update_manager_proxy_port', $update_manager_proxy_port, __('Proxy port'), @@ -287,8 +307,8 @@ $table->data[3][1] = html_print_input_text( true ); -$table->data[4][0] = __('Proxy user:'); -$table->data[4][1] = html_print_input_text( +$table->data[$i][0] = __('Proxy user:'); +$table->data[$i++][1] = html_print_input_text( 'update_manager_proxy_user', $update_manager_proxy_user, __('Proxy user'), @@ -297,8 +317,8 @@ $table->data[4][1] = html_print_input_text( true ); -$table->data[5][0] = __('Proxy password:'); -$table->data[5][1] = html_print_input_password( +$table->data[$i][0] = __('Proxy password:'); +$table->data[$i++][1] = html_print_input_password( 'update_manager_proxy_password', $update_manager_proxy_password, __('Proxy password'), @@ -307,8 +327,8 @@ $table->data[5][1] = html_print_input_password( true ); -$table->data[6][0] = __('Allow no-consecutive patches:'); -$table->data[6][1] = html_print_switch( +$table->data[$i][0] = __('Allow no-consecutive patches:'); +$table->data[$i++][1] = html_print_switch( [ 'name' => 'allow_offline_patches', 'value' => $allow_offline_patches, @@ -316,30 +336,40 @@ $table->data[6][1] = html_print_switch( ] ); -$table->data[7][0] = __('Registration ID:'); -$table->data[7][1] = ''.$config['pandora_uid'].''; +$table->data[$i][0] = __('Limit to LTS updates:'); +$table->data[$i++][1] = html_print_switch( + [ + 'name' => 'lts_updates', + 'value' => $lts_updates, + 'return' => true, + ] +); + + +$table->data[$i][0] = __('Registration ID:'); +$table->data[$i++][1] = ''.$config['pandora_uid'].''; if (update_manager_verify_registration() === true && users_is_admin()) { - $table->data[8][0] = __('Cancel registration:'); - $table->data[8][1] = 'data[8][1] .= ui_get_full_url( + $table->data[$i][1] .= ui_get_full_url( 'index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=update_manager_setup&um_disconnect_console=1' ); } else { - $table->data[8][1] .= ui_get_full_url( + $table->data[$i][1] .= ui_get_full_url( 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup&um_disconnect_console=1' ); } - $table->data[8][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').''; + $table->data[$i++][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').''; } if (license_free()) { $config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1; - $table->data[9][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true); - $table->data[9][1] = __('Yes').'   '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'  '; - $table->data[9][1] .= __('No').'   '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true); + $table->data[$i][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true); + $table->data[$i][1] = __('Yes').'   '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'  '; + $table->data[$i++][1] .= __('No').'   '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true); } html_print_input_hidden('action_update_url_update_manager', 1);