MediaWiki  master
MediaWiki\User\DefaultOptionsLookup Class Reference

A service class to control default user options. More...

Inheritance diagram for MediaWiki\User\DefaultOptionsLookup:
Collaboration diagram for MediaWiki\User\DefaultOptionsLookup:

Public Member Functions

 __construct (ServiceOptions $options, Language $contentLang, HookContainer $hookContainer, NamespaceInfo $nsInfo)
 
 getDefaultOptions ()
 Combine the language default options with any site-specific options and add the default language variants.
Returns
array
More...
 
 getOption (UserIdentity $user, string $oname, $defaultOverride=null, bool $ignoreHidden=false, int $queryFlags=self::READ_NORMAL)
 Get the user's current setting for a given option.
Parameters
UserIdentity$userThe user to get the option for
string$onameThe option to check
mixed | null$defaultOverrideA default value returned if the option does not exist
bool$ignoreHiddenWhether to ignore the effects of $wgHiddenPrefs
int$queryFlagsA bit field composed of READ_XXX flags
Returns
mixed|null User's current value for the option
See also
getBoolOption()
getIntOption()
More...
 
 getOptions (UserIdentity $user, int $flags=0, int $queryFlags=self::READ_NORMAL)
 Get all user's options.
Parameters
UserIdentity$userThe user to get the option for
int$flagsBitwise combination of: UserOptionsManager::EXCLUDE_DEFAULTS Exclude user options that are set to the default value.
int$queryFlagsA bit field composed of READ_XXX flags
Returns
array
More...
 
- Public Member Functions inherited from MediaWiki\User\UserOptionsLookup
 getBoolOption (UserIdentity $user, string $oname, int $queryFlags=self::READ_NORMAL)
 Get the user's current setting for a given option, as a boolean value. More...
 
 getDefaultOption (string $opt)
 Get a given default option value. More...
 
 getIntOption (UserIdentity $user, string $oname, int $defaultOverride=0, int $queryFlags=self::READ_NORMAL)
 Get the user's current setting for a given option, as an integer value. More...
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 
- Public Attributes inherited from MediaWiki\User\UserOptionsLookup
const EXCLUDE_DEFAULTS = 1
 Exclude user options that are set to their default value. More...
 
- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS) More...
 

Protected Attributes

NamespaceInfo $nsInfo
 

Private Member Functions

 verifyUsable (UserIdentity $user, string $fname)
 Checks if the DefaultOptionsLookup is usable as an instance of UserOptionsLookup. More...
 

Private Attributes

Language $contentLang
 
array null $defaultOptions = null
 Cached default options. More...
 
HookRunner $hookRunner
 
ServiceOptions $serviceOptions
 

Detailed Description

A service class to control default user options.

Since
1.35

Definition at line 37 of file DefaultOptionsLookup.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\DefaultOptionsLookup::__construct ( ServiceOptions  $options,
Language  $contentLang,
HookContainer  $hookContainer,
NamespaceInfo  $nsInfo 
)

Member Function Documentation

◆ getDefaultOptions()

MediaWiki\User\DefaultOptionsLookup::getDefaultOptions ( )

Combine the language default options with any site-specific options and add the default language variants.

Returns
array

Reimplemented from MediaWiki\User\UserOptionsLookup.

Definition at line 85 of file DefaultOptionsLookup.php.

References MediaWiki\User\DefaultOptionsLookup\$defaultOptions.

◆ getOption()

MediaWiki\User\DefaultOptionsLookup::getOption ( UserIdentity  $user,
string  $oname,
  $defaultOverride = null,
bool  $ignoreHidden = false,
int  $queryFlags = self::READ_NORMAL 
)

Get the user's current setting for a given option.

Parameters
UserIdentity$userThe user to get the option for
string$onameThe option to check
mixed | null$defaultOverrideA default value returned if the option does not exist
bool$ignoreHiddenWhether to ignore the effects of $wgHiddenPrefs
int$queryFlagsA bit field composed of READ_XXX flags
Returns
mixed|null User's current value for the option
See also
getBoolOption()
getIntOption()

Reimplemented from MediaWiki\User\UserOptionsLookup.

Definition at line 118 of file DefaultOptionsLookup.php.

◆ getOptions()

MediaWiki\User\DefaultOptionsLookup::getOptions ( UserIdentity  $user,
int  $flags = 0,
int  $queryFlags = self::READ_NORMAL 
)

Get all user's options.

Parameters
UserIdentity$userThe user to get the option for
int$flagsBitwise combination of: UserOptionsManager::EXCLUDE_DEFAULTS Exclude user options that are set to the default value.
int$queryFlagsA bit field composed of READ_XXX flags
Returns
array

Reimplemented from MediaWiki\User\UserOptionsLookup.

Definition at line 132 of file DefaultOptionsLookup.php.

◆ verifyUsable()

MediaWiki\User\DefaultOptionsLookup::verifyUsable ( UserIdentity  $user,
string  $fname 
)
private

Checks if the DefaultOptionsLookup is usable as an instance of UserOptionsLookup.

It only makes sense in an installer context when UserOptionsManager cannot be yet instantiated as the database is not available. Thus, this can only be called for an anon user, calling under different circumstances indicates a bug.

Parameters
UserIdentity$user
string$fname

Definition at line 152 of file DefaultOptionsLookup.php.

References MediaWiki\User\UserIdentity\isRegistered().

Member Data Documentation

◆ $contentLang

Language MediaWiki\User\DefaultOptionsLookup::$contentLang
private

◆ $defaultOptions

array null MediaWiki\User\DefaultOptionsLookup::$defaultOptions = null
private

Cached default options.

Definition at line 58 of file DefaultOptionsLookup.php.

Referenced by MediaWiki\User\DefaultOptionsLookup\getDefaultOptions().

◆ $hookRunner

HookRunner MediaWiki\User\DefaultOptionsLookup::$hookRunner
private

Definition at line 61 of file DefaultOptionsLookup.php.

◆ $nsInfo

NamespaceInfo MediaWiki\User\DefaultOptionsLookup::$nsInfo
protected

◆ $serviceOptions

ServiceOptions MediaWiki\User\DefaultOptionsLookup::$serviceOptions
private

Definition at line 49 of file DefaultOptionsLookup.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\User\DefaultOptionsLookup::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
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()
Access: internal
For use by ServiceWiring

Definition at line 42 of file DefaultOptionsLookup.php.


The documentation for this class was generated from the following file: