From 0b4830bee7596da6b8db91b6385c60edd7231e3d Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 20 May 2022 15:43:49 +0200 Subject: [PATCH] Exclude page versions of disabled languages from search results ref https://www.woltlab.com/community/thread/295670-inexistente-cms-seiten-im-suchindex-nach-entfernen-der-mehrsprachigkeit/ --- .../install/files/lib/system/search/PageSearch.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/lib/system/search/PageSearch.class.php b/wcfsetup/install/files/lib/system/search/PageSearch.class.php index 46e1587716..db22fa90eb 100644 --- a/wcfsetup/install/files/lib/system/search/PageSearch.class.php +++ b/wcfsetup/install/files/lib/system/search/PageSearch.class.php @@ -7,6 +7,7 @@ use wcf\data\page\content\SearchResultPageContent; use wcf\data\page\content\SearchResultPageContentList; use wcf\data\search\ISearchResultObject; use wcf\system\database\util\PreparedStatementConditionBuilder; +use wcf\system\language\LanguageFactory; use wcf\system\WCF; /** @@ -96,6 +97,11 @@ class PageSearch extends AbstractSearchProvider 'wcf' . WCF_N . '_page.pageType IN (?) AND wcf' . WCF_N . '_page.isDisabled = ?', [['text', 'html'], 0] ); + // Exclude versions of disabled languages. + $conditionBuilder->add( + '(wcf' . WCF_N . '_page_content.languageID IS NULL OR wcf' . WCF_N . '_page_content.languageID IN (?))', + [\array_keys(LanguageFactory::getInstance()->getLanguages())] + ); $this->initAclCondition($conditionBuilder); return $conditionBuilder; -- 2.20.1