2013-09-04 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/modificar_agente.php,
	include/functions_agents.php: fixed the delete agent when sometimes
	have remote config but not the enterprise.
	
	MERGED FROM THE BRANCH PANDORA_4




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8740 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-09-04 12:49:27 +00:00
parent 59054d4401
commit 1506127262
4 changed files with 38 additions and 25 deletions

View File

@ -1,3 +1,11 @@
2013-09-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/modificar_agente.php,
include/functions_agents.php: fixed the delete agent when sometimes
have remote config but not the enterprise.
MERGED FROM THE BRANCH PANDORA_4
2013-09-04 Ramon Novoa <rnovoa@artica.es> 2013-09-04 Ramon Novoa <rnovoa@artica.es>
* include/functions_events.php, * include/functions_events.php,

View File

@ -85,11 +85,13 @@ if ($agent_to_delete) {
ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.')); ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.'));
// Check if the remote config file still exist if (enterprise_installed()) {
if (isset ($config["remote_config"])) { // Check if the remote config file still exist
enterprise_include_once('include/functions_config_agents.php'); if (isset ($config["remote_config"])) {
if (enterprise_hook('config_agents_has_remote_configuration', $id_agente)) { enterprise_include_once('include/functions_config_agents.php');
ui_print_error_message(__('Maybe the files conf or md5 could not be deleted')); if (enterprise_hook('config_agents_has_remote_configuration', $id_agente)) {
ui_print_error_message(__('Maybe the files conf or md5 could not be deleted'));
}
} }
} }
} }

View File

@ -52,7 +52,8 @@ if (is_ajax ()) {
} }
if ($get_module_local_components) { if ($get_module_local_components) {
require_once ($config['homedir'].'/'.ENTERPRISE_DIR.'/include/functions_local_components.php'); require_once ($config['homedir'] . '/' . ENTERPRISE_DIR .
'/include/functions_local_components.php');
$id_module_group = (int) get_parameter ('id_module_component_group'); $id_module_group = (int) get_parameter ('id_module_component_group');
$localComponents = local_components_get_local_components( $localComponents = local_components_get_local_components(

View File

@ -1668,26 +1668,28 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
// db_process_delete_temp ("tagente_datos_inc", "id_agente_modulo", $where_modules); // db_process_delete_temp ("tagente_datos_inc", "id_agente_modulo", $where_modules);
// Delete remote configuration // Delete remote configuration
if (isset ($config["remote_config"])) { if (enterprise_installed()) {
enterprise_include_once('include/functions_config_agents.php'); if (isset ($config["remote_config"])) {
if (enterprise_hook('config_agents_has_remote_configuration', $id_agent)) { enterprise_include_once('include/functions_config_agents.php');
$agent_name = agents_get_name($id_agent); if (enterprise_hook('config_agents_has_remote_configuration', $id_agent)) {
$agent_name = io_safe_output($agent_name); $agent_name = agents_get_name($id_agent);
$agent_md5 = md5 ($agent_name, false); $agent_name = io_safe_output($agent_name);
$agent_md5 = md5 ($agent_name, false);
// Agent remote configuration editor // Agent remote configuration editor
$file_name = $config["remote_config"]."/conf/".$agent_md5.".conf"; $file_name = $config["remote_config"]."/conf/".$agent_md5.".conf";
$error = !@unlink ($file_name);
if (!$error) {
$file_name = $config["remote_config"]."/md5/".$agent_md5.".md5";
$error = !@unlink ($file_name); $error = !@unlink ($file_name);
}
if ($error) { if (!$error) {
db_pandora_audit( "Agent management", $file_name = $config["remote_config"]."/md5/".$agent_md5.".md5";
"Error: Deleted agent '$agent_name', the error is in the delete conf or md5."); $error = !@unlink ($file_name);
}
if ($error) {
db_pandora_audit( "Agent management",
"Error: Deleted agent '$agent_name', the error is in the delete conf or md5.");
}
} }
} }
} }