mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Changed name by alias when deleting agent
This commit is contained in:
parent
e6a8f6afa2
commit
42c7a400f0
@ -99,6 +99,7 @@ if ($agent_to_delete) {
|
|||||||
|
|
||||||
if ($enable_agent) {
|
if ($enable_agent) {
|
||||||
$result = db_process_sql_update('tagente', array('disabled' => 0), array('id_agente' => $enable_agent));
|
$result = db_process_sql_update('tagente', array('disabled' => 0), array('id_agente' => $enable_agent));
|
||||||
|
$alias = agents_get_alias($enable_agent);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Update the agent from the metaconsole cache
|
// Update the agent from the metaconsole cache
|
||||||
@ -106,10 +107,10 @@ if ($enable_agent) {
|
|||||||
$values = array('disabled' => 0);
|
$values = array('disabled' => 0);
|
||||||
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values));
|
enterprise_hook ('agent_update_from_cache', array($enable_agent, $values));
|
||||||
|
|
||||||
db_pandora_audit("Agent management", 'Enable ' . $enable_agent);
|
db_pandora_audit("Agent management", 'Enable ' . $alias);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("Agent management", 'Fail to enable ' . $enable_agent);
|
db_pandora_audit("Agent management", 'Fail to enable ' . $alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
@ -118,6 +119,7 @@ if ($enable_agent) {
|
|||||||
|
|
||||||
if ($disable_agent) {
|
if ($disable_agent) {
|
||||||
$result = db_process_sql_update('tagente', array('disabled' => 1), array('id_agente' => $disable_agent));
|
$result = db_process_sql_update('tagente', array('disabled' => 1), array('id_agente' => $disable_agent));
|
||||||
|
$alias = agents_get_alias($disable_agent);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Update the agent from the metaconsole cache
|
// Update the agent from the metaconsole cache
|
||||||
@ -125,10 +127,10 @@ if ($disable_agent) {
|
|||||||
$values = array('disabled' => 1);
|
$values = array('disabled' => 1);
|
||||||
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values));
|
enterprise_hook ('agent_update_from_cache', array($disable_agent, $values));
|
||||||
|
|
||||||
db_pandora_audit("Agent management", 'Disable ' . $disable_agent);
|
db_pandora_audit("Agent management", 'Disable ' . $alias);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("Agent management", 'Fail to disable ' . $disable_agent);
|
db_pandora_audit("Agent management", 'Fail to disable ' . $alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
|
@ -1836,6 +1836,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
$agent_name = agents_get_name($id_agent, "");
|
$agent_name = agents_get_name($id_agent, "");
|
||||||
|
$agent_alias = io_safe_output(agents_get_alias($id_agent));
|
||||||
|
|
||||||
/* Check for deletion permissions */
|
/* Check for deletion permissions */
|
||||||
$id_group = agents_get_agent_group ($id_agent);
|
$id_group = agents_get_agent_group ($id_agent);
|
||||||
@ -1943,6 +1944,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||||||
if (enterprise_hook('config_agents_has_remote_configuration', array($id_agent))) {
|
if (enterprise_hook('config_agents_has_remote_configuration', array($id_agent))) {
|
||||||
$agent_name = agents_get_name($id_agent);
|
$agent_name = agents_get_name($id_agent);
|
||||||
$agent_name = io_safe_output($agent_name);
|
$agent_name = io_safe_output($agent_name);
|
||||||
|
$agent_alias = io_safe_output(agents_get_alias($id_agent));
|
||||||
$agent_md5 = md5 ($agent_name, false);
|
$agent_md5 = md5 ($agent_name, false);
|
||||||
|
|
||||||
// Agent remote configuration editor
|
// Agent remote configuration editor
|
||||||
@ -1957,7 +1959,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
db_pandora_audit( "Agent management",
|
db_pandora_audit( "Agent management",
|
||||||
"Error: Deleted agent '$agent_name', the error is in the delete conf or md5.");
|
"Error: Deleted agent '$agent_alias', the error is in the delete conf or md5.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1969,7 +1971,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
|
|||||||
db_process_sql ("delete from ttag_module where id_agente_modulo in (select id_agente_modulo from tagente_modulo where id_agente = ".$id_agent.")");
|
db_process_sql ("delete from ttag_module where id_agente_modulo in (select id_agente_modulo from tagente_modulo where id_agente = ".$id_agent.")");
|
||||||
|
|
||||||
db_pandora_audit( "Agent management",
|
db_pandora_audit( "Agent management",
|
||||||
"Deleted agent '$agent_name'");
|
"Deleted agent '$agent_alias'");
|
||||||
|
|
||||||
// Delete the agent from the metaconsole cache
|
// Delete the agent from the metaconsole cache
|
||||||
enterprise_include_once('include/functions_agents.php');
|
enterprise_include_once('include/functions_agents.php');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user