From 30ffe64abce7d48697956fad9c72dd3433202c79 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 8 Sep 2022 14:28:36 +0200 Subject: [PATCH] Historic string data separated from normal data --- pandora_console/include/functions_config.php | 20 ++++++++++++++++++++ pandora_server/util/pandora_db.pl | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index fbe12e27f8..a18f178d6f 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1570,6 +1570,18 @@ function config_update_config() $error_update[] = __('Days'); } + if (config_update_value('history_db_adv', get_parameter_switch('history_db_adv', 0), true) === false) { + $error_update[] = __('Enable history database advanced'); + } + + $history_db_string_days = get_parameter('history_db_string_days'); + 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 + ) { + $error_update[] = __('String Days'); + } + $history_event_days = get_parameter('history_event_days'); if (is_numeric($history_event_days) === false || $history_event_days <= 0 @@ -2500,6 +2512,14 @@ function config_process_config() config_update_value('history_db_days', 0); } + if (!isset($config['history_db_adv'])) { + config_update_value('history_db_adv', false); + } + + if (!isset($config['history_db_string_days'])) { + config_update_value('history_db_string_days', 0); + } + if (!isset($config['history_event_days'])) { config_update_value('history_event_days', 90); } diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 2c498d6d0f..f863c75993 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -644,6 +644,8 @@ sub pandora_load_config_pdb ($) { $conf->{'_history_db_user'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_user'"); $conf->{'_history_db_pass'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_pass'"); $conf->{'_history_db_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_days'"); + $conf->{'_history_db_adv'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_adv'"); + $conf->{'_history_db_string_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_string_days'"); $conf->{'_history_event_days'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_event_days'"); $conf->{'_history_db_step'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_step'"); $conf->{'_history_db_delay'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_delay'"); @@ -1128,7 +1130,7 @@ sub pandoradb_main ($$$;$) { # Move old data to the history DB if (defined ($history_dbh)) { - undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); + undef ($history_dbh) unless defined (enterprise_hook ('pandora_historydb', [$dbh, $history_dbh, $conf->{'_history_db_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}, $conf->{'_history_db_string_days'}, $conf->{'_history_db_adv'}])); if (defined($conf{'_history_event_enabled'}) && $conf->{'_history_event_enabled'} ne "" && $conf->{'_history_event_enabled'} == 1) { undef ($history_dbh) unless defined (enterprise_hook ('pandora_history_event', [$dbh, $history_dbh, $conf->{'_history_event_days'}, $conf->{'_history_db_step'}, $conf->{'_history_db_delay'}])); }