From: Tim Düsterhus Date: Thu, 4 Feb 2021 15:35:21 +0000 (+0100) Subject: Make use of TagEngine::getSubselectForObjectsByTags() in TaggedArticleList X-Git-Tag: 5.4.0_Alpha_1~296^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d41c1195c5a54429ce44798759d8af665f948846;p=GitHub%2FWoltLab%2FWCF.git Make use of TagEngine::getSubselectForObjectsByTags() in TaggedArticleList Commit c9613f130106f74853fbe9a50f06c00208106b8c is fun. It renamed the getSqlForObjectsByTags() method that was previously used in TaggedArticleList to the current name getSubselectForObjectsByTags() and fixed a bug in the method that prevented it from working correctly. At the same time the commit edited TaggedArticleList to no longer use this method and instead copied over the logic. I'm not sure what exactly happened during the development of that commit, but we simply should use this (fixed) method. --- diff --git a/wcfsetup/install/files/lib/data/article/TaggedArticleList.class.php b/wcfsetup/install/files/lib/data/article/TaggedArticleList.class.php index c5ab63396e..8966b48b56 100644 --- a/wcfsetup/install/files/lib/data/article/TaggedArticleList.class.php +++ b/wcfsetup/install/files/lib/data/article/TaggedArticleList.class.php @@ -27,22 +27,14 @@ class TaggedArticleList extends AccessibleArticleList $this->sqlOrderBy = 'article.time ' . ARTICLE_SORT_ORDER; - $tagIDs = TagEngine::getInstance()->getTagIDs($tags); + $subselect = TagEngine::getInstance()->getSubselectForObjectsByTags( + 'com.woltlab.wcf.article', + $tags + ); $this->getConditionBuilder()->add("article.articleID IN ( SELECT articleID FROM wcf" . WCF_N . "_article_content - WHERE articleContentID IN ( - SELECT objectID - FROM wcf" . WCF_N . "_tag_to_object - WHERE objectTypeID = ? - AND tagID IN (?) - GROUP BY objectID - HAVING COUNT(objectID) = ? - ) - )", [ - TagEngine::getInstance()->getObjectTypeID('com.woltlab.wcf.article'), - $tagIDs, - \count($tagIDs), - ]); + WHERE articleContentID IN ({$subselect['sql']}) + )", $subselect['parameters']); } }