MediaWiki REL1_39
MediaWiki\User\BotPasswordStore Class Reference
Inheritance diagram for MediaWiki\User\BotPasswordStore:
Collaboration diagram for MediaWiki\User\BotPasswordStore:

Public Member Functions

 __construct (ServiceOptions $options, CentralIdLookup $centralIdLookup, LBFactory $lbFactory)
 
 deleteBotPassword (BotPassword $botPassword)
 Delete an existing BotPassword in the database.
 
 getByCentralId (int $centralId, string $appId, int $flags=self::READ_NORMAL)
 Load a BotPassword from the database.
 
 getByUser (UserIdentity $userIdentity, string $appId, int $flags=self::READ_NORMAL)
 Load a BotPassword from the database based on a UserIdentity object.
 
 getDatabase (int $db)
 Get a database connection for the bot passwords database.
 
 insertBotPassword (BotPassword $botPassword, Password $password=null)
 Save the new BotPassword to the database.
 
 invalidateUserPasswords (string $username)
 Invalidate all passwords for a user, by name.
 
 newUnsavedBotPassword (array $data, int $flags=self::READ_NORMAL)
 Create an unsaved BotPassword.
 
 removeUserPasswords (string $username)
 Remove all passwords for a user, by name.
 
 updateBotPassword (BotPassword $botPassword, Password $password=null)
 Update an existing BotPassword in the database.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 
- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS)
 

Detailed Description

Author
DannyS712
Since
1.37

Definition at line 45 of file BotPasswordStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\BotPasswordStore::__construct ( ServiceOptions $options,
CentralIdLookup $centralIdLookup,
LBFactory $lbFactory )
Parameters
ServiceOptions$options
CentralIdLookup$centralIdLookup
LBFactory$lbFactory

Definition at line 70 of file BotPasswordStore.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ deleteBotPassword()

MediaWiki\User\BotPasswordStore::deleteBotPassword ( BotPassword $botPassword)

Delete an existing BotPassword in the database.

Parameters
BotPassword$botPassword
Returns
bool

Definition at line 354 of file BotPasswordStore.php.

◆ getByCentralId()

MediaWiki\User\BotPasswordStore::getByCentralId ( int $centralId,
string $appId,
int $flags = self::READ_NORMAL )

Load a BotPassword from the database.

Parameters
int$centralIdfrom CentralIdLookup
string$appId
int$flagsIDBAccessObject read flags
Returns
BotPassword|null

Definition at line 135 of file BotPasswordStore.php.

◆ getByUser()

MediaWiki\User\BotPasswordStore::getByUser ( UserIdentity $userIdentity,
string $appId,
int $flags = self::READ_NORMAL )

Load a BotPassword from the database based on a UserIdentity object.

Parameters
UserIdentity$userIdentity
string$appId
int$flagsIDBAccessObject read flags
Returns
BotPassword|null

Definition at line 111 of file BotPasswordStore.php.

◆ getDatabase()

MediaWiki\User\BotPasswordStore::getDatabase ( int $db)

Get a database connection for the bot passwords database.

Parameters
int$dbIndex of the connection to get, e.g. DB_PRIMARY or DB_REPLICA.
Returns
IDatabase
Access: internal

Definition at line 87 of file BotPasswordStore.php.

References MediaWiki\MainConfigNames\BotPasswordsCluster.

◆ insertBotPassword()

MediaWiki\User\BotPasswordStore::insertBotPassword ( BotPassword $botPassword,
Password $password = null )

Save the new BotPassword to the database.

Access: internal
Parameters
BotPassword$botPassword
Password | null$passwordUse null for an invalid password
Returns
StatusValue if everything worked, the value of the StatusValue is the new token

Definition at line 228 of file BotPasswordStore.php.

References $res.

◆ invalidateUserPasswords()

MediaWiki\User\BotPasswordStore::invalidateUserPasswords ( string $username)

Invalidate all passwords for a user, by name.

Parameters
string$username
Returns
bool Whether any passwords were invalidated

Definition at line 373 of file BotPasswordStore.php.

◆ newUnsavedBotPassword()

MediaWiki\User\BotPasswordStore::newUnsavedBotPassword ( array $data,
int $flags = self::READ_NORMAL )

Create an unsaved BotPassword.

Parameters
array$dataData to use to create the bot password. Keys are:
  • user: (UserIdentity) UserIdentity to create the password for. Overrides username and centralId.
  • username: (string) Username to create the password for. Overrides centralId.
  • centralId: (int) User central ID to create the password for.
  • appId: (string, required) App ID for the password.
  • restrictions: (MWRestrictions, optional) Restrictions.
  • grants: (string[], optional) Grants.
int$flagsIDBAccessObject read flags
Returns
BotPassword|null

Definition at line 168 of file BotPasswordStore.php.

◆ removeUserPasswords()

MediaWiki\User\BotPasswordStore::removeUserPasswords ( string $username)

Remove all passwords for a user, by name.

Parameters
string$username
Returns
bool Whether any passwords were removed

Definition at line 402 of file BotPasswordStore.php.

◆ updateBotPassword()

MediaWiki\User\BotPasswordStore::updateBotPassword ( BotPassword $botPassword,
Password $password = null )

Update an existing BotPassword in the database.

Access: internal
Parameters
BotPassword$botPassword
Password | null$passwordUse null for an invalid password
Returns
StatusValue if everything worked, the value of the StatusValue is the new token

Definition at line 282 of file BotPasswordStore.php.

References $res.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\User\BotPasswordStore::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const BotPasswordsDatabase
Name constant for the BotPasswordsDatabase setting, for use with Config::get()
const EnableBotPasswords
Name constant for the EnableBotPasswords setting, for use with Config::get()
const BotPasswordsCluster
Name constant for the BotPasswordsCluster setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 50 of file BotPasswordStore.php.


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