From: Tim Düsterhus Date: Thu, 18 Feb 2021 10:30:33 +0000 (+0100) Subject: Preload box content even for system boxes X-Git-Tag: 5.4.0_Alpha_1~256^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b25fd27455576542cb4023390c28a69be652aac8;p=GitHub%2FWoltLab%2FWCF.git 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. --- 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();