summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-10-21 15:43:01 +0200
committerSimon Rettberg2024-10-21 15:43:01 +0200
commitcde0df618e9f0b81bc216943c1123ed9db2ec1c5 (patch)
tree7e9728b610c1b049fd9402c13cb58f1186d9bcf2
parent[minilinux] Remove debug spam (diff)
downloadslx-admin-cde0df618e9f0b81bc216943c1123ed9db2ec1c5.tar.gz
slx-admin-cde0df618e9f0b81bc216943c1123ed9db2ec1c5.tar.xz
slx-admin-cde0df618e9f0b81bc216943c1123ed9db2ec1c5.zip
[minilinux] Add event for newly available netboot/minilinux version
-rw-r--r--modules-available/minilinux/inc/minilinux.inc.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules-available/minilinux/inc/minilinux.inc.php b/modules-available/minilinux/inc/minilinux.inc.php
index cbc797f2..512f678e 100644
--- a/modules-available/minilinux/inc/minilinux.inc.php
+++ b/modules-available/minilinux/inc/minilinux.inc.php
@@ -87,6 +87,15 @@ class MiniLinux
private static function addBranches($sourceid, $systems)
{
+ // Make a before-snapshot, so we can generate events for new versions for each branch
+ $newestPerBranch = [];
+ $versions = Database::queryAll("SELECT branchid, versionid, dateline
+ FROM minilinux_version
+ ORDER BY branchid ASC, dateline ASC");
+ foreach ($versions as $ver) {
+ $newestPerBranch[$ver['branchid']] = $ver;
+ }
+ //
foreach ($systems as $system) {
if (!self::isValidIdPart($system['id']))
continue;
@@ -118,6 +127,18 @@ class MiniLinux
]);
}
}
+ // Now, compare again
+ $versions = Database::queryAll("SELECT branchid, versionid, title, description, dateline
+ FROM minilinux_version
+ ORDER BY branchid ASC, dateline ASC");
+ foreach ($versions as $ver) {
+ if (!isset($newestPerBranch[$ver['branchid']]))
+ continue;
+ if ($newestPerBranch[$ver['branchid']]['dateline'] < $ver['dateline']) {
+ // New version found :-)
+ EventLog::applyFilterRules('#netboot-new-version', $ver);
+ }
+ }
}
private static function addVersions($branchid, $versions)