From 45c15acf8e39ec1afbee99d5ec775f48337cad3e Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 23 Aug 2023 14:46:55 +0200 Subject: [PATCH] 11930-Remove in pandora_db.pl integrity & functions_agents.php --- pandora_console/include/functions_agents.php | 45 -------------------- pandora_server/util/pandora_db.pl | 9 ---- 2 files changed, 54 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 3009671216..a199fa2b6b 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -2760,51 +2760,6 @@ function agents_delete_agent($id_agents, $disableACL=false) enterprise_include_once('include/functions_agents.php'); enterprise_hook('agent_delete_from_cache', [$id_agent]); - // Delete agent from visual console. - db_process_sql_delete( - 'tlayout_data', - ['id_agent' => $id_agent] - ); - - // Delete agent from treport. - db_process_sql_delete( - 'treport_content', - ['id_agent' => $id_agent] - ); - - // Delete rules from tevent alerts (correlative alerts) - db_process_sql_delete( - 'tevent_rule', - [ - 'agent' => $id_agent, - 'operator_agent' => '==', - ] - ); - - db_process_sql_delete( - 'tevent_rule', - [ - 'log_agent' => $id_agent, - 'operator_log_agent' => '==', - ] - ); - - // Delete from policies. - db_process_sql_delete( - 'tpolicy_agents', - ['id_agent' => $id_agent] - ); - - // Delete agent from fav menu. - db_process_sql_delete( - 'tfavmenu_user', - [ - 'id_element' => $id_agent, - 'section' => 'Agents', - 'id_user' => $config['id_user'], - ] - ); - // Break the loop on error. if ((bool) $error === true) { break; diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index ce476d7154..5567ab5227 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -767,15 +767,6 @@ sub pandora_checkdb_integrity { # Delete orphan data_inc reference records db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)'); - # Delete orphan data from visual console. - log_message ('INTEGRITY', "Deleting orphan visual console items."); - db_do ($dbh, 'DELETE FROM tlayout_data WHERE id_agent <> 0 AND id_agent NOT IN (SELECT id_agente FROM tagente)'); - db_do ($dbh, 'DELETE FROM tlayout_data WHERE id_agente_modulo <> 0 AND id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)'); - - # Delete orphan data from favorite agents - log_message ('INTEGRITY', "Deleting orphan favories items."); - db_do ($dbh, 'DELETE FROM tfavmenu_user WHERE section = "Agents" AND id_element NOT IN (SELECT id_agente FROM tagente)'); - # Check enterprise tables enterprise_hook ('pandora_checkdb_integrity_enterprise', [$conf, $dbh]); }