summaryrefslogtreecommitdiffstats
path: root/modules-available/serversetup-bwlp-ipxe/install.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-19 23:52:11 +0100
committerSimon Rettberg2019-03-19 23:52:11 +0100
commit89e6c1ce7f901a19467fb5cbc18e8a87ea901482 (patch)
tree9b23b7ba486005b3aab53054810a0ab68b0346dd /modules-available/serversetup-bwlp-ipxe/install.inc.php
parent[serversetup-bwlp-ipxe] Fix incomplete bootentries, hide arch select (diff)
downloadslx-admin-89e6c1ce7f901a19467fb5cbc18e8a87ea901482.tar.gz
slx-admin-89e6c1ce7f901a19467fb5cbc18e8a87ea901482.tar.xz
slx-admin-89e6c1ce7f901a19467fb5cbc18e8a87ea901482.zip
[serversetup-bwlp-ipxe] Implement cascaded menus
Diffstat (limited to 'modules-available/serversetup-bwlp-ipxe/install.inc.php')
-rw-r--r--modules-available/serversetup-bwlp-ipxe/install.inc.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/install.inc.php b/modules-available/serversetup-bwlp-ipxe/install.inc.php
index 25579c13..201e0ced 100644
--- a/modules-available/serversetup-bwlp-ipxe/install.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/install.inc.php
@@ -25,7 +25,8 @@ $res[] = tableCreate('serversetup_menu', "
$res[] = tableCreate('serversetup_menuentry', "
`menuentryid` int(11) NOT NULL AUTO_INCREMENT,
`menuid` int(11) NOT NULL,
- `entryid` varchar(16) CHARACTER SET ascii NULL COMMENT 'If NULL, entry is gap',
+ `entryid` varchar(16) CHARACTER SET ascii NULL COMMENT 'If NULL, entry is gap or another menu',
+ `refmenuid` int(11) DEFAULT NULL COMMENT 'If entryid is NULL this can be a ref to another menu',
`hotkey` varchar(8) CHARACTER SET ascii NOT NULL,
`title` varchar(100) NOT NULL COMMENT 'Sanitize this before insert',
`hidden` tinyint(1) NOT NULL,
@@ -77,6 +78,18 @@ $res[] = tableAddConstraint('serversetup_menu_location', 'menuid', 'serversetup_
$res[] = tableAddConstraint('serversetup_menu_location', 'defaultentryid', 'serversetup_menuentry', 'menuentryid',
'ON UPDATE CASCADE ON DELETE SET NULL');
+// 2019-03-19 Add refmenuid to have cascaded menus
+if (!tableHasColumn('serversetup_menuentry', 'refmenuid')) {
+ if (Database::exec("ALTER TABLE serversetup_menuentry ADD COLUMN `refmenuid` int(11) DEFAULT NULL COMMENT 'If entryid is NULL this can be a ref to another menu'") !== false) {
+ $res[] = UPDATE_DONE;
+ } else {
+ $res[] = UPDATE_FAILED;
+ }
+}
+
+$res[] = tableAddConstraint('serversetup_menuentry', 'refmenuid', 'serversetup_menu', 'menuid',
+ 'ON UPDATE CASCADE ON DELETE SET NULL');
+
if (Module::get('location') !== false) {
if (!tableExists('location')) {
$res[] = UPDATE_RETRY;