Fixed errors in setup performances

Former-commit-id: 1eb48c00f527f43504a41aea8b352f30792e080b
This commit is contained in:
Daniel Barbero 2019-02-14 16:31:19 +01:00
parent 0fb61444f6
commit d9ba3af358

View File

@ -63,6 +63,15 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
$historical_event_purge = get_parameter('historical_event_purge', 0); $historical_event_purge = get_parameter('historical_event_purge', 0);
$historical_string_purge = get_parameter('historical_string_purge', 0); $historical_string_purge = get_parameter('historical_string_purge', 0);
$history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
$config_history = false;
if ($history_connect !== false) {
$config_history = mysql_db_process_sql( $config_history = mysql_db_process_sql(
'SELECT * FROM tconfig', 'SELECT * FROM tconfig',
'affected_rows', 'affected_rows',
@ -131,7 +140,7 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
} }
} }
} }
}
$table_status = new StdClass(); $table_status = new StdClass();
$table_status->width = '100%'; $table_status->width = '100%';
@ -147,6 +156,7 @@ $sql = "SELECT UNIX_TIMESTAMP(NOW()) - `value` AS updated_at
$time_pandora_db_active = db_get_sql($sql); $time_pandora_db_active = db_get_sql($sql);
if ($time_pandora_db_active < SECONDS_12HOURS) { if ($time_pandora_db_active < SECONDS_12HOURS) {
$table_status->data[0][0] = html_print_image( $table_status->data[0][0] = html_print_image(
'images/dot_green.png', 'images/dot_green.png',
@ -168,11 +178,6 @@ $table_status->data[0][0] .= human_time_description_raw(
$table_status->data[0][0] .= ' '.__('ago').'.'; $table_status->data[0][0] .= ' '.__('ago').'.';
$table_status->data[0][0] .= ui_print_help_tip(
__('WIP'),
true
);
if ($config['history_db_enabled'] == 1) { if ($config['history_db_enabled'] == 1) {
if (! isset($config['history_db_connection']) if (! isset($config['history_db_connection'])
|| $config['history_db_connection'] === false || $config['history_db_connection'] === false
@ -187,6 +192,15 @@ if ($config['history_db_enabled'] == 1) {
); );
} }
$history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
$time_pandora_db_history = false;
if ($history_connect !== false) {
if ($config['history_db_connection'] !== false) { if ($config['history_db_connection'] !== false) {
$time_pandora_db_history = mysql_db_process_sql( $time_pandora_db_history = mysql_db_process_sql(
$sql, $sql,
@ -195,6 +209,7 @@ if ($config['history_db_enabled'] == 1) {
false false
); );
} }
}
if ($time_pandora_db_history !== false if ($time_pandora_db_history !== false
&& $time_pandora_db_history[0]['updated_at'] < SECONDS_12HOURS && $time_pandora_db_history[0]['updated_at'] < SECONDS_12HOURS
@ -220,11 +235,6 @@ if ($config['history_db_enabled'] == 1) {
} else { } else {
$table_status->data[1][0] .= __('not executed'); $table_status->data[1][0] .= __('not executed');
} }
$table_status->data[1][0] .= ui_print_help_tip(
__('WIP'),
true
);
} }
@ -395,6 +405,15 @@ if ($config['history_db_enabled'] == 1) {
); );
} }
$history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
$config_history = false;
if ($history_connect !== false) {
if ($config['history_db_connection'] != 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',
@ -403,14 +422,17 @@ if ($config['history_db_enabled'] == 1) {
false false
); );
$config_history = false;
if (isset($config_history_array) && is_array($config_history_array)) { if (isset($config_history_array) && is_array($config_history_array)) {
foreach ($config_history_array as $key => $value) { foreach ($config_history_array as $key => $value) {
$config_history[$value['token']] = $value['value']; $config_history[$value['token']] = $value['value'];
} }
} }
} }
} else {
echo ui_print_error_message(
__('The tconfig table does not exist in the bbdd')
);
}
if ($config_history === false) { if ($config_history === false) {
$config_history = []; $config_history = [];