diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2019-05-30 15:28:20 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-05-30 17:17:39 +0200 |
commit | dc827546044e8df83adc0bb10536c2f85d6039f3 (patch) | |
tree | c0881e696b7765f28aa5c223e5393d62178a951a /admin/WebConsole/includes/restfunctions.php | |
parent | da462c863441073ca429811bd1d023e929d611db (diff) |
#915 adapt web console to use new stop command in REST API
SocketHidra "purgar" has been replaced by POST /stop.
Diffstat (limited to 'admin/WebConsole/includes/restfunctions.php')
-rw-r--r-- | admin/WebConsole/includes/restfunctions.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php index ea0fec85..cb8e0f08 100644 --- a/admin/WebConsole/includes/restfunctions.php +++ b/admin/WebConsole/includes/restfunctions.php @@ -13,6 +13,7 @@ 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_CMD_STOP', 'stop'); define('OG_REST_PARAM_CLIENTS', 'clients'); define('OG_REST_PARAM_ADDR', 'addr'); @@ -45,7 +46,7 @@ function common_request($command, $type, $data = null, $custom = 'GET') { if ($curl_response === false || $info['http_code'] != 200) { syslog(LOG_ERR, 'error occured during curl exec. Additioanl info: ' . var_export($info)); - return null; + return 0; } curl_close($curl); @@ -155,6 +156,15 @@ function reboot($string_ips) { common_request(OG_REST_CMD_REBOOT, POST, $data); } +function stop($string_ips) { + + $ips = explode(';',$string_ips); + + $data = array(OG_REST_PARAM_CLIENTS => $ips); + + common_request(OG_REST_CMD_STOP, POST, $data); +} + /* * @function multiRequest. * @param URLs array (may include header and POST data), cURL options array. |