summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-05-30 15:47:52 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-05-30 17:17:39 +0200
commitc9cfd44a967e6be22f07ce3622cf261e51590705 (patch)
tree2ee71e18f7ea832ddf6cb9f8b9a1e334eb01cb55 /admin
parentdc827546044e8df83adc0bb10536c2f85d6039f3 (diff)
#915 adapt web console to use new refresh command in REST API
SocketHidra "actualizar" has been replaced by POST /refresh.
Diffstat (limited to 'admin')
-rw-r--r--admin/WebConsole/includes/restfunctions.php10
-rw-r--r--admin/WebConsole/principal/actualizar.php21
2 files changed, 12 insertions, 19 deletions
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php
index cb8e0f08..6073bdef 100644
--- a/admin/WebConsole/includes/restfunctions.php
+++ b/admin/WebConsole/includes/restfunctions.php
@@ -14,6 +14,7 @@ define('OG_REST_CMD_OUTPUT', 'shell/output');
define('OG_REST_CMD_POWEROFF', 'poweroff');
define('OG_REST_CMD_REBOOT', 'reboot');
define('OG_REST_CMD_STOP', 'stop');
+define('OG_REST_CMD_REFRESH', 'refresh');
define('OG_REST_PARAM_CLIENTS', 'clients');
define('OG_REST_PARAM_ADDR', 'addr');
@@ -165,6 +166,15 @@ function stop($string_ips) {
common_request(OG_REST_CMD_STOP, POST, $data);
}
+function refresh($string_ips) {
+
+ $ips = explode(';',$string_ips);
+
+ $data = array(OG_REST_PARAM_CLIENTS => $ips);
+
+ common_request(OG_REST_CMD_REFRESH, POST, $data);
+}
+
/*
* @function multiRequest.
* @param URLs array (may include header and POST data), cURL options array.
diff --git a/admin/WebConsole/principal/actualizar.php b/admin/WebConsole/principal/actualizar.php
index 63f2d1b3..500b0b89 100644
--- a/admin/WebConsole/principal/actualizar.php
+++ b/admin/WebConsole/principal/actualizar.php
@@ -15,6 +15,7 @@
include_once("../includes/comunes.php");
include_once("../includes/CreaComando.php");
include_once("../includes/RecopilaIpesMacs.php");
+ include_once('../includes/restfunctions.php');
//________________________________________________________________________________________________________
$ambito=0;
$idambito=0;
@@ -41,23 +42,5 @@
//________________________________________________________________________________________________________
// Envio al servidor de la petición
//________________________________________________________________________________________________________
- $trama="";
- $shidra=new SockHidra($servidorhidra,$hidraport);
- if ($shidra->conectar()){ // Se ha establecido la conexión con el servidor hidra
- $parametros="nfn=".$funcion.chr(13);
- $parametros.=$aplicacion;
- $parametros.=$atributos;
- $parametros.=$acciones;
- $shidra->envia_comando($parametros);
- $trama=$shidra->recibe_respuesta();
- $shidra->desconectar();
- $hlonprm=hexdec(substr($trama,$LONCABECERA,$LONHEXPRM));
- $parametros=substr($trama,$LONCABECERA+$LONHEXPRM,$hlonprm);
- $ValorParametros=extrae_parametros($parametros,chr(13),'=');
- $trama_notificacion=$ValorParametros["res"];
- echo $trama_notificacion; // Devuelve respuesta
- }
- else
- echo "0"; // Error de conexión
-
+ echo refresh($cadenaip) === 0 ? "0" : "1";