Merge branch 'ent-9631-14357-No-se-guardan-los-cambios-en-Setup-Setup-Performance' into 'develop'

fix several problems in history db settings

See merge request artica/pandorafms!5188
This commit is contained in:
Daniel Rodriguez 2022-10-20 07:21:11 +00:00
commit 6657052308
2 changed files with 27 additions and 24 deletions

View File

@ -1580,9 +1580,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');
}
@ -1846,7 +1847,7 @@ function config_update_config()
$config['error_config_update_config']['correct'] = false;
$values = implode('<br> -', $error_update);
$config['error_config_update_config']['message'] = sprintf(
__('Failed updated: the next values cannot update: <br> -%s'),
__('Update failed. The next values could not be updated: <br> -%s'),
$values
);

View File

@ -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'],
@ -90,29 +90,31 @@ final class Config
}
ob_get_clean();
}
if ($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;
},
[]
);
}