MediaWiki master
MediaWiki\User\Options\LocalUserOptionsStore Class Reference

Inherits MediaWiki\User\Options\UserOptionsStore.

Collaboration diagram for MediaWiki\User\Options\LocalUserOptionsStore:

Public Member Functions

 __construct (IConnectionProvider $dbProvider)
 
 fetch (UserIdentity $user, int $recency)
 Fetch all options for a given user from the store.
 
 fetchBatchForUserNames (array $keys, array $userNames)
 Fetch specific options for multiple users from the store.
 
 store (UserIdentity $user, array $updates)
 Process a batch of option updates.
 

Detailed Description

Definition at line 10 of file LocalUserOptionsStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\Options\LocalUserOptionsStore::__construct ( IConnectionProvider $dbProvider)

Definition at line 16 of file LocalUserOptionsStore.php.

Member Function Documentation

◆ fetch()

MediaWiki\User\Options\LocalUserOptionsStore::fetch ( UserIdentity $user,
int $recency )

Fetch all options for a given user from the store.

Note that OptionsStore does not handle fallback to default. Options are either present or absent.

Parameters
UserIdentity$userA user with a non-zero ID
int$recencya bit field composed of READ_XXX flags
Returns
array<string,string>

Implements MediaWiki\User\Options\UserOptionsStore.

Definition at line 20 of file LocalUserOptionsStore.php.

◆ fetchBatchForUserNames()

MediaWiki\User\Options\LocalUserOptionsStore::fetchBatchForUserNames ( array $keys,
array $userNames )

Fetch specific options for multiple users from the store.

Return an array indexed first by option key, and second by user name.

Since
1.44
Parameters
array$keys
array$userNames
Returns
array<string,array<string,string>>

Implements MediaWiki\User\Options\UserOptionsStore.

Definition at line 46 of file LocalUserOptionsStore.php.

◆ store()

MediaWiki\User\Options\LocalUserOptionsStore::store ( UserIdentity $user,
array $updates )

Process a batch of option updates.

The store may assume that fetch() was previously called with a recency sufficient to provide reference values for a differential update. It is the caller's responsibility to manage recency.

Note that OptionsStore does not have a concept of defaults. The store is not required to check whether the value matches the default.

Parameters
UserIdentity$userA user with a non-zero ID
array<string,string|null>$updates A map of option names to new values. If the value is null, the key should be deleted from the store and subsequently not returned from fetch(). Absent keys should be left unchanged.
Returns
bool Whether any change was made

Implements MediaWiki\User\Options\UserOptionsStore.

Definition at line 69 of file LocalUserOptionsStore.php.

References MediaWiki\User\UserIdentity\getId(), MediaWiki\User\Options\UserOptionsManager\isValueEqual(), and MediaWiki\User\Options\UserOptionsManager\MAX_BYTES_OPTION_VALUE.


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