summaryrefslogtreecommitdiffstats
path: root/modules-available/eventlog/install.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2025-02-25 16:16:52 +0100
committerSimon Rettberg2025-02-25 16:16:52 +0100
commitf33b895e72c7cb849ebb742cd8331e8646b8acd6 (patch)
treeef8e3092c3d57819b7ba7a05fced3f8a4658c9a9 /modules-available/eventlog/install.inc.php
parent[eventlog] Add Matrix as transport protocol (diff)
downloadslx-admin-f33b895e72c7cb849ebb742cd8331e8646b8acd6.tar.gz
slx-admin-f33b895e72c7cb849ebb742cd8331e8646b8acd6.tar.xz
slx-admin-f33b895e72c7cb849ebb742cd8331e8646b8acd6.zip
[eventlog] Track when a filter rule was last triggered
Diffstat (limited to 'modules-available/eventlog/install.inc.php')
-rw-r--r--modules-available/eventlog/install.inc.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules-available/eventlog/install.inc.php b/modules-available/eventlog/install.inc.php
index 5827e225..8ea17187 100644
--- a/modules-available/eventlog/install.inc.php
+++ b/modules-available/eventlog/install.inc.php
@@ -22,6 +22,7 @@ $res[] = tableCreate('notification_rule', '
`subject` varchar(200) NOT NULL,
`message` text NOT NULL,
`predefid` int(10) UNSIGNED NULL DEFAULT NULL,
+ `lasttime` int(10) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`ruleid`),
KEY `type` (`type`),
UNIQUE KEY `predefid` (`predefid`)
@@ -107,9 +108,17 @@ $q = "INSERT IGNORE INTO `notification_rule`
(12,'Neues MaxiLinux verfügbar','Ein neues MaxiLinux (stabil oder beta) wurde veröffentlicht','#netboot-new-version','{\"list\":[{\"path\":\"branchid\",\"op\":\"*\",\"index\":0},{\"path\":\"versionid\",\"op\":\"*\",\"index\":1},{\"path\":\"title\",\"op\":\"*\",\"index\":2},{\"path\":\"description\",\"op\":\"*\",\"index\":3},{\"path\":\"dateline\",\"op\":\"*\",\"index\":4}]}','Neues MaxiLinux','Sehr geehrte Frau Müller,\r\n\r\nEs gibt ein neues MaxiLinux in der Kategorie %0%, veröffentlicht am %4ts%.\r\n%2%\r\n\r\nChangelog:\r\n%3%'),
(13,'dnbd3-proxy Korruption','Checksum-Prüfung auf einem dnbd3-proxy schlug fehl. (Bei regelmäßigem Auftreten RAM und HDD überprüfen.)','dnbd3-hashfail','{\"list\":[{\"path\":\"description\",\"op\":\"regex\",\"arg\":\"\\\\/\\\\\\\\[[0-9]+\\\\\\\\]: (.*)$\\\\/\",\"index\":0},{\"path\":\"clientip\",\"op\":\"*\",\"index\":1}]}','Checksum error dnbd3-proxy %1%','%0:1%')
";
-
Database::exec($q);
+// 2025-02-25: Add lasttime column to track when it was last triggered
+if (!tableHasColumn('notification_rule', 'lasttime')) {
+ if (Database::exec("ALTER TABLE notification_rule
+ ADD COLUMN `lasttime` int(10) UNSIGNED NULL DEFAULT NULL") === false) {
+ finalResponse(UPDATE_FAILED, 'Could not add lasttime to notification_rule: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
+
// Create response for browser
if (in_array(UPDATE_DONE, $res)) {