MediaWiki
master
|
Public Member Functions | |
__construct (ILoadBalancer $loadBalancer, UserNameUtils $userNameUtils, LoggerInterface $logger, $wikiId=WikiAwareEntity::LOCAL) | |
acquireActorId (UserIdentity $user, IDatabase $dbw=null) | |
Attempt to assign an actor ID to the given $user If it is already assigned, return the existing ID. More... | |
findActorId (UserIdentity $user, IDatabase $db) | |
Find the actor_id of the given $user. More... | |
findActorIdByName ( $name, IDatabase $db) | |
Find the actor_id of the given $name. More... | |
getActorById (int $actorId, IDatabase $db) | |
Find an actor by $id. More... | |
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. More... | |
getUserIdentityByName (string $name, int $queryFlags=self::READ_NORMAL) | |
Find an actor by $name. More... | |
getUserIdentityByUserId (int $userId, int $queryFlags=self::READ_NORMAL) | |
Find an actor by $userId. More... | |
newActorFromRow (stdClass $row) | |
Instantiate a new UserIdentity object based on a $row from the actor table. More... | |
newActorFromRowFields ( $userId, $name, $actorId) | |
Instantiate a new UserIdentity object based on field values from a DB row. More... | |
newSelectQueryBuilder (IDatabase $db=null) | |
Returns a specialized SelectQueryBuilder for querying the UserIdentity objects. More... | |
normalizeUserName (string $name, $rigor=UserNameUtils::RIGOR_NONE) | |
Returns a canonical form of user name suitable for storage. More... | |
![]() | |
findActorIdByName (string $name, IDatabase $db) | |
Find the actor_id for the given name. More... | |
Public Attributes | |
const | UNKNOWN_USER_NAME = 'Unknown user' |
![]() | |
const | READ_NONE = -1 |
Constants for object loading bitfield flags (higher => higher QoS) More... | |
Private Member Functions | |
addUserIdentityToCache (int $actorId, UserIdentity $actor) | |
attachActorId (UserIdentity $user, int $id) | |
Attach the actor ID to $user for backwards compatibility. More... | |
checkDatabaseDomain (IDatabase $db) | |
Throws an exception if the given database connection does not belong to the wiki this RevisionStore is bound to. More... | |
findActorIdInternal (string $name, IDatabase $db, array $queryOptions=[]) | |
Find actor_id of the given $user using the passed $db connection. More... | |
getDBConnectionRefForQueryFlags (int $queryFlags) | |
newSelectQueryBuilderForQueryFlags ( $queryFlags) | |
Returns a specialized SelectQueryBuilder for querying the UserIdentity objects. More... | |
Private Attributes | |
MapCacheLRU | $actorsByActorId |
int actor ID => [ UserIdentity, int actor ID ] More... | |
MapCacheLRU | $actorsByName |
string user name => [ UserIdentity, int actor ID ] More... | |
MapCacheLRU | $actorsByUserId |
int user ID => [ UserIdentity, int actor ID ] More... | |
ILoadBalancer | $loadBalancer |
LoggerInterface | $logger |
UserNameUtils | $userNameUtils |
string false | $wikiId |
const | LOCAL_CACHE_SIZE = 5 |
Definition at line 43 of file ActorStore.php.
MediaWiki\User\ActorStore::__construct | ( | ILoadBalancer | $loadBalancer, |
UserNameUtils | $userNameUtils, | ||
LoggerInterface | $logger, | ||
$wikiId = WikiAwareEntity::LOCAL |
|||
) |
ILoadBalancer | $loadBalancer | |
UserNameUtils | $userNameUtils | |
LoggerInterface | $logger | |
string | false | $wikiId |
Definition at line 76 of file ActorStore.php.
References MediaWiki\User\ActorStore\$loadBalancer, MediaWiki\User\ActorStore\$logger, MediaWiki\User\ActorStore\$userNameUtils, and MediaWiki\User\ActorStore\$wikiId.
MediaWiki\User\ActorStore::acquireActorId | ( | UserIdentity | $user, |
IDatabase | $dbw = null |
||
) |
Attempt to assign an actor ID to the given $user If it is already assigned, return the existing ID.
UserIdentity | $user | |
IDatabase | null | $dbw | The database connection to acquire the ID from. The database must correspond to ActorStore's wiki ID. If not given, an appropriate database connection will acquired from the LoadBalancer provided to the constructor. Not providing a database connection triggers a deprecation warning! In the future, this parameter will be required. |
CannotCreateActorException | if no actor ID has been assigned to this $user |
Implements MediaWiki\User\ActorNormalization.
Definition at line 423 of file ActorStore.php.
References MediaWiki\User\ActorStore\attachActorId(), MediaWiki\User\ActorStore\checkDatabaseDomain(), MediaWiki\User\ActorStore\findActorIdInternal(), MediaWiki\User\ActorStore\getDBConnectionRefForQueryFlags(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), MediaWiki\User\ActorStore\newActorFromRowFields(), MediaWiki\User\ActorStore\normalizeUserName(), and wfDeprecatedMsg().
Referenced by MediaWiki\User\ActorStore\getUnknownActor().
|
private |
int | $actorId | |
UserIdentity | $actor |
Definition at line 197 of file ActorStore.php.
References MediaWiki\User\UserIdentity\getId(), and MediaWiki\User\UserIdentity\getName().
Referenced by MediaWiki\User\ActorStore\newActorFromRow(), and MediaWiki\User\ActorStore\newActorFromRowFields().
|
private |
Attach the actor ID to $user for backwards compatibility.
UserIdentity | $user | |
int | $id |
Definition at line 303 of file ActorStore.php.
Referenced by MediaWiki\User\ActorStore\acquireActorId(), and MediaWiki\User\ActorStore\findActorId().
|
private |
Throws an exception if the given database connection does not belong to the wiki this RevisionStore is bound to.
IDatabase | $db |
Definition at line 537 of file ActorStore.php.
References Wikimedia\Rdbms\IDatabase\getDomainID().
Referenced by MediaWiki\User\ActorStore\acquireActorId(), MediaWiki\User\ActorStore\getActorById(), and MediaWiki\User\ActorStore\newSelectQueryBuilder().
MediaWiki\User\ActorStore::findActorId | ( | UserIdentity | $user, |
IDatabase | $db | ||
) |
Find the actor_id of the given $user.
UserIdentity | $user | |
IDatabase | $db | The database connection to operate on. The database must correspond to ActorStore's wiki ID. |
Implements MediaWiki\User\ActorNormalization.
Definition at line 319 of file ActorStore.php.
References MediaWiki\User\ActorStore\attachActorId(), MediaWiki\User\ActorStore\findActorIdInternal(), MediaWiki\User\UserIdentity\getName(), and MediaWiki\User\ActorStore\normalizeUserName().
MediaWiki\User\ActorStore::findActorIdByName | ( | $name, | |
IDatabase | $db | ||
) |
Find the actor_id of the given $name.
string | $name | |
IDatabase | $db | The database connection to operate on. The database must correspond to ActorStore's wiki ID. |
Definition at line 353 of file ActorStore.php.
References MediaWiki\User\ActorStore\findActorIdInternal(), and MediaWiki\User\ActorStore\normalizeUserName().
|
private |
Find actor_id of the given $user using the passed $db connection.
string | $name | |
IDatabase | $db | The database connection to operate on. The database must correspond to ActorStore's wiki ID. |
array | $queryOptions |
Definition at line 374 of file ActorStore.php.
References Wikimedia\Rdbms\IDatabase\selectRow().
Referenced by MediaWiki\User\ActorStore\acquireActorId(), MediaWiki\User\ActorStore\findActorId(), and MediaWiki\User\ActorStore\findActorIdByName().
MediaWiki\User\ActorStore::getActorById | ( | int | $actorId, |
IDatabase | $db | ||
) |
Find an actor by $id.
int | $actorId | |
IDatabase | $db | The database connection to operate on. The database must correspond to ActorStore's wiki ID. |
Implements MediaWiki\User\ActorNormalization.
Definition at line 214 of file ActorStore.php.
References MediaWiki\User\ActorStore\checkDatabaseDomain(), MediaWiki\User\ActorStore\newSelectQueryBuilder(), and MediaWiki\User\ActorStore\newSelectQueryBuilderForQueryFlags().
|
private |
int | $queryFlags | a bit field composed of READ_XXX flags |
Definition at line 526 of file ActorStore.php.
References DBAccessObjectUtils\getDBOptions().
Referenced by MediaWiki\User\ActorStore\acquireActorId(), MediaWiki\User\ActorStore\getUnknownActor(), MediaWiki\User\ActorStore\newSelectQueryBuilder(), and MediaWiki\User\ActorStore\newSelectQueryBuilderForQueryFlags().
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 553 of file ActorStore.php.
References MediaWiki\User\ActorStore\acquireActorId(), MediaWiki\User\ActorStore\getDBConnectionRefForQueryFlags(), and MediaWiki\User\ActorStore\getUserIdentityByName().
MediaWiki\User\ActorStore::getUserIdentityByName | ( | string | $name, |
int | $queryFlags = self::READ_NORMAL |
||
) |
Find an actor by $name.
string | $name | |
int | $queryFlags | one of IDBAccessObject constants |
InvalidArgumentException | if non-normalizable actor name is passed. |
Implements MediaWiki\User\UserIdentityLookup.
Definition at line 251 of file ActorStore.php.
References MediaWiki\User\ActorStore\newSelectQueryBuilderForQueryFlags(), and MediaWiki\User\ActorStore\normalizeUserName().
Referenced by MediaWiki\User\ActorStore\getUnknownActor().
MediaWiki\User\ActorStore::getUserIdentityByUserId | ( | int | $userId, |
int | $queryFlags = self::READ_NORMAL |
||
) |
Find an actor by $userId.
int | $userId | |
int | $queryFlags | one of IDBAccessObject constants |
Implements MediaWiki\User\UserIdentityLookup.
Definition at line 279 of file ActorStore.php.
References MediaWiki\User\ActorStore\newSelectQueryBuilderForQueryFlags().
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 109 of file ActorStore.php.
References MediaWiki\User\ActorStore\addUserIdentityToCache(), if, and MediaWiki\User\ActorStore\normalizeUserName().
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 152 of file ActorStore.php.
References MediaWiki\User\ActorStore\addUserIdentityToCache(), and MediaWiki\User\ActorStore\normalizeUserName().
Referenced by MediaWiki\User\ActorStore\acquireActorId().
MediaWiki\User\ActorStore::newSelectQueryBuilder | ( | IDatabase | $db = null | ) |
Returns a specialized SelectQueryBuilder for querying the UserIdentity objects.
IDatabase | null | $db | The database connection to perform the query on. The database must correspond to ActorStore's wiki ID. If not given, an appropriate database connection will acquired from the LoadBalancer provided to the constructor. |
Implements MediaWiki\User\UserIdentityLookup.
Definition at line 587 of file ActorStore.php.
References MediaWiki\User\ActorStore\checkDatabaseDomain(), and MediaWiki\User\ActorStore\getDBConnectionRefForQueryFlags().
Referenced by MediaWiki\User\ActorStore\getActorById(), and MediaWiki\User\ActorStore\newSelectQueryBuilderForQueryFlags().
|
private |
Returns a specialized SelectQueryBuilder for querying the UserIdentity objects.
int | $queryFlags | one of IDBAccessObject constants |
Definition at line 571 of file ActorStore.php.
References MediaWiki\User\ActorStore\getDBConnectionRefForQueryFlags(), and MediaWiki\User\ActorStore\newSelectQueryBuilder().
Referenced by MediaWiki\User\ActorStore\getActorById(), MediaWiki\User\ActorStore\getUserIdentityByName(), and MediaWiki\User\ActorStore\getUserIdentityByUserId().
MediaWiki\User\ActorStore::normalizeUserName | ( | string | $name, |
$rigor = UserNameUtils::RIGOR_NONE |
|||
) |
Returns a canonical form of user name suitable for storage.
string | $name | |
string | $rigor | UserNameUtils::RIGOR_XXX |
Definition at line 507 of file ActorStore.php.
References ExternalUserNames\isExternal().
Referenced by MediaWiki\User\ActorStore\acquireActorId(), MediaWiki\User\ActorStore\findActorId(), MediaWiki\User\ActorStore\findActorIdByName(), MediaWiki\User\ActorStore\getUserIdentityByName(), MediaWiki\User\ActorStore\newActorFromRow(), and MediaWiki\User\ActorStore\newActorFromRowFields().
|
private |
int actor ID => [ UserIdentity, int actor ID ]
Definition at line 62 of file ActorStore.php.
|
private |
string user name => [ UserIdentity, int actor ID ]
Definition at line 68 of file ActorStore.php.
|
private |
int user ID => [ UserIdentity, int actor ID ]
Definition at line 65 of file ActorStore.php.
|
private |
Definition at line 50 of file ActorStore.php.
Referenced by MediaWiki\User\ActorStore\__construct().
|
private |
Definition at line 56 of file ActorStore.php.
Referenced by MediaWiki\User\ActorStore\__construct().
|
private |
Definition at line 53 of file ActorStore.php.
Referenced by MediaWiki\User\ActorStore\__construct().
|
private |
Definition at line 59 of file ActorStore.php.
Referenced by MediaWiki\User\ActorStore\__construct().
|
private |
Definition at line 47 of file ActorStore.php.
const MediaWiki\User\ActorStore::UNKNOWN_USER_NAME = 'Unknown user' |
Definition at line 45 of file ActorStore.php.