From 4609e141eeabca23f9cc15a7874a7b63bde8fb13 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Fri, 30 Sep 2022 08:56:19 +0200 Subject: [PATCH] remove tmetaconsole_history token pandora_enterprise#9579 --- pandora_console/include/functions_config.php | 13 +------------ pandora_console/include/functions_events.php | 6 +++--- pandora_console/operation/events/events.php | 4 +++- pandora_server/util/pandora_db.pl | 1 - 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 647b719ae3..2d2e0eedde 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -784,14 +784,7 @@ function config_update_config() case 'perf': // PERFORMANCE SETUP. if (config_update_value('event_purge', get_parameter('event_purge'), true) === false) { - $check_metaconsole_events_history = get_parameter('metaconsole_events_history', -1); - $error_update[] = $check_metaconsole_events_history; - } - - if ($check_metaconsole_events_history != -1) { - if (config_update_value('metaconsole_events_history', get_parameter('metaconsole_events_history'), true) === false) { - $error_update[] = __('Max. days before delete events'); - } + $error_update[] = __('Event purge'); } if (config_update_value('trap_purge', get_parameter('trap_purge'), true) === false) { @@ -2107,10 +2100,6 @@ function config_process_config() config_update_value('event_purge', 15); } - if (!isset($config['metaconsole_events_history'])) { - config_update_value('metaconsole_events_history', 0); - } - if (!isset($config['realtimestats'])) { config_update_value('realtimestats', 1); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index b3aece13a3..9d1e957039 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1679,7 +1679,7 @@ function events_get_all( $result_meta = Promise\wait( parallelMap( $metaconsole_connections, - function ($node_int) use ($sql) { + function ($node_int) use ($sql, $history) { try { if (is_metaconsole() === true && (int) $node_int > 0 @@ -1688,7 +1688,7 @@ function events_get_all( $node->connect(); } - $res = db_get_all_rows_sql($sql); + $res = db_get_all_rows_sql($sql, $history); if ($res === false) { $res = []; } @@ -1819,7 +1819,7 @@ function events_get_all( } } - return db_get_all_rows_sql($sql); + return db_get_all_rows_sql($sql, $history); } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index b3d4b52377..a395307161 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1443,7 +1443,9 @@ if ($pure) { } // If the history event is not enabled, dont show the history tab. - if (isset($config['metaconsole_events_history']) === false || $config['metaconsole_events_history'] != 1) { + if (isset($config['history_db_enabled']) === false + || (bool) $config['history_db_enabled'] === false + ) { unset($onheader['history']); } diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 0c129f1188..81906cb414 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -660,7 +660,6 @@ sub pandora_load_config_pdb ($) { $conf->{'_delete_old_network_matrix'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_old_network_matrix'"); $conf->{'_enterprise_installed'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'enterprise_installed'"); $conf->{'_metaconsole'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole'"); - $conf->{'_metaconsole_events_history'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole_events_history'"); $conf->{'_netflow_max_lifetime'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_max_lifetime'"); $conf->{'_netflow_nfexpire'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_nfexpire'"); $conf->{'_netflow_path'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_path'");