From 8dc2b92d667f1401ab9f1315a36add61658f899c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 6 May 2021 10:26:09 +0200 Subject: 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 --- modules-available/roomplanner/page.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules-available/roomplanner/page.inc.php') diff --git a/modules-available/roomplanner/page.inc.php b/modules-available/roomplanner/page.inc.php index 8c3beace..a591014b 100644 --- a/modules-available/roomplanner/page.inc.php +++ b/modules-available/roomplanner/page.inc.php @@ -195,7 +195,7 @@ class Page_Roomplanner extends Page $returnObject = ['machines' => []]; - while ($row = $result->fetch(PDO::FETCH_ASSOC)) { + foreach ($result as $row) { if (!Location::isFixedLocationValid($roomLocationId, $row['subnetlocationid'])) continue; if (empty($row['hostname'])) { @@ -393,7 +393,7 @@ class Page_Roomplanner extends Page WHERE fixedlocationid = :locationid', ['locationid' => $this->locationid]); $machines = []; - while ($row = $result->fetch(PDO::FETCH_ASSOC)) { + foreach ($result as $row) { $machine = []; $pos = json_decode($row['position'], true); if ($pos === false || !isset($pos['gridRow']) || !isset($pos['gridCol'])) { @@ -429,7 +429,7 @@ class Page_Roomplanner extends Page $machines = []; - while ($row = $result->fetch(PDO::FETCH_ASSOC)) { + foreach ($result as $row) { if (empty($row['hostname'])) { $row['hostname'] = $row['clientip']; } -- cgit v1.2.3-55-g7522