summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-11-22 10:26:31 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-11-22 12:36:57 +0100
commit00f0fe235854eccde71724e675dadfb5e8d30500 (patch)
tree99147bea907a7dbe4cc03daec5f1674c8f499bbd
parent5118932da36cd23ad76b93a0afee9f8afb2174fd (diff)
#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.
-rw-r--r--admin/WebConsole/gestores/gestor_ejecutaracciones.php16
1 files changed, 15 insertions, 1 deletions
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);
}
//________________________________________________________________________________________________________