diff options
author | Simon Rettberg | 2021-05-06 10:26:09 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-05-11 14:51:13 +0200 |
commit | 8dc2b92d667f1401ab9f1315a36add61658f899c (patch) | |
tree | 452c5fe040055884cf9d9ee834415db84999a9a1 /modules-available/serversetup-bwlp-ipxe/page.inc.php | |
parent | [session] Add simple session overview table (diff) | |
download | slx-admin-8dc2b92d667f1401ab9f1315a36add61658f899c.tar.gz slx-admin-8dc2b92d667f1401ab9f1315a36add61658f899c.tar.xz slx-admin-8dc2b92d667f1401ab9f1315a36add61658f899c.zip |
Moderize Database handling
* Auto-convert to utf8mb4_unicode_520_ci
* Use foreach instead of while to loop over results
* Drop useless statement caching
* Keep emulated prepares, as we sometimes loop over nested queries
Diffstat (limited to 'modules-available/serversetup-bwlp-ipxe/page.inc.php')
-rw-r--r-- | modules-available/serversetup-bwlp-ipxe/page.inc.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php index 8fd6fd49..4e104e78 100644 --- a/modules-available/serversetup-bwlp-ipxe/page.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php @@ -294,7 +294,7 @@ class Page_ServerSetup extends Page ) m LEFT JOIN serversetup_localboot sl USING (systemmodel) ORDER BY systemmodel'); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { $row['modelesc'] = urlencode($row['systemmodel']); $row['options'] = $this->makeSelectArray(Localboot::BOOT_METHODS, $row); $models[] = $row; @@ -361,7 +361,7 @@ class Page_ServerSetup extends Page GROUP BY menuid, title ORDER BY title"); $menuTable = []; - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { if (empty($row['locations'])) { $locations = []; $row['allowEdit'] = in_array(0, $allowedEdit); @@ -433,7 +433,7 @@ class Page_ServerSetup extends Page LEFT JOIN serversetup_bootentry be USING (entryid) WHERE menuid = :id ORDER BY sortval ASC", compact('id')); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { if ($row['entryid'] === null && $row['refmenuid'] !== null) { $row['entryid'] = 'menu:' . $row['refmenuid']; } @@ -975,7 +975,7 @@ class Page_ServerSetup extends Page ORDER BY m.title ASC', ['locationid' => $locationId]); $menus = []; $hasDefault = false; - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { $eids = explode(',', $row['entries']); $row['default_entry_title'] = $menuEntries[$row['menu_default']] ?? ''; $row['entries'] = []; |