MediaWiki master
|
A service class to control default user options. More...
Inherits MediaWiki\User\Options\UserOptionsLookup.
Public Member Functions | ||||||||||||||||
__construct (ServiceOptions $options, LanguageCode $contentLang, HookContainer $hookContainer, NamespaceInfo $nsInfo, ConditionalDefaultsLookup $conditionalUserOptionsDefaultsLookup, UserIdentityLookup $userIdentityLookup, UserNameUtils $userNameUtils) | ||||||||||||||||
getDefaultOptions (?UserIdentity $userIdentity=null) | ||||||||||||||||
Combine the language default options with any site-specific and user-specific defaults and add the default language variants.
| ||||||||||||||||
getOption (UserIdentity $user, string $oname, $defaultOverride=null, bool $ignoreHidden=false, int $queryFlags=IDBAccessObject::READ_NORMAL) | ||||||||||||||||
Get the user's current setting for a given option.
| ||||||||||||||||
getOptionBatchForUserNames (array $users, string $key) | ||||||||||||||||
Get a single option for a batch of users, given their names. | ||||||||||||||||
getOptions (UserIdentity $user, int $flags=0, int $queryFlags=IDBAccessObject::READ_NORMAL) | ||||||||||||||||
Get all user's options.
| ||||||||||||||||
![]() | ||||||||||||||||
__construct (UserNameUtils $userNameUtils) | ||||||||||||||||
getBoolOption (UserIdentity $user, string $oname, int $queryFlags=IDBAccessObject::READ_NORMAL) | ||||||||||||||||
Get the user's current setting for a given option, as a boolean value. | ||||||||||||||||
getDefaultOption (string $opt, ?UserIdentity $userIdentity=null) | ||||||||||||||||
Get a given default option value. | ||||||||||||||||
getIntOption (UserIdentity $user, string $oname, int $defaultOverride=0, int $queryFlags=IDBAccessObject::READ_NORMAL) | ||||||||||||||||
Get the user's current setting for a given option, as an integer value. | ||||||||||||||||
isOptionGlobal (UserIdentity $user, string $key) | ||||||||||||||||
Determine if a user option came from a source other than the local store or the defaults. | ||||||||||||||||
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
![]() | |
const | EXCLUDE_DEFAULTS = 1 |
Exclude user options that are set to their default value. | |
const | LOCAL_EXCEPTION_SUFFIX = '-local-exception' |
The suffix appended to preference names for the associated preference that tracks whether they have a local override. | |
Additional Inherited Members | |
![]() | |
getCacheKey (UserIdentity $user) | |
Get a cache key for a user. | |
A service class to control default user options.
Definition at line 41 of file DefaultOptionsLookup.php.
MediaWiki\User\Options\DefaultOptionsLookup::__construct | ( | ServiceOptions | $options, |
LanguageCode | $contentLang, | ||
HookContainer | $hookContainer, | ||
NamespaceInfo | $nsInfo, | ||
ConditionalDefaultsLookup | $conditionalUserOptionsDefaultsLookup, | ||
UserIdentityLookup | $userIdentityLookup, | ||
UserNameUtils | $userNameUtils ) |
ServiceOptions | $options | |
LanguageCode | $contentLang | |
HookContainer | $hookContainer | |
NamespaceInfo | $nsInfo | |
ConditionalDefaultsLookup | $conditionalUserOptionsDefaultsLookup | |
UserIdentityLookup | $userIdentityLookup | |
UserNameUtils | $userNameUtils |
Definition at line 75 of file DefaultOptionsLookup.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions().
MediaWiki\User\Options\DefaultOptionsLookup::getDefaultOptions | ( | ?UserIdentity | $userIdentity = null | ) |
Combine the language default options with any site-specific and user-specific defaults and add the default language variants.
UserIdentity | null | $userIdentity | User to look the default up for; set to null to ignore any user-specific defaults (since 1.42) |
Reimplemented from MediaWiki\User\Options\UserOptionsLookup.
Definition at line 135 of file DefaultOptionsLookup.php.
References getCacheKey().
MediaWiki\User\Options\DefaultOptionsLookup::getOption | ( | UserIdentity | $user, |
string | $oname, | ||
$defaultOverride = null, | |||
bool | $ignoreHidden = false, | ||
int | $queryFlags = IDBAccessObject::READ_NORMAL ) |
Get the user's current setting for a given option.
UserIdentity | $user | The user to get the option for |
string | $oname | The option to check |
mixed | null | $defaultOverride | A default value returned if the option does not exist |
bool | $ignoreHidden | Whether to ignore the effects of $wgHiddenPrefs |
int | $queryFlags | A bit field composed of READ_XXX flags |
Reimplemented from MediaWiki\User\Options\UserOptionsLookup.
Definition at line 162 of file DefaultOptionsLookup.php.
MediaWiki\User\Options\DefaultOptionsLookup::getOptionBatchForUserNames | ( | array | $users, |
string | $key ) |
Get a single option for a batch of users, given their names.
Results are uncached. Use getOption() to get options with a per-user cache.
User names are used because that's what GenderCache has. If you're calling this and you're not GenderCache, consider adding a method taking an array of UserIdentity objects instead.
string[] | $users | A normalized list of usernames |
string | $key | The option to get |
Reimplemented from MediaWiki\User\Options\UserOptionsLookup.
Definition at line 209 of file DefaultOptionsLookup.php.
MediaWiki\User\Options\DefaultOptionsLookup::getOptions | ( | UserIdentity | $user, |
int | $flags = 0, | ||
int | $queryFlags = IDBAccessObject::READ_NORMAL ) |
Get all user's options.
UserIdentity | $user | The user to get the option for |
int | $flags | Bitwise combination of: UserOptionsManager::EXCLUDE_DEFAULTS Exclude user options that are set to the default value. Options that are set to their conditionally default value are not excluded. |
int | $queryFlags | A bit field composed of READ_XXX flags |
Reimplemented from MediaWiki\User\Options\UserOptionsLookup.
Definition at line 176 of file DefaultOptionsLookup.php.
const MediaWiki\User\Options\DefaultOptionsLookup::CONSTRUCTOR_OPTIONS |
Definition at line 46 of file DefaultOptionsLookup.php.