summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-05-30 17:05:53 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-05-30 17:17:39 +0200
commitda462c863441073ca429811bd1d023e929d611db (patch)
tree108f10a863b973f105dae3b32f79ee07a0980f6b
parent251bb977c45e89ff7bbf0d7c89ca1fb5a7296e69 (diff)
#915 adapt web console to use new reboot command in REST API
SocketHidra reboot has been replaced by POST /reboot.
-rw-r--r--admin/WebConsole/comandos/gestores/gestor_Comandos.php7
-rw-r--r--admin/WebConsole/includes/restfunctions.php10
2 files changed, 16 insertions, 1 deletions
diff --git a/admin/WebConsole/comandos/gestores/gestor_Comandos.php b/admin/WebConsole/comandos/gestores/gestor_Comandos.php
index 84d3520c..2ea51f86 100644
--- a/admin/WebConsole/comandos/gestores/gestor_Comandos.php
+++ b/admin/WebConsole/comandos/gestores/gestor_Comandos.php
@@ -25,6 +25,7 @@ define('OG_CMD_ID_WAKEUP', 1);
define('OG_CMD_ID_SENDMESSAGE', 16);
define('OG_CMD_ID_SESSION', 9);
define('OG_CMD_ID_POWEROFF', 2);
+define('OG_CMD_ID_REBOOT', 5);
// Recoge parametros de seguimiento
$sw_ejya="";
@@ -130,6 +131,9 @@ switch ($idcomando) {
break;
case OG_CMD_ID_POWEROFF:
poweroff($cadenaip);
+ break;
+ case OG_CMD_ID_REBOOT:
+ reboot($cadenaip);
}
if($ambito==0){ // Ambito restringido a un subconjuto de ordenadores con formato (idordenador1,idordenador2,etc)
@@ -189,7 +193,8 @@ if($sw_ejya=='on' || $sw_ejprg=="on" ){
if ($idcomando != OG_CMD_ID_SENDMESSAGE &&
$idcomando != OG_CMD_ID_WAKEUP &&
$idcomando != OG_CMD_ID_SESSION &&
- $idcomando != OG_CMD_ID_POWEROFF) {
+ $idcomando != OG_CMD_ID_POWEROFF &&
+ $idcomando != OG_CMD_ID_REBOOT) {
// Envío al servidor
$shidra=new SockHidra($servidorhidra,$hidraport);
if ($shidra->conectar()){ // Se ha establecido la conexión con el servidor hidra
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php
index ea4ad8bd..ea0fec85 100644
--- a/admin/WebConsole/includes/restfunctions.php
+++ b/admin/WebConsole/includes/restfunctions.php
@@ -12,6 +12,7 @@ define('OG_REST_CMD_SESSION', 'session');
define('OG_REST_CMD_RUN', 'shell/run');
define('OG_REST_CMD_OUTPUT', 'shell/output');
define('OG_REST_CMD_POWEROFF', 'poweroff');
+define('OG_REST_CMD_REBOOT', 'reboot');
define('OG_REST_PARAM_CLIENTS', 'clients');
define('OG_REST_PARAM_ADDR', 'addr');
@@ -145,6 +146,15 @@ function poweroff($string_ips) {
common_request(OG_REST_CMD_POWEROFF, POST, $data);
}
+function reboot($string_ips) {
+
+ $ips = explode(';',$string_ips);
+
+ $data = array(OG_REST_PARAM_CLIENTS => $ips);
+
+ common_request(OG_REST_CMD_REBOOT, POST, $data);
+}
+
/*
* @function multiRequest.
* @param URLs array (may include header and POST data), cURL options array.