From: Marcel Werk Date: Fri, 20 May 2022 13:43:49 +0000 (+0200) Subject: Exclude page versions of disabled languages from search results X-Git-Tag: 5.5.0_Beta_3~3^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0b4830bee7596da6b8db91b6385c60edd7231e3d;p=GitHub%2FWoltLab%2FWCF.git 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/ --- 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;