WIP Historical database manager (setup)

This commit is contained in:
fbsanchez 2021-01-27 13:03:57 +01:00
parent c7706a6bfa
commit bcb2447edb
1 changed files with 9 additions and 39 deletions

View File

@ -29,7 +29,10 @@
// Load global vars.
global $config;
require_once 'include/config.php';
require_once $config['homedir'].'/include/config.php';
require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Core\Config;
check_login();
@ -388,44 +391,11 @@ if ($config['history_db_enabled'] == 1) {
);
}
$config_history = false;
if ($config['history_db_connection']) {
$history_connect = mysql_db_process_sql(
'DESCRIBE tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
if ($history_connect !== false) {
$config_history_array = mysql_db_process_sql(
'SELECT * FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
if (isset($config_history_array) && is_array($config_history_array)) {
foreach ($config_history_array as $key => $value) {
$config_history[$value['token']] = $value['value'];
$config_history = true;
}
}
} else {
echo ui_print_error_message(
__('The tconfig table does not exist in the historical database')
);
}
}
if ($config_history === false) {
$config_history = [];
$config_history['days_purge'] = 180;
$config_history['days_compact'] = 120;
$config_history['step_compact'] = 1;
$config_history['event_purge'] = 180;
$config_history['string_purge'] = 180;
}
$config_history['days_purge'] = Config::get('days_purge', 180, true);
$config_history['days_compact'] = Config::get('days_compact', 120, true);
$config_history['step_compact'] = Config::get('step_compact', 1, true);
$config_history['event_purge'] = Config::get('event_purge', 180, true);
$config_history['string_purge'] = Config::get('string_purge', 180, true);
$table_historical = new StdClass();
$table_historical->width = '100%';