summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol
diff options
context:
space:
mode:
authorSimon Rettberg2025-08-01 13:41:49 +0200
committerSimon Rettberg2025-08-01 13:41:49 +0200
commit429cfb1677ec77c5a945f655d9405d038d3e5a2c (patch)
treeb3fbb729cb2231f4163b96a67046ad878f48d1b4 /modules-available/rebootcontrol
parent[minilinux] show -> action for POST actions (diff)
downloadslx-admin-429cfb1677ec77c5a945f655d9405d038d3e5a2c.tar.gz
slx-admin-429cfb1677ec77c5a945f655d9405d038d3e5a2c.tar.xz
slx-admin-429cfb1677ec77c5a945f655d9405d038d3e5a2c.zip
Implicitly nullable types are deprecated in PHP 8.3, make explicit
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r--modules-available/rebootcontrol/inc/rebootcontrol.inc.php14
-rw-r--r--modules-available/rebootcontrol/inc/scheduler.inc.php2
2 files changed, 8 insertions, 8 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
index 6857482d..480d2fe9 100644
--- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
@@ -62,7 +62,7 @@ class RebootControl
/**
* Add wake task metadata to database, so we can display job details on the summary page.
*/
- private static function addTask(string $taskId, string $type, array $clients, array $other = null): void
+ private static function addTask(string $taskId, string $type, array $clients, ?array $other = null): void
{
$lids = ArrayUtil::flattenByKey($clients, 'locationid');
$lids = array_unique($lids);
@@ -93,7 +93,7 @@ class RebootControl
* @param ?string $id only with this TaskID
* @return array|false list of active tasks for reboots/shutdowns.
*/
- public static function getActiveTasks(array $locations = null, string $id = null)
+ public static function getActiveTasks(?array $locations = null, ?string $id = null)
{
if (is_array($locations) && in_array(0, $locations)) {
$locations = null;
@@ -218,7 +218,7 @@ class RebootControl
* 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(string $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)) {
@@ -240,7 +240,7 @@ class RebootControl
* @param string $passwd optional WOL password, mac address or ipv4 notation
* @return array|false task struct, false on error
*/
- public static function wakeViaClient(array $sourceMachines, string $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
@@ -254,7 +254,7 @@ class RebootControl
* @param ?string $passwd optional WOL password; mac address or ipv4 notation
* @return array|false task struct, false on error
*/
- public static function wakeDirectly($macaddr, string $bcast = null, string $passwd = null)
+ public static function wakeDirectly($macaddr, ?string $bcast = null, ?string $passwd = null)
{
if (!is_array($macaddr)) {
$macaddr = [$macaddr];
@@ -310,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): ?string
+ public static function wakeMachines(array $clientList, ?array &$failed = null): ?string
{
$errors = '';
$sent = $unknown = $unreachable = $failed = [];
@@ -446,7 +446,7 @@ class RebootControl
$subnet['iclients'] = array_slice($subnet['iclients'], 0, 3);
}
- public static function prepareExec(string $presetId = null)
+ public static function prepareExec(?string $presetId = null)
{
User::assertPermission('.rebootcontrol.action.exec');
$uuids = array_values(Request::post('uuid', Request::REQUIRED, 'array'));
diff --git a/modules-available/rebootcontrol/inc/scheduler.inc.php b/modules-available/rebootcontrol/inc/scheduler.inc.php
index 19a01beb..a361825f 100644
--- a/modules-available/rebootcontrol/inc/scheduler.inc.php
+++ b/modules-available/rebootcontrol/inc/scheduler.inc.php
@@ -175,7 +175,7 @@ class Scheduler
* @param string|null $onlyRunmode if not null, only process running clients in given runmode
* @return void
*/
- private static function executeCronForLocation(int $locationId, string $action, string $onlyRunmode = null)
+ private static function executeCronForLocation(int $locationId, string $action, ?string $onlyRunmode = null)
{
if ($onlyRunmode === null) {
$machines = Database::queryAll("SELECT machineuuid, clientip, macaddr, locationid FROM machine