summaryrefslogtreecommitdiffstats
path: root/inc/event.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/event.inc.php')
-rw-r--r--inc/event.inc.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/inc/event.inc.php b/inc/event.inc.php
index 2d916b48..4d02b580 100644
--- a/inc/event.inc.php
+++ b/inc/event.inc.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Class with static functions that are called when a specific event
* took place, like the server has been booted, or the interface address
@@ -15,7 +17,7 @@ class Event
* Called when the system (re)booted. Could be implemented
* by a @reboot entry in crontab (running as the same user php does)
*/
- public static function systemBooted()
+ public static function systemBooted(): void
{
EventLog::info('System boot...');
$everythingFine = true;
@@ -45,7 +47,7 @@ class Event
// Check status of all tasks
// Mount vm store
- if ($mountId === false) {
+ if ($mountId === null) {
EventLog::info('No VM store type defined.');
$everythingFine = false;
} else {
@@ -58,13 +60,13 @@ class Event
$everythingFine = false;
}
// iPXE generation
- if ($ipxeId === false) {
+ if ($ipxeId === null) {
EventLog::failure('Cannot generate PXE menu: Taskmanager unreachable!');
$everythingFine = false;
} else {
$res = Taskmanager::waitComplete($ipxeId, 5000);
if (Taskmanager::isFailed($res)) {
- EventLog::failure('Update PXE Menu failed', $res['data']['error'] ?? $res['data']['error'] ?? '');
+ EventLog::failure('Update PXE Menu failed', $res['data']['error'] ?? $res['statusCode'] ?? '');
$everythingFine = false;
}
}
@@ -78,10 +80,10 @@ class Event
$mountId = Trigger::mount();
$mountStatus = Taskmanager::waitComplete($mountId, 10000);
}
- if ($mountId !== false && Taskmanager::isFailed($mountStatus)) {
+ if ($mountId !== null && Taskmanager::isFailed($mountStatus)) {
EventLog::failure('Mounting VM store failed', $mountStatus['data']['messages'] ?? '');
$everythingFine = false;
- } elseif ($mountId !== false && !Taskmanager::isFinished($mountStatus)) {
+ } elseif ($mountId !== null && !Taskmanager::isFinished($mountStatus)) {
// TODO: Still running - create callback
}
@@ -96,7 +98,7 @@ class Event
/**
* Server's primary IP address changed.
*/
- public static function serverIpChanged()
+ public static function serverIpChanged(): void
{
Trigger::ipxe();
if (Module::isAvailable('sysconfig')) { // TODO: Modularize events