MediaWiki master
MediaWiki\RenameUser\RenameuserSQL Class Reference

Class which performs the actual renaming of users. More...

Public Member Functions

 __construct (string $old, string $new, int $uid, User $renamer, $options=[])
 Constructor.
 
 rename ()
 Do the rename operation.
 
 renameUser ()
 Do the rename operation.
 

Static Public Member Functions

static isPreviouslyRenamedAccount (string $username, IReadableDatabase $db)
 This method does not check log_deleted, and thus will reveal the existence of hidden rename log entries.
 

Public Attributes

bool $checkIfUserExists
 Flag that can be set to false, in case another process has already started the updates and the old username may have already been renamed in the user table.
 
string $new
 The new username of the user being renamed.
 
string $old
 The old username of the user being renamed.
 
array $tables
 The [ tables => fields ] to be updated.
 
array[] $tablesJob
 [ tables => fields ] to be updated in a deferred job
 
int $uid
 The user ID of the user being renamed.
 
const NAME_COL = 0
 
const TIME_COL = 2
 
const UID_COL = 1
 

Protected Member Functions

 debug (string $msg)
 

Detailed Description

Class which performs the actual renaming of users.

Definition at line 27 of file RenameuserSQL.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RenameUser\RenameuserSQL::__construct ( string $old,
string $new,
int $uid,
User $renamer,
$options = [] )

Constructor.

Parameters
string$oldThe old username
string$newThe new username
int$uid
User$renamer
array$optionsOptional extra options. 'reason' - string, reason for the rename 'debugPrefix' - string, prefixed to debug messages 'checkIfUserExists' - bool, whether to update the user table 'derived' - bool, whether to skip updates to shared tables

Definition at line 140 of file RenameuserSQL.php.

References MediaWiki\RenameUser\RenameuserSQL\$new, MediaWiki\RenameUser\RenameuserSQL\$old, MediaWiki\RenameUser\RenameuserSQL\$uid, MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MainConfigNames\UpdateRowsPerJob.

Member Function Documentation

◆ debug()

MediaWiki\RenameUser\RenameuserSQL::debug ( string $msg)
protected

Definition at line 180 of file RenameuserSQL.php.

Referenced by MediaWiki\RenameUser\RenameuserSQL\renameUser().

◆ isPreviouslyRenamedAccount()

static MediaWiki\RenameUser\RenameuserSQL::isPreviouslyRenamedAccount ( string $username,
IReadableDatabase $db )
static

This method does not check log_deleted, and thus will reveal the existence of hidden rename log entries.

This seems unavoidable: we have to reveal that the username can't be registered when someone tries to register it, and there is no other plausible error message we could give. Please review whether that's appropriate for your use case when calling it.

Since
1.47

Definition at line 491 of file RenameuserSQL.php.

◆ rename()

MediaWiki\RenameUser\RenameuserSQL::rename ( )

Do the rename operation.

Deprecated
since 1.44 use renameUser
Returns
bool

Definition at line 192 of file RenameuserSQL.php.

References MediaWiki\RenameUser\RenameuserSQL\renameUser(), and wfDeprecated().

◆ renameUser()

MediaWiki\RenameUser\RenameuserSQL::renameUser ( )

Do the rename operation.

Returns
Status

Definition at line 201 of file RenameuserSQL.php.

References MediaWiki\RenameUser\RenameuserSQL\$old, and MediaWiki\RenameUser\RenameuserSQL\debug().

Referenced by MediaWiki\RenameUser\RenameuserSQL\rename().

Member Data Documentation

◆ $checkIfUserExists

bool MediaWiki\RenameUser\RenameuserSQL::$checkIfUserExists

Flag that can be set to false, in case another process has already started the updates and the old username may have already been renamed in the user table.

Definition at line 69 of file RenameuserSQL.php.

◆ $new

string MediaWiki\RenameUser\RenameuserSQL::$new

The new username of the user being renamed.

Definition at line 40 of file RenameuserSQL.php.

Referenced by MediaWiki\RenameUser\RenameuserSQL\__construct().

◆ $old

string MediaWiki\RenameUser\RenameuserSQL::$old

The old username of the user being renamed.

Definition at line 33 of file RenameuserSQL.php.

Referenced by MediaWiki\RenameUser\RenameuserSQL\__construct(), and MediaWiki\RenameUser\RenameuserSQL\renameUser().

◆ $tables

array MediaWiki\RenameUser\RenameuserSQL::$tables

The [ tables => fields ] to be updated.

Definition at line 54 of file RenameuserSQL.php.

◆ $tablesJob

array [] MediaWiki\RenameUser\RenameuserSQL::$tablesJob

[ tables => fields ] to be updated in a deferred job

Definition at line 61 of file RenameuserSQL.php.

◆ $uid

int MediaWiki\RenameUser\RenameuserSQL::$uid

The user ID of the user being renamed.

Definition at line 47 of file RenameuserSQL.php.

Referenced by MediaWiki\RenameUser\RenameuserSQL\__construct().

◆ NAME_COL

const MediaWiki\RenameUser\RenameuserSQL::NAME_COL = 0

Definition at line 102 of file RenameuserSQL.php.

◆ TIME_COL

const MediaWiki\RenameUser\RenameuserSQL::TIME_COL = 2

Definition at line 104 of file RenameuserSQL.php.

◆ UID_COL

const MediaWiki\RenameUser\RenameuserSQL::UID_COL = 1

Definition at line 103 of file RenameuserSQL.php.


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