summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/rebootcontrol/inc/rebootcontrol.inc.php')
-rw-r--r--modules-available/rebootcontrol/inc/rebootcontrol.inc.php28
1 files changed, 9 insertions, 19 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
index a37b070c..ab308084 100644
--- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
@@ -61,13 +61,8 @@ class RebootControl
/**
* Add wake task metadata to database, so we can display job details on the summary page.
- * @param string $taskId
- * @param string $type
- * @param array $clients
- * @param ?array $other
- * @return void
*/
- private static function addTask(string $taskId, string $type, array $clients, array $other = null)
+ private static function addTask(string $taskId, string $type, array $clients, array $other = null): void
{
$lids = ArrayUtil::flattenByKey($clients, 'locationid');
$lids = array_unique($lids);
@@ -220,12 +215,10 @@ class RebootControl
}
/**
- * @param string|string[] $macs
- * @param ?string $bcast
- * @param ?string $passwd
- * @return string
+ * Wake clients given by MAC address(es) via jawol util.
+ * Multiple MAC addresses can be passed as a space separated list.
*/
- private static function buildClientWakeCommand($macs, string $bcast = null, string $passwd = null): string
+ private static function buildClientWakeCommand(string $macs, string $bcast = null, string $passwd = null): string
{
$command = 'jawol';
if (!empty($bcast)) {
@@ -236,21 +229,18 @@ class RebootControl
if (!empty($passwd)) {
$command .= " -p '$passwd'";
}
- if (is_array($macs)) {
- $macs = implode(" ", $macs);
- }
$command .= " $macs";
return $command;
}
/**
* @param array $sourceMachines list of source machines. array of [clientip, machineuuid] entries
- * @param string|string[] $macaddr destination mac address(es)
- * @param ?string $bcast directed broadcast address to send to
- * @param ?string $passwd optional WOL password, mac address or ipv4 notation
+ * @param string $macaddr destination mac address(es)
+ * @param string $bcast directed broadcast address to send to
+ * @param string $passwd optional WOL password, mac address or ipv4 notation
* @return array|false task struct, false on error
*/
- public static function wakeViaClient($sourceMachines, $macaddr, string $bcast = null, string $passwd = null)
+ public static function wakeViaClient(array $sourceMachines, string $macaddr, string $bcast = null, string $passwd = null)
{
$command = self::buildClientWakeCommand($macaddr, $bcast, $passwd);
// Yes there is one zero "missing" from the usleep -- that's the whole point: we prefer 100ms sleeps
@@ -320,7 +310,7 @@ class RebootControl
* @param ?array $failed list of failed clients from $clientList
* @return ?string taskid of this job
*/
- public static function wakeMachines(array $clientList, array &$failed = null)
+ public static function wakeMachines(array $clientList, array &$failed = null): ?string
{
$errors = '';
$sent = $unknown = $unreachable = $failed = [];