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/locationinfo/inc/infopanel.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules-available/locationinfo/inc/infopanel.inc.php') diff --git a/modules-available/locationinfo/inc/infopanel.inc.php b/modules-available/locationinfo/inc/infopanel.inc.php index 6deb9db5..84a74e80 100644 --- a/modules-available/locationinfo/inc/infopanel.inc.php +++ b/modules-available/locationinfo/inc/infopanel.inc.php @@ -115,7 +115,7 @@ class InfoPanel $dbquery = Database::simpleQuery($query, array('idlist' => $idList)); // Iterate over matching machines - while ($row = $dbquery->fetch(PDO::FETCH_ASSOC)) { + foreach ($dbquery as $row) { if (isset($ignoreList[$row['machineuuid']])) continue; settype($row['locationid'], 'int'); @@ -175,7 +175,7 @@ class InfoPanel $res = Database::simpleQuery("SELECT locationid, openingtime FROM location WHERE locationid IN (:lids)", array('lids' => $allIds)); $openingTimes = array(); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + foreach ($res as $row) { $openingTimes[(int)$row['locationid']] = $row; } // Now we got all the calendars for locations and parents -- cgit v1.2.3-55-g7522