MediaWiki master
MediaWiki\User\Registration\UserRegistrationLookup Class Reference

Public Member Functions

 __construct (ServiceOptions $options, private readonly ObjectFactory $objectFactory)
 
 getFirstRegistration (UserIdentity $user)
 Find the first registration timestamp for a given user.
 
 getFirstRegistrationBatch (iterable $users)
 Get the first registration timestamp for a batch of users.
 
 getRegistration (UserIdentity $user, string $type=LocalUserRegistrationProvider::TYPE)
 
 isRegistered (string $type)
 Is a registration provider registered?
 
 setCachedRegistration (UserIdentity $user, string|null|false $timestamp, string $type=LocalUserRegistrationProvider::TYPE)
 Sets the cached registration timestamp for a given user.
 

Detailed Description

Since
1.41

Definition at line 16 of file UserRegistrationLookup.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\Registration\UserRegistrationLookup::__construct ( ServiceOptions $options,
private readonly ObjectFactory $objectFactory )

Member Function Documentation

◆ getFirstRegistration()

MediaWiki\User\Registration\UserRegistrationLookup::getFirstRegistration ( UserIdentity $user)

Find the first registration timestamp for a given user.

Note this invokes all registered providers.

Parameters
UserIdentity$user
Returns
string|null Earliest registration timestamp (TS::MW), null if not available.

Definition at line 127 of file UserRegistrationLookup.php.

◆ getFirstRegistrationBatch()

MediaWiki\User\Registration\UserRegistrationLookup::getFirstRegistrationBatch ( iterable $users)

Get the first registration timestamp for a batch of users.

This invokes all registered providers and doesn't use caching.

Parameters
iterable<UserIdentity>$users
Returns
string[]|null[] Map of registration timestamps in MediaWiki format keyed by user ID. The timestamp may be null for users without a stored registration timestamp and for anonymous users.

Definition at line 154 of file UserRegistrationLookup.php.

◆ getRegistration()

MediaWiki\User\Registration\UserRegistrationLookup::getRegistration ( UserIdentity $user,
string $type = LocalUserRegistrationProvider::TYPE )
Parameters
UserIdentity$userUser for which registration should be fetched.
string$typeName of a registered registration provider
Returns
string|null|false Registration timestamp (TS::MW), null if not available or false if it cannot be fetched (anonymous users, for example).

Definition at line 80 of file UserRegistrationLookup.php.

References MediaWiki\User\UserIdentity\isRegistered().

◆ isRegistered()

MediaWiki\User\Registration\UserRegistrationLookup::isRegistered ( string $type)

Is a registration provider registered?

See also
MainConfigSchema::UserRegistrationLookupProviders
Parameters
string$type
Returns
bool

Definition at line 51 of file UserRegistrationLookup.php.

◆ setCachedRegistration()

MediaWiki\User\Registration\UserRegistrationLookup::setCachedRegistration ( UserIdentity $user,
string|null|false $timestamp,
string $type = LocalUserRegistrationProvider::TYPE )

Sets the cached registration timestamp for a given user.

Can only be used to set the date for registered users. If the size of the cache exceeds CACHE_MAX_SIZE, the oldest entry is evicted.

Definition at line 101 of file UserRegistrationLookup.php.


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