From 00f0fe235854eccde71724e675dadfb5e8d30500 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 22 Nov 2019 10:26:31 +0100 Subject: #915 Fix WoL command support in procedures and tasks Irina reports that the Wake on Lan command does not work in procedures. The client/computer does not turn on, causing that any of the other commands are executed. This bug appears when we adapt the procedures and tasks to work with the new API REST of the ogAdmServer. It is caused because the client needs to be on to ask itself for the pending commands, but the WoL command can not work this way because the client is off. This commit changes the behaviour of recorreProcedimientos to send the WoL command without the client has to ask. --- admin/WebConsole/gestores/gestor_ejecutaracciones.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'admin') diff --git a/admin/WebConsole/gestores/gestor_ejecutaracciones.php b/admin/WebConsole/gestores/gestor_ejecutaracciones.php index 2a0dff41..edb976f2 100644 --- a/admin/WebConsole/gestores/gestor_ejecutaracciones.php +++ b/admin/WebConsole/gestores/gestor_ejecutaracciones.php @@ -19,6 +19,8 @@ include_once("../includes/RecopilaIpesMacs.php"); include_once("../includes/restfunctions.php"); //________________________________________________________________________________________________________ +define('OG_CMD_ID_WAKEUP', 1); + $opcion=0; // Inicializa parametros $idprocedimiento=0; @@ -155,8 +157,12 @@ function ejecucionTarea($idtarea) //________________________________________________________________________________________________________ function recorreProcedimientos($idprocedimiento,$ambito,$idambito) { - global $cmd; + global $cadenamac; + global $cadenaip; global $sesion; + global $cmd; + + $wol_params; $cmd->texto="SELECT idcomando,procedimientoid,parametros FROM procedimientos_acciones @@ -183,11 +189,19 @@ function recorreProcedimientos($idprocedimiento,$ambito,$idambito) $sesion=$nwsesion; $cmd->ParamSetValor("@sesion",$sesion); // Fin ticket 681. + if ($idcomando == OG_CMD_ID_WAKEUP) + $wol_params = $parametros; if(!insertaComando($idcomando,$parametros,$idprocedimiento,$ambito,$idambito)) return(false); } $rs->Siguiente(); } + + if (isset($wol_params)) { + $atributos = substr(trim($wol_params), -1); + include("../comandos/gestores/wakeonlan_repo.php"); + } + return(true); } //________________________________________________________________________________________________________ -- cgit v1.2.3-18-g5258