* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Query module to perform full text search within wiki titles and content
*
* @return void
*/
private function run( $resultPageSet = null ) {
- global $wgContLang;
$params = $this->extractRequestParams();
// Extract parameters
}
// 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'];
// 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(),
];