Go to the documentation of this file.
27 use InvalidArgumentException;
86 string $validate = self::RIGOR_VALID
89 $canonicalName = $this->userNameUtils->getCanonical( $name, $validate );
90 if ( $canonicalName ===
false ) {
95 $user->mName = $canonicalName;
96 $user->mFrom =
'name';
97 $user->setItemLoaded(
'name' );
111 $validIp = $this->userNameUtils->
isIP( $ip );
113 $user = $this->
newFromName( $ip, self::RIGOR_NONE );
115 throw new InvalidArgumentException(
'Invalid IP address' );
135 $user->setItemLoaded(
'id' );
149 $user->mActorId = $actorId;
150 $user->mFrom =
'actor';
151 $user->setItemLoaded(
'actor' );
164 if ( $userIdentity instanceof
User ) {
165 return $userIdentity;
169 $userIdentity->
getId() === 0 ?
null : $userIdentity->
getId(),
170 $userIdentity->
getName() ===
'' ?
null : $userIdentity->
getName(),
199 if ( $dbDomain !==
false ) {
205 $user->mFrom =
'defaults';
207 if ( $actorId !==
null ) {
208 $user->mActorId = $actorId;
209 if ( $actorId !== 0 ) {
210 $user->mFrom =
'actor';
215 if ( $userName !==
null && $userName !==
'' ) {
216 $user->mName = $userName;
217 $user->mFrom =
'name';
218 $user->setItemLoaded(
'name' );
221 if ( $userId !==
null ) {
222 $user->mId = $userId;
223 if ( $userId !== 0 ) {
226 $user->setItemLoaded(
'id' );
229 if ( $user->mFrom ===
'defaults' ) {
230 throw new InvalidArgumentException(
231 'Cannot create a user with no name, no ID, and no actor ID'
251 string $confirmationCode,
252 int $flags = self::READ_NORMAL
256 $db = $this->loadBalancer->getConnectionRef( $index );
258 $id = $db->selectField(
262 'user_email_token' => md5( $confirmationCode ),
263 'user_email_token_expires > ' . $db->addQuotes( $db->timestamp() ),
295 if ( $authority instanceof
User ) {
static getDBOptions( $bitfield)
Get an appropriate DB index, options, and fallback DB index for a query.
Interface for database access objects.
static newFromRow( $row, $data=null)
Create a new user object from a user row.
setItemLoaded( $item)
Set that an item has been loaded.
static isIP( $name)
Does the string match an anonymous IP address?
Helper class for DAO classes.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...