From 6a0bc8087b6db50d6625a186ee81e13d6a01e6d1 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 25 Oct 2013 10:15:50 +0000 Subject: [PATCH] 2013-10-25 Miguel de Dios * godmode/massive/massive_copy_modules.php, include/functions_modules.php: fixed the module massive copy from agent with remote configuration to agent without remote configuration and with a network module. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8957 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 ++++++ .../godmode/massive/massive_copy_modules.php | 10 +++++---- pandora_console/include/functions_modules.php | 22 +++++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 11bff9741a..1113702256 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2013-10-25 Miguel de Dios + + * godmode/massive/massive_copy_modules.php, + include/functions_modules.php: fixed the module massive copy from + agent with remote configuration to agent without remote + configuration and with a network module. + 2013-10-24 Sergio Martin * godmode/agentes/module_manager_editor_common.php: Store the diff --git a/pandora_console/godmode/massive/massive_copy_modules.php b/pandora_console/godmode/massive/massive_copy_modules.php index b1ce566e4c..5c9e3ebce7 100644 --- a/pandora_console/godmode/massive/massive_copy_modules.php +++ b/pandora_console/godmode/massive/massive_copy_modules.php @@ -39,14 +39,16 @@ $destiny_recursion = get_parameter ('destiny_recursion'); $do_operation = (bool) get_parameter ('do_operation'); if ($do_operation) { - $result = agents_process_manage_config ($source_id_agent, $destiny_id_agents); - + $result = agents_process_manage_config($source_id_agent, + $destiny_id_agents); if ($result) { - db_pandora_audit("Massive management", "Copy modules", false, false, + db_pandora_audit("Massive management", "Copy modules", false, + false, 'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents)); } else { - db_pandora_audit("Massive management", "Fail to try copy modules", false, false, + db_pandora_audit("Massive management", + "Fail to try copy modules", false, false, 'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents)); } } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 9448870ab1..35972b5e67 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -154,7 +154,8 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent unset ($new_module['id_agente_modulo']); unset ($new_module['id_agente']); - $id_new_module = modules_create_agent_module($id_destiny_agent, $new_module['nombre'], $new_module); + $id_new_module = modules_create_agent_module($id_destiny_agent, + $new_module['nombre'], $new_module); if ($id_new_module === false) { return false; @@ -164,7 +165,8 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent // If the module is synthetic we duplicate the operations too if ($module['id_modulo'] == 5) { - $synth_ops = db_get_all_rows_field_filter('tmodule_synth','id_agent_module_target',$module['id_agente_modulo']); + $synth_ops = db_get_all_rows_field_filter('tmodule_synth', + 'id_agent_module_target', $module['id_agente_modulo']); if ($synth_ops === false) { $synth_ops = array(); @@ -200,13 +202,15 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent $id_agente = modules_get_agentmodule_agent($id_agent_module); - if (enterprise_installed()) { - if (config_agents_has_remote_configuration($id_agente)) { - $result = enterprise_hook('config_agents_copy_agent_module_to_agent', - array($id_agent_module, $id_new_module)); - - if ($result === false) - return false; + if ($module['id_modulo'] == MODULE_DATA) { + if (enterprise_installed()) { + if (config_agents_has_remote_configuration($id_agente)) { + $result = enterprise_hook( + 'config_agents_copy_agent_module_to_agent', + array($id_agent_module, $id_new_module)); + if ($result === false) + return false; + } } }