mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Added pandora db messages purgue
Former-commit-id: 23d1f55ac6b7d6d5470fa25860b9bbb1575875df
This commit is contained in:
parent
855822f61e
commit
0ecf2bb9c4
@ -82,6 +82,18 @@ if (enterprise_installed()) {
|
|||||||
$table->data[12][1] = html_print_input_text('inventory_purge', $config['inventory_purge'], '', 5, 5, true);
|
$table->data[12][1] = html_print_input_text('inventory_purge', $config['inventory_purge'], '', 5, 5, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table->data[] = [
|
||||||
|
__('Max. days before delete old messages'),
|
||||||
|
html_print_input_text(
|
||||||
|
'delete_old_messages',
|
||||||
|
$config['delete_old_messages'],
|
||||||
|
'',
|
||||||
|
5,
|
||||||
|
5,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
$table_other = new stdClass();
|
$table_other = new stdClass();
|
||||||
$table_other->width = '100%';
|
$table_other->width = '100%';
|
||||||
$table_other->class = 'databox filters';
|
$table_other->class = 'databox filters';
|
||||||
|
@ -748,6 +748,10 @@ function config_update_config()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('delete_old_messages', get_parameter('delete_old_messages'))) {
|
||||||
|
$error_update[] = __('Max. days before delete old messages');
|
||||||
|
}
|
||||||
|
|
||||||
if (!config_update_value('max_graph_container', get_parameter('max_graph_container'))) {
|
if (!config_update_value('max_graph_container', get_parameter('max_graph_container'))) {
|
||||||
$error_update[] = __('Graph container - Max. Items');
|
$error_update[] = __('Graph container - Max. Items');
|
||||||
}
|
}
|
||||||
@ -1535,6 +1539,10 @@ function config_process_config()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($config['delete_old_messages'])) {
|
||||||
|
config_update_value('delete_old_messages', 21);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($config['max_graph_container'])) {
|
if (!isset($config['max_graph_container'])) {
|
||||||
config_update_value('max_graph_container', 10);
|
config_update_value('max_graph_container', 10);
|
||||||
}
|
}
|
||||||
|
@ -437,6 +437,13 @@ sub pandora_purgedb ($$) {
|
|||||||
|
|
||||||
# Delete old tgraph_source data
|
# Delete old tgraph_source data
|
||||||
db_do ($dbh,"DELETE FROM tgraph_source WHERE id_graph NOT IN (SELECT id_graph FROM tgraph)");
|
db_do ($dbh,"DELETE FROM tgraph_source WHERE id_graph NOT IN (SELECT id_graph FROM tgraph)");
|
||||||
|
|
||||||
|
# Delete old messages
|
||||||
|
log_message ('PURGE', "Deleting old messages.");
|
||||||
|
if ($conf->{'_delete_old_messages'} > 0) {
|
||||||
|
my $message_limit = time() - 86400 * $conf->{'_delete_old_messages'};
|
||||||
|
db_do ($dbh, "DELETE FROM tmensajes WHERE timestamp < ?", $message_limit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -656,6 +663,7 @@ sub pandora_load_config_pdb ($) {
|
|||||||
$conf->{'_history_db_delay'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_delay'");
|
$conf->{'_history_db_delay'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'history_db_delay'");
|
||||||
$conf->{'_days_delete_unknown'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_delete_unknown'");
|
$conf->{'_days_delete_unknown'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'days_delete_unknown'");
|
||||||
$conf->{'_inventory_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'inventory_purge'");
|
$conf->{'_inventory_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'inventory_purge'");
|
||||||
|
$conf->{'_delete_old_messages'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_old_messages'");
|
||||||
$conf->{'_enterprise_installed'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'enterprise_installed'");
|
$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'} = 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->{'_metaconsole_events_history'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'metaconsole_events_history'");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user