MediaWiki REL1_39
MediaWiki\User\ActorNormalization Interface Reference

Service for dealing with the actor table. More...

Inheritance diagram for MediaWiki\User\ActorNormalization:

Public Member Functions

 acquireActorId (UserIdentity $user, IDatabase $dbw)
 Attempt to assign an actor ID to the given $user If it is already assigned, return the existing ID.
 
 findActorId (UserIdentity $user, IDatabase $db)
 Find the actor_id of the given $user.
 
 findActorIdByName (string $name, IDatabase $db)
 Find the actor_id for the given name.
 
 getActorById (int $actorId, IDatabase $db)
 Find an actor by $id.
 
 getUnknownActor ()
 In case all reasonable attempts of initializing a proper actor from the database have failed, entities can be attributed to special 'Unknown user' actor.
 
 newActorFromRow (stdClass $row)
 Instantiate a new UserIdentity object based on a $row from the actor table.
 
 newActorFromRowFields ( $userId, $name, $actorId)
 Instantiate a new UserIdentity object based on field values from a DB row.
 

Detailed Description

Service for dealing with the actor table.

Since
1.36

Definition at line 32 of file ActorNormalization.php.

Member Function Documentation

◆ acquireActorId()

MediaWiki\User\ActorNormalization::acquireActorId ( UserIdentity $user,
IDatabase $dbw )

Attempt to assign an actor ID to the given $user If it is already assigned, return the existing ID.

Parameters
UserIdentity$user
IDatabase$dbwThe database connection to acquire the ID from. The database must correspond to the wiki this ActorNormalization is bound to.
Returns
int greater then 0
Exceptions
CannotCreateActorExceptionif no actor ID has been assigned to this $user

Implemented in MediaWiki\User\ActorStore.

◆ findActorId()

MediaWiki\User\ActorNormalization::findActorId ( UserIdentity $user,
IDatabase $db )

Find the actor_id of the given $user.

Parameters
UserIdentity$user
IDatabase$dbThe database connection to operate on. The database must correspond to the wiki this ActorNormalization is bound to.
Returns
int|null

Implemented in MediaWiki\User\ActorStore.

◆ findActorIdByName()

MediaWiki\User\ActorNormalization::findActorIdByName ( string $name,
IDatabase $db )

Find the actor_id for the given name.

Parameters
string$name
IDatabase$dbThe database connection to operate on. The database must correspond to the wiki this ActorNormalization is bound to.
Returns
int|null

◆ getActorById()

MediaWiki\User\ActorNormalization::getActorById ( int $actorId,
IDatabase $db )

Find an actor by $id.

Parameters
int$actorId
IDatabase$dbThe database connection to operate on. The database must correspond to the wiki this ActorNormalization is bound to.
Returns
UserIdentity|null Returns null if no actor with this $actorId exists in the database.

Implemented in MediaWiki\User\ActorStore.

◆ getUnknownActor()

MediaWiki\User\ActorNormalization::getUnknownActor ( )

In case all reasonable attempts of initializing a proper actor from the database have failed, entities can be attributed to special 'Unknown user' actor.

Returns
UserIdentity

Implemented in MediaWiki\User\ActorStore.

◆ newActorFromRow()

MediaWiki\User\ActorNormalization::newActorFromRow ( stdClass $row)

Instantiate a new UserIdentity object based on a $row from the actor table.

Use this method when an actor row was already fetched from the DB via a join. This method just constructs a new instance and does not try fetching missing values from the DB again, use UserIdentityLookup for that.

Parameters
stdClass$rowwith the following fields:
  • int actor_id
  • string actor_name
  • int|null actor_user
Returns
UserIdentity
Exceptions
InvalidArgumentException

Implemented in MediaWiki\User\ActorStore.

◆ newActorFromRowFields()

MediaWiki\User\ActorNormalization::newActorFromRowFields ( $userId,
$name,
$actorId )

Instantiate a new UserIdentity object based on field values from a DB row.

Until ActorMigration is completed, the actor table joins alias actor field names to legacy field names. This method is convenience to construct the UserIdentity based on legacy field names. It's more relaxed with typing then ::newFromRow to better support legacy code, so always prefer ::newFromRow in new code. Eventually, once ActorMigration is completed and all queries use explicit join with actor table, this method will be deprecated and removed.

Exceptions
InvalidArgumentException
Parameters
int | null$userId
string | null$name
int | null$actorId
Returns
UserIdentity

Implemented in MediaWiki\User\ActorStore.


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