31use Wikimedia\Assert\Assert;
49 private $serviceOptions;
58 private $defaultOptions =
null;
76 $this->serviceOptions = $options;
77 $this->contentLang = $contentLang;
78 $this->hookRunner =
new HookRunner( $hookContainer );
86 if ( $this->defaultOptions !== null ) {
87 return $this->defaultOptions;
93 $contentLangCode = $this->contentLang->getCode();
94 $this->defaultOptions[
'language'] = $contentLangCode;
95 $this->defaultOptions[
'variant'] = $contentLangCode;
96 foreach ( LanguageConverter::$languagesWithVariants as $langCode ) {
97 $this->defaultOptions[
"variant-$langCode"] = $langCode;
104 foreach ( $this->nsInfo->getValidNamespaces() as $n ) {
105 $this->defaultOptions[
'searchNs' . $n] = ( $nsSearchDefault[$n] ?? false ) ? 1 : 0;
110 $this->hookRunner->onUserGetDefaultOptions( $this->defaultOptions );
112 return $this->defaultOptions;
121 $defaultOverride =
null,
122 bool $ignoreHidden =
false,
123 int $queryFlags = self::READ_NORMAL
125 $this->verifyUsable( $user, __METHOD__ );
126 return $this->getDefaultOption( $oname ) ?? $defaultOverride;
135 int $queryFlags = self::READ_NORMAL
137 $this->verifyUsable( $user, __METHOD__ );
138 if ( $flags & self::EXCLUDE_DEFAULTS ) {
141 return $this->getDefaultOptions();
152 private function verifyUsable( UserIdentity $user,
string $fname ) {
153 Assert::precondition( !$user->isRegistered(),
"$fname called on a registered user " );
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Base class for multi-variant language conversion.
Base class for language-specific code.
A class containing constants representing the names of configuration variables.
const DefaultUserOptions
Name constant for the DefaultUserOptions setting, for use with Config::get()
const DefaultSkin
Name constant for the DefaultSkin setting, for use with Config::get()
const NamespacesToBeSearchedDefault
Name constant for the NamespacesToBeSearchedDefault setting, for use with Config::get()
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
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.