MediaWiki REL1_34
RenameuserSQL Class Reference

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

Collaboration diagram for RenameuserSQL:

Public Member Functions

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

Static Public Member Functions

static actorMigrationWriteNew ()
 Indicate whether we should write new actor fields.
 
static actorMigrationWriteOld ()
 Indicate whether we should still write old user fields.
 

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.
 
string $old
 The old username.
 
array $tables
 The tables => fields to be updated.
 
array $tablesJob
 tables => fields to be updated in a deferred job
 
integer $uid
 The user ID.
 
const CONTRIB_JOB = 500
 Users with more than this number of edits will have their rename operation deferred via the job queue.
 
const NAME_COL = 0
 
const TIME_COL = 2
 
const UID_COL = 1
 

Protected Member Functions

 debug ( $msg)
 

Static Private Member Functions

static lockUserAndGetId ( $name)
 

Private Attributes

string $debugPrefix = ''
 A prefix to use in all debug log messages.
 
string $reason = ''
 Reason to be used in the log entry.
 
User $renamer
 User object of the user performing the rename, for logging purposes.
 

Detailed Description

Class which performs the actual renaming of users.

Definition at line 8 of file RenameuserSQL.php.

Constructor & Destructor Documentation

◆ __construct()

RenameuserSQL::__construct ( $old,
$new,
$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

Definition at line 101 of file RenameuserSQL.php.

References $new, $old, $renamer, $uid, and wfQueriesMustScale().

Member Function Documentation

◆ actorMigrationWriteNew()

static RenameuserSQL::actorMigrationWriteNew ( )
static

Indicate whether we should write new actor fields.

Returns
bool

Definition at line 427 of file RenameuserSQL.php.

References MIGRATION_OLD, and SCHEMA_COMPAT_WRITE_NEW.

◆ actorMigrationWriteOld()

static RenameuserSQL::actorMigrationWriteOld ( )
static

Indicate whether we should still write old user fields.

Returns
bool

Definition at line 405 of file RenameuserSQL.php.

References MIGRATION_NEW, and SCHEMA_COMPAT_WRITE_OLD.

Referenced by CleanupArchiveUserText\execute(), RenameUserCleanup\execute(), and RenameUserJob\run().

◆ debug()

RenameuserSQL::debug ( $msg)
protected

Definition at line 182 of file RenameuserSQL.php.

References wfDebugLog().

Referenced by rename().

◆ lockUserAndGetId()

static RenameuserSQL::lockUserAndGetId ( $name)
staticprivate
Parameters
string$nameCurrent wiki local user name
Returns
integer Returns 0 if no row was found

Definition at line 391 of file RenameuserSQL.php.

References DB_MASTER, and wfGetDB().

◆ rename()

RenameuserSQL::rename ( )

Do the rename operation.

Returns
true

Definition at line 193 of file RenameuserSQL.php.

References $job, $new, $old, $res, $uid, $wgUpdateRowsPerJob, DB_MASTER, debug(), Job\factory(), SpecialLog\getLogTypesOnUser(), NAME_COL, NS_USER, TIME_COL, UID_COL, and wfGetDB().

Member Data Documentation

◆ $checkIfUserExists

bool 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.

Access:\n private

Definition at line 55 of file RenameuserSQL.php.

◆ $debugPrefix

string RenameuserSQL::$debugPrefix = ''
private

A prefix to use in all debug log messages.

Definition at line 76 of file RenameuserSQL.php.

◆ $new

string RenameuserSQL::$new

The new username.

Access:\n private

Definition at line 23 of file RenameuserSQL.php.

Referenced by __construct(), and rename().

◆ $old

string RenameuserSQL::$old

The old username.

Access:\n private

Definition at line 15 of file RenameuserSQL.php.

Referenced by __construct(), and rename().

◆ $reason

string RenameuserSQL::$reason = ''
private

Reason to be used in the log entry.

Definition at line 69 of file RenameuserSQL.php.

◆ $renamer

User RenameuserSQL::$renamer
private

User object of the user performing the rename, for logging purposes.

Definition at line 62 of file RenameuserSQL.php.

Referenced by __construct().

◆ $tables

array RenameuserSQL::$tables

The tables => fields to be updated.

Access:\n private

Definition at line 39 of file RenameuserSQL.php.

◆ $tablesJob

array RenameuserSQL::$tablesJob

tables => fields to be updated in a deferred job

Definition at line 46 of file RenameuserSQL.php.

◆ $uid

integer RenameuserSQL::$uid

The user ID.

Access:\n private

Definition at line 31 of file RenameuserSQL.php.

Referenced by __construct(), and rename().

◆ CONTRIB_JOB

const RenameuserSQL::CONTRIB_JOB = 500

Users with more than this number of edits will have their rename operation deferred via the job queue.

Definition at line 82 of file RenameuserSQL.php.

◆ NAME_COL

const RenameuserSQL::NAME_COL = 0

Definition at line 85 of file RenameuserSQL.php.

Referenced by rename().

◆ TIME_COL

const RenameuserSQL::TIME_COL = 2

Definition at line 87 of file RenameuserSQL.php.

Referenced by rename().

◆ UID_COL

const RenameuserSQL::UID_COL = 1

Definition at line 86 of file RenameuserSQL.php.

Referenced by rename().


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