MediaWiki master
|
Service to read or write data in the actor table. More...
Inherits MediaWiki\User\UserIdentityLookup, and MediaWiki\User\ActorNormalization.
Public Member Functions | |
__construct (ILoadBalancer $loadBalancer, UserNameUtils $userNameUtils, TempUserConfig $tempUserConfig, LoggerInterface $logger, HideUserUtils $hideUserUtils, $wikiId=WikiAwareEntity::LOCAL) | |
acquireActorId (UserIdentity $user, IDatabase $dbw) | |
Attempt to assign an actor ID to the given $user. | |
acquireSystemActorId (UserIdentity $user, IDatabase $dbw) | |
Attempt to assign an ID to an actor for a system user. | |
createNewActor (UserIdentity $user, IDatabase $dbw) | |
Create a new actor for the given $user. | |
deleteActor (UserIdentity $actor, IDatabase $dbw) | |
Delete the actor from the actor table. | |
deleteUserIdentityFromCache (UserIdentity $actor) | |
findActorId (UserIdentity $user, IReadableDatabase $db) | |
Find the actor_id of the given $user. | |
findActorIdByName ( $name, IReadableDatabase $db) | |
Find the actor_id of the given $name. | |
getActorById (int $actorId, IReadableDatabase $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. | |
getUserIdentityByName (string $name, int $queryFlags=IDBAccessObject::READ_NORMAL) | |
Find an actor by $name. | |
getUserIdentityByUserId (int $userId, int $queryFlags=IDBAccessObject::READ_NORMAL) | |
Find an actor by $userId. | |
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. | |
newSelectQueryBuilder ( $dbOrQueryFlags=IDBAccessObject::READ_NORMAL) | |
Returns a specialized SelectQueryBuilder for querying the UserIdentity objects. | |
normalizeUserName (string $name) | |
Returns a canonical form of user name suitable for storage. | |
setAllowCreateIpActors (bool $allow) | |
![]() | |
findActorIdByName (string $name, IReadableDatabase $db) | |
Find the actor_id for the given name. | |
Public Attributes | |
const | UNKNOWN_USER_NAME = 'Unknown user' |
Service to read or write data in the actor table.
Definition at line 44 of file ActorStore.php.
MediaWiki\User\ActorStore::__construct | ( | ILoadBalancer | $loadBalancer, |
UserNameUtils | $userNameUtils, | ||
TempUserConfig | $tempUserConfig, | ||
LoggerInterface | $logger, | ||
HideUserUtils | $hideUserUtils, | ||
$wikiId = WikiAwareEntity::LOCAL ) |
ILoadBalancer | $loadBalancer | |
UserNameUtils | $userNameUtils | |
TempUserConfig | $tempUserConfig | |
LoggerInterface | $logger | |
HideUserUtils | $hideUserUtils | |
string | false | $wikiId |
Definition at line 71 of file ActorStore.php.
MediaWiki\User\ActorStore::acquireActorId | ( | UserIdentity | $user, |
IDatabase | $dbw ) |
Attempt to assign an actor ID to the given $user.
If it is already assigned, return the existing ID.
UserIdentity | $user | |
IDatabase | $dbw | The database connection to acquire the ID from. The database must correspond to ActorStore's wiki ID. |
CannotCreateActorException | if no actor ID has been assigned to this $user |
Implements MediaWiki\User\ActorNormalization.
Definition at line 413 of file ActorStore.php.
MediaWiki\User\ActorStore::acquireSystemActorId | ( | UserIdentity | $user, |
IDatabase | $dbw ) |
Attempt to assign an ID to an actor for a system user.
If an actor ID already exists, return it.
UserIdentity | $user | |
IDatabase | $dbw |
CannotCreateActorException | if the existing actor is associated with registered user. |
Definition at line 506 of file ActorStore.php.
MediaWiki\User\ActorStore::createNewActor | ( | UserIdentity | $user, |
IDatabase | $dbw ) |
Create a new actor for the given $user.
If an actor with this name already exists, this method throws.
UserIdentity | $user | |
IDatabase | $dbw |
CannotCreateActorException | if an actor with this name already exist. |
Definition at line 466 of file ActorStore.php.
MediaWiki\User\ActorStore::deleteActor | ( | UserIdentity | $actor, |
IDatabase | $dbw ) |
Delete the actor from the actor table.
UserIdentity | $actor | |
IDatabase | $dbw |
Definition at line 566 of file ActorStore.php.
MediaWiki\User\ActorStore::deleteUserIdentityFromCache | ( | UserIdentity | $actor | ) |
UserIdentity | $actor |
Definition at line 194 of file ActorStore.php.
MediaWiki\User\ActorStore::findActorId | ( | UserIdentity | $user, |
IReadableDatabase | $db ) |
Find the actor_id of the given $user.
UserIdentity | $user | |
IReadableDatabase | $db | The database connection to operate on. The database must correspond to ActorStore's wiki ID. |
Implements MediaWiki\User\ActorNormalization.
Definition at line 311 of file ActorStore.php.
MediaWiki\User\ActorStore::findActorIdByName | ( | $name, | |
IReadableDatabase | $db ) |
Find the actor_id of the given $name.
string | $name | |
IReadableDatabase | $db | The database connection to operate on. The database must correspond to ActorStore's wiki ID. |
Definition at line 347 of file ActorStore.php.
MediaWiki\User\ActorStore::getActorById | ( | int | $actorId, |
IReadableDatabase | $db ) |
Find an actor by $id.
int | $actorId | |
IReadableDatabase | $db | The database connection to operate on. The database must correspond to ActorStore's wiki ID. |
Implements MediaWiki\User\ActorNormalization.
Definition at line 206 of file ActorStore.php.
MediaWiki\User\ActorStore::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.
Implements MediaWiki\User\ActorNormalization.
Definition at line 695 of file ActorStore.php.
MediaWiki\User\ActorStore::getUserIdentityByName | ( | string | $name, |
int | $queryFlags = IDBAccessObject::READ_NORMAL ) |
Find an actor by $name.
string | $name | |
int | $queryFlags | one of IDBAccessObject constants |
Implements MediaWiki\User\UserIdentityLookup.
Definition at line 234 of file ActorStore.php.
MediaWiki\User\ActorStore::getUserIdentityByUserId | ( | int | $userId, |
int | $queryFlags = IDBAccessObject::READ_NORMAL ) |
Find an actor by $userId.
int | $userId | |
int | $queryFlags | one of IDBAccessObject constants |
Implements MediaWiki\User\UserIdentityLookup.
Definition at line 257 of file ActorStore.php.
MediaWiki\User\ActorStore::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.
stdClass | $row | with the following fields:
|
InvalidArgumentException |
Implements MediaWiki\User\ActorNormalization.
Definition at line 107 of file ActorStore.php.
MediaWiki\User\ActorStore::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.
InvalidArgumentException |
int | null | $userId | |
string | null | $name | |
int | null | $actorId |
Implements MediaWiki\User\ActorNormalization.
Definition at line 150 of file ActorStore.php.
MediaWiki\User\ActorStore::newSelectQueryBuilder | ( | $dbOrQueryFlags = IDBAccessObject::READ_NORMAL | ) |
Returns a specialized SelectQueryBuilder for querying the UserIdentity objects.
IReadableDatabase | int | $dbOrQueryFlags | The database connection to perform the query on, or one of IDBAccessObject::READ_* constants. |
Implements MediaWiki\User\UserIdentityLookup.
Definition at line 714 of file ActorStore.php.
MediaWiki\User\ActorStore::normalizeUserName | ( | string | $name | ) |
Returns a canonical form of user name suitable for storage.
string | $name |
Definition at line 595 of file ActorStore.php.
MediaWiki\User\ActorStore::setAllowCreateIpActors | ( | bool | $allow | ) |
bool | $allow |
Definition at line 740 of file ActorStore.php.
const MediaWiki\User\ActorStore::UNKNOWN_USER_NAME = 'Unknown user' |
Definition at line 46 of file ActorStore.php.