From cde0df618e9f0b81bc216943c1123ed9db2ec1c5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 21 Oct 2024 15:43:01 +0200 Subject: [minilinux] Add event for newly available netboot/minilinux version --- modules-available/minilinux/inc/minilinux.inc.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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) -- cgit v1.2.3-55-g7522