From a83cc6cec97358a9037a84db229a45734c9ba8d1 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 2 May 2022 15:23:56 +0200 Subject: [serversetup-bwlp-ipxe] Fix pvsmgr hack (accessed wrong field) --- .../serversetup-bwlp-ipxe/inc/ipxemenu.inc.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php') diff --git a/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php index 4968595f..7d15cd99 100644 --- a/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php @@ -15,6 +15,9 @@ class IPxeMenu * @var string title to display above menu */ public $title; + /** + * @var int menu entry id from DB + */ public $defaultEntryId; /** * @var MenuEntry[] @@ -45,7 +48,7 @@ class IPxeMenu $this->menuid = (int)$menu['menuid']; $this->timeoutMs = (int)$menu['timeoutms']; $this->title = (string)$menu['title']; - $this->defaultEntryId = $menu['defaultentryid']; + $defaultEntryId = $menu['defaultentryid']; $res = Database::simpleQuery("SELECT e.menuentryid, e.entryid, e.refmenuid, e.hotkey, e.title, e.hidden, e.sortval, e.md5pass, b.module, b.data AS bootentry, b.title AS betitle FROM serversetup_menuentry e @@ -56,9 +59,10 @@ class IPxeMenu $this->items[] = new MenuEntry($row); } // Make sure we have a default entry if the menu isn't empty - if ($this->defaultEntryId === null && !empty($this->items)) { - $this->defaultEntryId = $this->items[0]->menuEntryId(); + if ($defaultEntryId === null && !empty($this->items)) { + $defaultEntryId = $this->items[0]->menuEntryId(); } + $this->defaultEntryId = (int)$defaultEntryId; } public function title(): string @@ -85,7 +89,7 @@ class IPxeMenu public function defaultEntry() { foreach ($this->items as $item) { - if ($item->menuEntryId() == $this->defaultEntryId) + if ($item->menuEntryId() === $this->defaultEntryId) return $item; } return null; @@ -107,7 +111,7 @@ class IPxeMenu if ($rm === false) return; // Is not pvsmgr - if ($rm['modeid'] !== 'roomplanner') + if ($rm['module'] !== 'roomplanner') return; // See if it's a dedicated station, if so make sure it boots into bwLehrpool $data = json_decode($rm['modedata'], true); -- cgit v1.2.3-55-g7522