diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index e0a3547ec5..647b719ae3 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1572,6 +1572,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 @@ -2502,6 +2514,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 80d635e610..c53fce7362 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'}])); }