22 MainConfigNames::NamespacesToBeSearchedDefault,
23 MainConfigNames::SearchTypeAlternatives,
24 MainConfigNames::SearchType,
41 private $engineMappings;
52 array $engineMappings,
56 $this->options = $options;
57 $this->language = $language;
58 $this->engineMappings = $engineMappings;
59 $this->hookRunner =
new HookRunner( $hookContainer );
60 $this->userOptionsLookup = $userOptionsLookup;
80 foreach ( $this->language->getNamespaces() as $ns => $name ) {
86 $this->hookRunner->onSearchableNamespaces( $arr );
100 if ( $this->userOptionsLookup->getOption( $user,
'searchNs' . $ns ) ) {
114 return array_keys( $this->options->get( MainConfigNames::NamespacesToBeSearchedDefault ),
125 $alternatives = $this->options->get( MainConfigNames::SearchTypeAlternatives ) ?: [];
126 array_unshift( $alternatives, $this->options->get( MainConfigNames::SearchType ) );
128 return $alternatives;
137 return $this->options->get( MainConfigNames::SearchType );
161 return $this->engineMappings;
172 $formatted = array_map( [ $this->language,
'getFormattedNsText' ], $namespaces );
173 foreach ( $formatted as $key => $ns ) {
175 $formatted[$key] =
wfMessage(
'blanknamespace' )->text();
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
A class containing constants representing the names of configuration variables.
Configuration handling class for SearchEngine.
getConfig()
Retrieve original config.
__construct(ServiceOptions $options, Language $language, HookContainer $hookContainer, array $engineMappings, UserOptionsLookup $userOptionsLookup)
getSearchTypes()
Return the search engines we support.
getSearchType()
Return the search engine configured in $wgSearchType, etc.
const CONSTRUCTOR_OPTIONS
getSearchMappings()
Returns the mappings between canonical search name and underlying PHP class.
searchableNamespaces()
Make a list of searchable namespaces and their localized names.
namespacesAsText( $namespaces)
Get a list of namespace names useful for showing in tooltips and preferences.
userNamespaces( $user)
Extract default namespaces to search from the given user's settings, returning a list of index number...
defaultNamespaces()
An array of namespaces indexes to be searched by default.