From 15a9c873d64b67e9080c42545daa2fd53edd0da5 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 14 May 2020 16:27:52 +0200 Subject: #942 add immediate commands on the queue (web) Users can launch immediate commands on the queue to keep an history and to watch the status and the properties. This commit adapt this functionality to new functions and behaviour of the ogAdmServer. --- .../WebConsole/comandos/gestores/gestor_Comandos.php | 17 +++++++++++++---- admin/WebConsole/gestores/gestor_ejecutaracciones.php | 19 ------------------- admin/WebConsole/includes/comunes.php | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/admin/WebConsole/comandos/gestores/gestor_Comandos.php b/admin/WebConsole/comandos/gestores/gestor_Comandos.php index 757b9cea..664307be 100644 --- a/admin/WebConsole/comandos/gestores/gestor_Comandos.php +++ b/admin/WebConsole/comandos/gestores/gestor_Comandos.php @@ -242,11 +242,20 @@ if($sw_ejya=='on' || $sw_ejprg=="on" ){ $ValorParametros=extrae_parametros($parametros,chr(13),'='); $script=@urldecode($ValorParametros["scp"]); if($sw_ejya=='on'){ - if (($sw_seguimiento == 1 || $sw_ejprg == "on") && - $idcomando != OG_CMD_ID_WAKEUP) - run_schedule($cadenaip); - else + if ($sw_seguimiento == 1 && + $idcomando != OG_CMD_ID_WAKEUP) { + $when = now_params(); + $resul = create_schedule(strval($sesion), + $EJECUCION_PROCEDIMIENTO, + "", $when['map_year'], + $when['map_month'], + 0, 0, $when['map_day'], + $when['map_hour'], + $when['map_am_pm'], + $when['map_minute']); + } else { run_command($idcomando, $cadenaip, $cadenamac, $atributos); + } // En agente nuevo devuelvo siempre correcto $resulhidra = 1; diff --git a/admin/WebConsole/gestores/gestor_ejecutaracciones.php b/admin/WebConsole/gestores/gestor_ejecutaracciones.php index 4f6f8138..5349e1d0 100644 --- a/admin/WebConsole/gestores/gestor_ejecutaracciones.php +++ b/admin/WebConsole/gestores/gestor_ejecutaracciones.php @@ -19,25 +19,6 @@ include_once("../includes/RecopilaIpesMacs.php"); include_once("../includes/restfunctions.php"); //________________________________________________________________________________________________________ -function now_params() -{ - $year = intval(date('Y')) - 2010; - $month = intval(date('m')) - 1; - $day = intval(date('j')) - 1; - $hour = intval(date('g')); - $am_pm = date('a'); - $minute = intval(date('i')); - - $params['map_year'] = 1 << $year; - $params['map_month'] = 1 << $month; - $params['map_day'] = 1 << $day; - $params['map_hour'] = 1 << $hour; - $params['map_am_pm'] = strcmp($am_pm, 'am') ? 1 : 0; - $params['map_minute'] = $minute; - - return $params; -} - define('OG_CMD_ID_WAKEUP', 1); $opcion=0; // Inicializa parametros diff --git a/admin/WebConsole/includes/comunes.php b/admin/WebConsole/includes/comunes.php index f6598c86..213e764e 100644 --- a/admin/WebConsole/includes/comunes.php +++ b/admin/WebConsole/includes/comunes.php @@ -400,3 +400,21 @@ } } + function now_params() + { + $year = intval(date('Y')) - 2010; + $month = intval(date('m')) - 1; + $day = intval(date('j')) - 1; + $hour = intval(date('g')); + $am_pm = date('a'); + $minute = intval(date('i')); + + $params['map_year'] = 1 << $year; + $params['map_month'] = 1 << $month; + $params['map_day'] = 1 << $day; + $params['map_hour'] = 1 << $hour; + $params['map_am_pm'] = strcmp($am_pm, 'am') ? 1 : 0; + $params['map_minute'] = $minute; + + return $params; + } -- cgit v1.2.3-18-g5258