MediaWiki master
MediaWiki\User\UserIdentity Interface Reference

Interface for objects representing user identity. More...

Inherits MediaWiki\DAO\WikiAwareEntity.

Inherited by MediaWiki\User\User, and MediaWiki\User\UserIdentityValue.

Collaboration diagram for MediaWiki\User\UserIdentity:

Public Member Functions

 equals (?UserIdentity $user)
 
 getId ( $wikiId=self::LOCAL)
 
 getName ()
 
 isRegistered ()
 This must be equivalent to getId() != 0 and is provided for code readability.
 
- Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity
 assertWiki ( $wikiId)
 Throws if $wikiId is different from the return value of getWikiId().
 
 getWikiId ()
 Get the ID of the wiki this page belongs to.
 

Additional Inherited Members

- Public Attributes inherited from MediaWiki\DAO\WikiAwareEntity
const LOCAL = false
 Wiki ID value to use with instances that are defined relative to the local wiki.
 

Detailed Description

Interface for objects representing user identity.

This represents the identity of a user in the context of page revisions and log entries.

Note
Starting MediaWiki 1.37, UserIdentity objects should no longer expose an actor ID. The actor ID is considered a storage layer optimization and should not be exposed to and used by application logic. Storage layer code should use ActorNormalization to get an actor ID for a UserIdentity.
Since
1.31

Definition at line 24 of file UserIdentity.php.

Member Function Documentation

◆ equals()

MediaWiki\User\UserIdentity::equals ( ?UserIdentity $user)
Since
1.32
Parameters
UserIdentity | null$user
Returns
bool

Implemented in MediaWiki\User\User, and MediaWiki\User\UserIdentityValue.

◆ getId()

◆ getName()

◆ isRegistered()

MediaWiki\User\UserIdentity::isRegistered ( )

This must be equivalent to getId() != 0 and is provided for code readability.

There is no equivalent utility for checking whether a user is temporary, since that would introduce a service dependency. Use UserIdentityUtils::isTemp (or UserNameUtils::isTemp) instead.

Since
1.34
Returns
bool True if user is registered on this wiki, i.e., has a user ID. False if user is anonymous or has no local account (which can happen when importing).

Implemented in MediaWiki\User\User, and MediaWiki\User\UserIdentityValue.

Referenced by MediaWiki\User\UserEditTracker\clearUserEditCache(), MediaWiki\User\Registration\UserRegistrationLookup\getRegistration(), MediaWiki\Watchlist\WatchlistManager\getTitleNotificationTimestamp(), MediaWiki\Parser\Parser\getUserSig(), MediaWiki\Watchlist\WatchedItemStore\getWatchedItem(), MediaWiki\Watchlist\WatchedItemQueryService\getWatchedItemsForUser(), MediaWiki\User\UserEditTracker\incrementUserEditCount(), MediaWiki\User\UserIdentityUtils\isNamed(), MediaWiki\Watchlist\WatchedItemStore\loadWatchedItemsBatch(), MediaWiki\Watchlist\WatchedItemStore\resetAllNotificationTimestampsForUser(), and MediaWiki\User\UserEditTracker\setCachedUserEditCount().


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