From d41c1195c5a54429ce44798759d8af665f948846 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 4 Feb 2021 16:35:21 +0100 Subject: [PATCH] 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. --- .../data/article/TaggedArticleList.class.php | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) 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']); } } -- 2.20.1