summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/comandos/gestores/wakeonlan_repo.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/WebConsole/comandos/gestores/wakeonlan_repo.php')
-rw-r--r--admin/WebConsole/comandos/gestores/wakeonlan_repo.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/admin/WebConsole/comandos/gestores/wakeonlan_repo.php b/admin/WebConsole/comandos/gestores/wakeonlan_repo.php
index b2929d48..c1c5394f 100644
--- a/admin/WebConsole/comandos/gestores/wakeonlan_repo.php
+++ b/admin/WebConsole/comandos/gestores/wakeonlan_repo.php
@@ -9,9 +9,17 @@ include_once("../../includes/restfunctions.php");
$cadenaip
$cadenamac
-*/
+ */
+
+//Multicast or Unicast
+preg_match_all('!\d{1}!', $atributos, $matches);
+
// Capturamos todas las ids
$macs = explode(";",$cadenamac);
+$ips = explode(';',$cadenaip);
+
+wol($matches[0][0], $macs, $ips);
+
// Recorremos las ids y vemos cual es la ip del repositorio
$repos = array();
$reposAndMacs = array();
@@ -43,19 +51,21 @@ foreach($macs as $mac){
}
$rs->Cerrar();
}
+
// En este punto tenemos un array con todos los repos y cada uno de ellos con una lista de todas las macs que deben arrancar
// Recorremos cada uno de ellos
foreach($reposAndMacs as $repo => $macs){
// En el array de $macs tenemos la clave "apikey"
- if($macs["apikey"] !== ""){
+ if($macs["apikey"] !== "") {
$apiKeyRepo = $macs["apikey"];
unset($macs["apikey"]);
// Componer datos de conexión para el repositorio.
$urls[$repo]['url'] = "https://$repo/opengnsys/rest/repository/poweron";
$urls[$repo]['header'] = array('Authorization: '. $apiKeyRepo);
- $urls[$repo]['post'] = '{"macs": ["' . implode('","', $macs) . '"]}';
+ $urls[$repo]['post'] = '{"macs": ["' . implode('","', $macs) . '"], "ips": ["' . str_replace(';', '","', $cadenaip) .
+ '"], "mar": "' . $matches[0][0] . '"}';
}
- else{
+ else {
$avisoRepo = true;
}
}
@@ -76,10 +86,11 @@ function existREPO($repo, $repos){
$index = 0;
while(!$found && $index < count($repos)){
$r = $repos[$index];
+ $index++;
if($r == $repo)
$found=true;
}
return $found;
}
-?>
+