Added update standby token in massive operations

This commit is contained in:
fermin831 2018-09-24 17:32:58 +02:00
parent 9cf578e1f6
commit 823b32ac63
1 changed files with 14 additions and 3 deletions

View File

@ -30,6 +30,7 @@ require_once ('include/functions_modules.php');
require_once ('include/functions_servers.php');
require_once ('include/functions_gis.php');
require_once ('include/functions_users.php');
enterprise_include_once('include/functions_config_agents.php');
if (is_ajax ()) {
$get_n_conf_files = (bool) get_parameter ('get_n_conf_files');
@ -136,8 +137,11 @@ if ($update_agents) {
foreach ($id_agents as $id_agent) {
if (!empty($values)) {
$group_old = false;
if($values['id_grupo']){
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
$disabled_old = false;
if($values['id_grupo'] || isset($values['disabled'])){
$values_old = db_get_row_filter('tagente', array('id_agente' => $id_agent), array('id_grupo', 'disabled'));
if ($values_old['id_grupo']) $group_old = $values_old['id_grupo'];
if (isset($values['disabled'])) $disabled_old = $values_old['disabled'];
}
$result = db_process_sql_update ('tagente',
@ -149,7 +153,14 @@ if ($update_agents) {
// Force an update of the agent cache.
$result_metaconsole = agent_update_from_cache($id_agent,$values,$server_name);
}
if ($disabled_old !== false && $disabled_old != $values['disabled']) {
enterprise_hook(
'config_agents_update_config_token',
array($id_agent, 'standby', $values['disabled'])
);
}
if($group_old || $result){
if ($group_old && $group_old != null) {
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups