Merge branch 'ent-6840-Errores-en-la-vista-de-Omnishell' into 'develop'
Ent 6840 errores en la vista de omnishell See merge request artica/pandorafms!3732
This commit is contained in:
commit
54fa645d00
|
@ -21,6 +21,8 @@ require_once $config['homedir'].'/include/functions.php';
|
||||||
require_once $config['homedir'].'/include/functions_modules.php';
|
require_once $config['homedir'].'/include/functions_modules.php';
|
||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\RCMDFile as RCMDFile;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the agent if exists in the DB.
|
* Return the agent if exists in the DB.
|
||||||
|
@ -2410,10 +2412,31 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
||||||
enterprise_include_once('include/functions_policies.php');
|
enterprise_include_once('include/functions_policies.php');
|
||||||
enterprise_hook('policies_delete_agent', [$id_agent]);
|
enterprise_hook('policies_delete_agent', [$id_agent]);
|
||||||
|
|
||||||
// Delete agent in networkmap enterprise
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
|
// Delete agent in networkmap.
|
||||||
enterprise_include_once('include/functions_networkmap.php');
|
enterprise_include_once('include/functions_networkmap.php');
|
||||||
networkmap_delete_nodes_by_agent([$id_agent]);
|
networkmap_delete_nodes_by_agent([$id_agent]);
|
||||||
|
|
||||||
|
// Delete command targets with agent.
|
||||||
|
enterprise_include_once('include/lib/RCMDFile.class.php');
|
||||||
|
|
||||||
|
$target_filter = ['id_agent' => $id_agent];
|
||||||
|
|
||||||
|
// Retrieve all commands that have targets with specific agent id.
|
||||||
|
$commands = RCMDFile::getAll(
|
||||||
|
['rct.rcmd_id'],
|
||||||
|
$target_filter
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($commands as $command) {
|
||||||
|
$rcmd_id = $command['rcmd_id'];
|
||||||
|
$rcmd = new RCMDFile($rcmd_id);
|
||||||
|
|
||||||
|
$command_targets = [];
|
||||||
|
|
||||||
|
$command_targets = $rcmd->getTargets(false, $target_filter);
|
||||||
|
$rcmd->deleteTargets(array_keys($command_targets));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tagente_datos_inc
|
// tagente_datos_inc
|
||||||
|
|
Loading…
Reference in New Issue