summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-25 15:09:08 +0100
committerSimon Rettberg2019-03-25 15:09:08 +0100
commitc71bfb50acee1e4bd1d9f133d85e8a71a2d8f770 (patch)
treea74f470da8e271ce6ab1223e00429d88743b1db6
parent[api/init] Add logging function for crashes (diff)
downloadslx-admin-c71bfb50acee1e4bd1d9f133d85e8a71a2d8f770.tar.gz
slx-admin-c71bfb50acee1e4bd1d9f133d85e8a71a2d8f770.tar.xz
slx-admin-c71bfb50acee1e4bd1d9f133d85e8a71a2d8f770.zip
[serversetup-bwlp-ipxe] Fix type error (BootEntry vs PxeSection)
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
index 99f1f7a9..a78ad941 100644
--- a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
@@ -61,23 +61,22 @@ class IPxe
if (($menuId = array_search($entries, $menus)) !== false) {
error_log('Imported menu ' . $menu->title . ' exists, using for ' . count($locations) . ' locations.');
// Figure out the default label, get its label name
+ $defSection = null;
foreach ($menu->sections as $section) {
if ($section->isDefault) {
- $defId = $section;
- } elseif ($defId === null && $section->label === $menu->timeoutLabel) {
- $defId = $section;
+ $defSection = $section;
+ } elseif ($defSection === null && $section->label === $menu->timeoutLabel) {
+ $defSection = $section;
}
}
- if ($defId !== null && ($defIdEntry = array_search($defId, self::$allEntries)) !== false) {
+ if ($defSection !== null && ($defIdEntry = array_search(self::pxe2BootEntry($defSection), self::$allEntries)) !== false) {
// Confirm it actually exists (it should since the menu seems identical) and get menuEntryId
$me = Database::queryFirst('SELECT m.defaultentryid, me.menuentryid FROM serversetup_bootentry be
INNER JOIN serversetup_menuentry me ON (be.entryid = me.entryid)
INNER JOIN serversetup_menu m ON (m.menuid = me.menuid)
WHERE be.entryid = :id AND me.menuid = :menuid',
['id' => $defIdEntry, 'menuid' => $menuId]);
- if ($me === false || $me['defaultentryid'] == $me['menuentryid']) {
- $defId = null; // Not found, or is already default - don't override if it's the same
- } else {
+ if ($me !== false && $me['defaultentryid'] != $me['menuentryid']) {
$defId = $me['menuentryid'];
}
}