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

View File

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