11930-Remove in pandora_db.pl integrity & functions_agents.php
This commit is contained in:
parent
120298e6a3
commit
45c15acf8e
|
@ -2760,51 +2760,6 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
||||||
enterprise_include_once('include/functions_agents.php');
|
enterprise_include_once('include/functions_agents.php');
|
||||||
enterprise_hook('agent_delete_from_cache', [$id_agent]);
|
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.
|
// Break the loop on error.
|
||||||
if ((bool) $error === true) {
|
if ((bool) $error === true) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -767,15 +767,6 @@ sub pandora_checkdb_integrity {
|
||||||
# Delete orphan data_inc reference records
|
# 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)');
|
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
|
# Check enterprise tables
|
||||||
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$conf, $dbh]);
|
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$conf, $dbh]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue