Creates User objects.
More...
|
| __construct (ILoadBalancer $loadBalancer, UserNameUtils $userNameUtils) |
|
| newAnonymous (?string $ip=null) |
| Returns a new anonymous User based on ip.
|
|
| newFromActorId (int $actorId) |
| Factory method for creation from a given actor ID, replacing User::newFromActorId.
|
|
| newFromAnyId (?int $userId, ?string $userName, ?int $actorId=null, $dbDomain=false) |
| Factory method for creation from an ID, name, and/or actor ID, replacing User::newFromAnyId.
|
|
| newFromAuthority (Authority $authority) |
|
| newFromConfirmationCode (string $confirmationCode, int $flags=self::READ_NORMAL) |
| Factory method to fetch the user for a given email confirmation code, replacing User::newFromConfirmationCode.
|
|
| newFromId (int $id) |
| Factory method for creation from a given user ID, replacing User::newFromId.
|
|
| newFromName (string $name, string $validate=self::RIGOR_VALID) |
| Factory method for creating users by name, replacing static User::newFromName.
|
|
| newFromRow ( $row, $data=null) |
|
| newFromUserIdentity (UserIdentity $userIdentity) |
| Factory method for creation fom a given UserIdentity, replacing User::newFromIdentity.
|
|
| newTempPlaceholder () |
| Create a placeholder user for an anonymous user who will be upgraded to a temporary user.
|
|
| newUnsavedTempUser (string $name) |
| Create an unsaved temporary user with a previously acquired name.
|
|
|
const | READ_NONE = -1 |
| Constants for object loading bitfield flags (higher => higher QoS)
|
|
Creates User objects.
- Since
- 1.35
Definition at line 38 of file UserFactory.php.
◆ __construct()
- Parameters
-
ILoadBalancer | $loadBalancer | |
UserNameUtils | $userNameUtils | |
Definition at line 58 of file UserFactory.php.
◆ newAnonymous()
MediaWiki\User\UserFactory::newAnonymous |
( |
?string | $ip = null | ) |
|
Returns a new anonymous User based on ip.
- Since
- 1.35
- Parameters
-
string | null | $ip | IP address |
- Returns
- User
Definition at line 109 of file UserFactory.php.
◆ newFromActorId()
MediaWiki\User\UserFactory::newFromActorId |
( |
int | $actorId | ) |
|
◆ newFromAnyId()
MediaWiki\User\UserFactory::newFromAnyId |
( |
?int | $userId, |
|
|
?string | $userName, |
|
|
?int | $actorId = null, |
|
|
| $dbDomain = false ) |
Factory method for creation from an ID, name, and/or actor ID, replacing User::newFromAnyId.
- Note
- This does not check that the ID, name, and actor ID all correspond to the same user.
- Since
- 1.35
- Parameters
-
?int | $userId | |
?string | $userName | |
?int | $actorId | |
bool | string | $dbDomain | |
- Returns
- User
- Exceptions
-
InvalidArgumentException | if none of userId, userName, and actorId are specified |
Definition at line 205 of file UserFactory.php.
◆ newFromAuthority()
MediaWiki\User\UserFactory::newFromAuthority |
( |
Authority | $authority | ) |
|
- Access: internal
- for transition from User to Authority as performer concept.
- Parameters
-
- Returns
- User
Definition at line 309 of file UserFactory.php.
◆ newFromConfirmationCode()
MediaWiki\User\UserFactory::newFromConfirmationCode |
( |
string | $confirmationCode, |
|
|
int | $flags = self::READ_NORMAL ) |
Factory method to fetch the user for a given email confirmation code, replacing User::newFromConfirmationCode.
This code is generated when an account is created or its e-mail address has changed. If the code is invalid or has expired, returns null.
- Since
- 1.35
- Parameters
-
string | $confirmationCode | |
int | $flags | |
- Returns
- User|null
Definition at line 265 of file UserFactory.php.
◆ newFromId()
MediaWiki\User\UserFactory::newFromId |
( |
int | $id | ) |
|
◆ newFromName()
MediaWiki\User\UserFactory::newFromName |
( |
string | $name, |
|
|
string | $validate = self::RIGOR_VALID ) |
Factory method for creating users by name, replacing static User::newFromName.
This is slightly less efficient than newFromId(), so use newFromId() if you have both an ID and a name handy.
- Note
- unlike User::newFromName, this returns null instead of false for invalid usernames
- Since
- 1.35
-
1.36 returns null instead of false for invalid user names
- Parameters
-
string | $name | Username, validated by Title::newFromText |
string | $validate | Validation strategy, one of the RIGOR_* constants. For no validation, use RIGOR_NONE. |
- Returns
- ?User User object, or null if the username is invalid (e.g. if it contains illegal characters or is an IP address). If the username is not present in the database, the result will be a user object with a name, a user id of 0, and default settings.
Definition at line 84 of file UserFactory.php.
◆ newFromRow()
MediaWiki\User\UserFactory::newFromRow |
( |
| $row, |
|
|
| $data = null ) |
◆ newFromUserIdentity()
MediaWiki\User\UserFactory::newFromUserIdentity |
( |
UserIdentity | $userIdentity | ) |
|
◆ newTempPlaceholder()
MediaWiki\User\UserFactory::newTempPlaceholder |
( |
| ) |
|
Create a placeholder user for an anonymous user who will be upgraded to a temporary user.
This will throw an exception if temp user autocreation is disabled.
- Since
- 1.39
- Returns
- User
Definition at line 324 of file UserFactory.php.
◆ newUnsavedTempUser()
MediaWiki\User\UserFactory::newUnsavedTempUser |
( |
string | $name | ) |
|
Create an unsaved temporary user with a previously acquired name.
- Since
- 1.39
- Parameters
-
- Returns
- User
Definition at line 337 of file UserFactory.php.
The documentation for this class was generated from the following file: