From: Matthias Schmidt Date: Tue, 20 Apr 2021 14:00:42 +0000 (+0200) Subject: Consider user list box conditions when using cache builder internally X-Git-Tag: 5.4.0_Alpha_1~12^2~11 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ce4a217c21f1392adfe9a18fe13a15f4026a750f;p=GitHub%2FWoltLab%2FWCF.git Consider user list box conditions when using cache builder internally --- diff --git a/wcfsetup/install/files/lib/system/box/UserListBoxController.class.php b/wcfsetup/install/files/lib/system/box/UserListBoxController.class.php index 56797fa4d2..7af672c311 100644 --- a/wcfsetup/install/files/lib/system/box/UserListBoxController.class.php +++ b/wcfsetup/install/files/lib/system/box/UserListBoxController.class.php @@ -1,11 +1,13 @@ sortOrder && $this->sortField && isset($this->cacheBuilders[$this->sortField])) { + $conditions = array_filter($this->box->getConditions(), function(Condition $condition) { + return $condition->getObjectType()->getProcessor() instanceof IObjectListCondition; + }); + $this->userIDs = call_user_func([$this->cacheBuilders[$this->sortField], 'getInstance'])->getData([ - 'limit' => $this->limit, - 'sortOrder' => $this->sortOrder + 'conditions' => $conditions, + 'limit' => $this->limit, + 'sortOrder' => $this->sortOrder, ]); } diff --git a/wcfsetup/install/files/lib/system/cache/builder/AbstractSortedUserCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/AbstractSortedUserCacheBuilder.class.php index 281c454818..fee3852aec 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/AbstractSortedUserCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/AbstractSortedUserCacheBuilder.class.php @@ -1,6 +1,8 @@ positiveValuesOnly) { $userProfileList->getConditionBuilder()->add('user_table.'.$this->sortField.' > ?', [0]); } + if (isset($parameters['conditions'])) { + /** @var Condition $condition */ + foreach ($parameters['conditions'] as $condition) { + /** @var IObjectListCondition $processor */ + $processor = $condition->getObjectType()->getProcessor(); + $processor->addObjectListCondition($userProfileList, $condition->conditionData); + } + } $userProfileList->sqlOrderBy = 'user_table.'.$this->sortField.' '.$sortOrder; $userProfileList->sqlLimit = !empty($parameters['limit']) ? $parameters['limit'] : $this->defaultLimit; $userProfileList->readObjectIDs();