X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQuerySearch.php;h=b90dd5d6af90e879a9d6202a782c06c434077c6e;hb=bfb84f8a0da5fa4bc2e2a3472af32bad830286c4;hp=f5461e0acea2c424b76b58d879d7f7eaee592828;hpb=cd5372409f5e93f8c93f2a8c7b32d8828f059321;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index f5461e0ace..b90dd5d6af 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -20,6 +20,8 @@ * @file */ +use MediaWiki\MediaWikiServices; + /** * Query module to perform full text search within wiki titles and content * @@ -48,7 +50,6 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { * @return void */ private function run( $resultPageSet = null ) { - global $wgContLang; $params = $this->extractRequestParams(); // Extract parameters @@ -152,7 +153,8 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } // Add the search results to the result - $terms = $wgContLang->convertForSearchResult( $matches->termMatches() ); + $terms = MediaWikiServices::getInstance()->getContentLanguage()-> + convertForSearchResult( $matches->termMatches() ); $titles = []; $count = 0; $limit = $params['limit']; @@ -397,13 +399,14 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { // If we have more than one engine the list of available sorts is // difficult to represent. For now don't expose it. - $alternatives = MediaWiki\MediaWikiServices::getInstance() + $services = MediaWiki\MediaWikiServices::getInstance(); + $alternatives = $services ->getSearchEngineConfig() ->getSearchTypes(); if ( count( $alternatives ) == 1 ) { $this->allowedParams['sort'] = [ ApiBase::PARAM_DFLT => 'relevance', - ApiBase::PARAM_TYPE => MediaWiki\MediaWikiServices::getInstance() + ApiBase::PARAM_TYPE => $services ->newSearchEngine() ->getValidSorts(), ];