fix several problems in history db settings

This commit is contained in:
alejandro.campos@artica.es 2022-10-11 13:39:47 +02:00
parent b218cd0d15
commit ac7f8419a6
1 changed files with 21 additions and 23 deletions

View File

@ -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;
},
[]
);
}