connect(); $agent = new Agent((int) $array_id[1]); $success = $agent->delete(); $node->disconnect(); $success = agent_delete_from_metaconsole( $array_id[1], $array_id[0] ); } catch (\Exception $e) { // Unexistent agent. $success = false; $node->disconnect(); } } else { try { $agent = new Agent($id_agent); $success = $agent->delete(); } catch (\Exception $e) { // Unexistent agent. $success = false; } } if ($success === false) { $agent_id_restore = $id_agent; break; } $count_deleted++; } if ($success === false) { if (is_metaconsole() === true) { $array_id = explode('|', $agent_id_restore); $alias = agents_get_alias_metaconsole( $array_id[1], 'none', $array_id[0] ); } else { $alias = agents_get_alias($agent_id_restore); } ui_print_error_message( sprintf( __('There was an error deleting the agent, the operation has been cancelled Could not delete agent %s'), $alias ) ); return false; } else { ui_print_success_message( sprintf( __( 'Successfully deleted (%s)', $count_deleted ) ) ); return true; } } $id_group = (is_metaconsole() === true) ? get_parameter('id_group', '') : (int) get_parameter('id_group'); $id_agents = get_parameter('id_agents'); $recursion = get_parameter('recursion'); $delete = (bool) get_parameter_post('delete'); if ($delete === true) { $result = process_manage_delete($id_agents); if (empty($id_agents) === true) { $info = '{"Agent":"empty"}'; } else { $info = '{"Agent":"'.implode(',', $id_agents).'"}'; } if ($result === true) { db_pandora_audit( AUDIT_LOG_MASSIVE_MANAGEMENT, 'Delete agent ', false, false, $info ); } else { db_pandora_audit( AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail try to delete agent', false, false, $info ); } } $url = 'index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents'; if (is_metaconsole() === true) { $url = 'index.php?sec=advanced&sec2=advanced/massive_operations&tab=massive_agents&pure=0&option=delete_agents'; } echo '
'; echo '