From b25fd27455576542cb4023390c28a69be652aac8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 18 Feb 2021 11:30:33 +0100 Subject: [PATCH] Preload box content even for system boxes Box::getBoxContentTitle() unconditionally loads the box contents for all box types, because even system boxes might fall back to the box title that is configured within the ACP. This might result on O(n) queries when a page has several system boxes. Fix this issue by preloading the box contents for all boxes. --- wcfsetup/install/files/lib/data/box/BoxList.class.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/wcfsetup/install/files/lib/data/box/BoxList.class.php b/wcfsetup/install/files/lib/data/box/BoxList.class.php index 2562960559..c9408aa5c5 100644 --- a/wcfsetup/install/files/lib/data/box/BoxList.class.php +++ b/wcfsetup/install/files/lib/data/box/BoxList.class.php @@ -42,14 +42,7 @@ class BoxList extends DatabaseObjectList // get box content if ($this->contentLoading) { - $boxIDs = []; - foreach ($this->getObjects() as $box) { - if ($box->boxType != 'system' && $box->boxType != 'menu') { - $boxIDs[] = $box->boxID; - } - } - - if (!empty($boxIDs)) { + if (!empty($this->objectIDs)) { $contentList = new BoxContentList(); $contentList->enableImageLoading(); $contentList->enableEmbeddedObjectLoading(); -- 2.20.1