29use Wikimedia\Assert\Assert;
40 'NamespacesToBeSearchedDefault'
66 $this->serviceOptions = $options;
68 $this->hookRunner =
new HookRunner( $hookContainer );
75 if ( $this->defaultOptions !== null ) {
79 $this->defaultOptions = $this->serviceOptions->get(
'DefaultUserOptions' );
82 $this->defaultOptions[
'language'] = $this->contentLang->getCode();
83 foreach ( LanguageConverter::$languagesWithVariants as $langCode ) {
84 if ( $langCode === $this->contentLang->getCode() ) {
85 $this->defaultOptions[
'variant'] = $langCode;
87 $this->defaultOptions[
"variant-$langCode"] = $langCode;
94 foreach ( $this->serviceOptions->get(
'NamespacesToBeSearchedDefault' ) as $nsnum => $val ) {
95 $this->defaultOptions[
'searchNs' . $nsnum] = (bool)$val;
97 $this->defaultOptions[
'skin'] =
Skin::normalizeKey( $this->serviceOptions->get(
'DefaultSkin' ) );
99 $this->hookRunner->onUserGetDefaultOptions( $this->defaultOptions );
108 $defOpts = $this->getDefaultOptions();
109 return $defOpts[$opt] ??
null;
118 $defaultOverride =
null,
119 bool $ignoreHidden =
false,
120 int $queryFlags = self::READ_NORMAL
122 $this->verifyUsable( $user, __METHOD__ );
123 return $this->getDefaultOption( $oname ) ?? $defaultOverride;
132 int $queryFlags = self::READ_NORMAL
134 $this->verifyUsable( $user, __METHOD__ );
135 if ( $flags & self::EXCLUDE_DEFAULTS ) {
138 return $this->getDefaultOptions();
150 Assert::precondition( !$user->
isRegistered(),
"$fname called on a registered user " );
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
Base class for multi-variant language conversion.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
The main skin class which provides methods and properties for all other skins.
static normalizeKey( $key)
Normalize a skin preference value to a form that can be loaded.