Merge branch 'ent-7156-eliminar-agente-desde-meta-no-borra-ficheros' into 'develop'

Added comments header and improve code

Closes pandora_enterprise#7156

See merge request artica/pandorafms!3986
This commit is contained in:
Daniel Rodriguez 2021-05-13 11:14:44 +00:00
commit 3a76d6e680
1 changed files with 30 additions and 13 deletions

View File

@ -1,16 +1,33 @@
<?php
// Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* Functions for API.
*
* @category Functions.
* @package Pandora FMS
* @subpackage API.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
// Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
@ -2300,13 +2317,13 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
if ($other['data'][0] === '1') {
if ($agent_by_alias) {
$idAgent = agents_get_agent_id_by_alias($id);
} else {
$idAgent[0] = agents_get_agent_id($id, true);
}
if (!empty($idAgent)) {
if (empty($idAgent) === false) {
$result = agents_delete_agent($idAgent[0], true);
}