Fixed bug connection ok when db connection returns null

Former-commit-id: d2d6ea104bea4a0d0b4ffb2c64818428ee6ad703
This commit is contained in:
Luis Calvo 2019-04-22 12:00:06 +02:00
parent ea7a8b2b90
commit fa0da4504e

View File

@ -200,8 +200,8 @@ if ($config['history_db_enabled'] == 1) {
); );
$time_pandora_db_history = false; $time_pandora_db_history = false;
if ($history_connect !== false) { if ($history_connect) {
if ($config['history_db_connection'] !== false) { if ($config['history_db_connection']) {
$time_pandora_db_history = mysql_db_process_sql( $time_pandora_db_history = mysql_db_process_sql(
$sql, $sql,
'insert_id', 'insert_id',
@ -405,6 +405,8 @@ if ($config['history_db_enabled'] == 1) {
); );
} }
$config_history = false;
if ($config['history_db_connection']) {
$history_connect = @mysql_db_process_sql( $history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig', 'SELECT 1 FROM tconfig',
'affected_rows', 'affected_rows',
@ -412,9 +414,7 @@ if ($config['history_db_enabled'] == 1) {
false false
); );
$config_history = false;
if ($history_connect !== false) { if ($history_connect !== false) {
if ($config['history_db_connection'] != false) {
$config_history_array = mysql_db_process_sql( $config_history_array = mysql_db_process_sql(
'SELECT * FROM tconfig', 'SELECT * FROM tconfig',
'affected_rows', 'affected_rows',
@ -427,12 +427,12 @@ if ($config['history_db_enabled'] == 1) {
$config_history[$value['token']] = $value['value']; $config_history[$value['token']] = $value['value'];
} }
} }
}
} else { } else {
echo ui_print_error_message( echo ui_print_error_message(
__('The tconfig table does not exist in the historical database') __('The tconfig table does not exist in the historical database')
); );
} }
}
if ($config_history === false) { if ($config_history === false) {
$config_history = []; $config_history = [];