From 07232d82d18b456cd1bcc51a8266292549344b4f Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 11 Oct 2022 13:26:25 +0200 Subject: [PATCH 1/4] fix several problems in history db settings --- pandora_console/include/functions_config.php | 7 ++++--- pandora_console/include/lib/Core/Config.php | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 647b719ae3..a4aa1f45de 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1577,9 +1577,10 @@ function config_update_config() } $history_db_string_days = get_parameter('history_db_string_days'); - if (is_numeric($history_db_string_days) === false + if ((is_numeric($history_db_string_days) === false || $history_db_string_days <= 0 - || config_update_value('history_db_string_days', $history_db_string_days) === false + || config_update_value('history_db_string_days', $history_db_string_days) === false) + && get_parameter_switch('history_db_adv', 0) === 1 ) { $error_update[] = __('String Days'); } @@ -1843,7 +1844,7 @@ function config_update_config() $config['error_config_update_config']['correct'] = false; $values = implode('
-', $error_update); $config['error_config_update_config']['message'] = sprintf( - __('Failed updated: the next values cannot update:
-%s'), + __('Update failed. The next values could not be updated:
-%s'), $values ); diff --git a/pandora_console/include/lib/Core/Config.php b/pandora_console/include/lib/Core/Config.php index dbed566598..00875fd077 100644 --- a/pandora_console/include/lib/Core/Config.php +++ b/pandora_console/include/lib/Core/Config.php @@ -90,7 +90,9 @@ final class Config } ob_get_clean(); + } + if (empty($settings) === true) { if ($config['history_db_connection'] !== false) { $data = \db_get_all_rows_sql( 'SELECT * FROM `tconfig`', From b218cd0d15b739569684cdf48dab00c687f86628 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 11 Oct 2022 13:32:29 +0200 Subject: [PATCH 2/4] fix several problems in history db settings --- pandora_console/include/lib/Core/Config.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Core/Config.php b/pandora_console/include/lib/Core/Config.php index 00875fd077..6c12b85e0c 100644 --- a/pandora_console/include/lib/Core/Config.php +++ b/pandora_console/include/lib/Core/Config.php @@ -93,7 +93,9 @@ final class Config } if (empty($settings) === true) { - if ($config['history_db_connection'] !== false) { + if (isset($config['history_db_connection']) === true + && $config['history_db_connection'] !== false + ) { $data = \db_get_all_rows_sql( 'SELECT * FROM `tconfig`', false, From ac7f8419a61ee0092fa81033d336dcae84a7bb1a Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 11 Oct 2022 13:39:47 +0200 Subject: [PATCH 3/4] fix several problems in history db settings --- pandora_console/include/lib/Core/Config.php | 44 ++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/pandora_console/include/lib/Core/Config.php b/pandora_console/include/lib/Core/Config.php index 6c12b85e0c..43d1ff7cc1 100644 --- a/pandora_console/include/lib/Core/Config.php +++ b/pandora_console/include/lib/Core/Config.php @@ -92,31 +92,29 @@ final class Config ob_get_clean(); } - if (empty($settings) === true) { - if (isset($config['history_db_connection']) === true - && $config['history_db_connection'] !== false - ) { - $data = \db_get_all_rows_sql( - 'SELECT * FROM `tconfig`', - false, - false, - $config['history_db_connection'] - ); - } - - if (is_array($data) !== true) { - return []; - } - - self::$settings = array_reduce( - $data, - function ($carry, $item) { - $carry[$item['token']] = $item['value']; - return $carry; - }, - [] + if (isset($config['history_db_connection']) === true + && $config['history_db_connection'] !== false + ) { + $data = \db_get_all_rows_sql( + 'SELECT * FROM `tconfig`', + false, + false, + $config['history_db_connection'] ); } + + if (is_array($data) !== true) { + return []; + } + + self::$settings = array_reduce( + $data, + function ($carry, $item) { + $carry[$item['token']] = $item['value']; + return $carry; + }, + [] + ); } From 17a87392e3588878e1e5202926d7de2e1a576cb4 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Wed, 19 Oct 2022 18:38:27 +0200 Subject: [PATCH 4/4] minor fix --- pandora_console/include/lib/Core/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Core/Config.php b/pandora_console/include/lib/Core/Config.php index 43d1ff7cc1..656d68f9f2 100644 --- a/pandora_console/include/lib/Core/Config.php +++ b/pandora_console/include/lib/Core/Config.php @@ -69,7 +69,7 @@ final class Config $link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2); $rc = mysqli_real_connect( $link, - $$config['history_db_host'], + $config['history_db_host'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_name'],