MediaWiki  1.30.2
UserDupes Class Reference

Look for duplicate user table entries and optionally prune them. More...

Public Member Functions

 __construct (&$database, $outputCallback)
 
 checkDupes ( $doDelete=false)
 Checks the database for duplicate user account records in preparation for application of a unique index on the user_name field. More...
 
 clearDupes ()
 Checks the database for duplicate user account records and remove them in preparation for application of a unique index on the user_name field. More...
 
 editCount ( $userid)
 Count the number of edits attributed to this user. More...
 
 examine ( $name, $doDelete)
 Examine user records for the given name. More...
 
 getDupes ()
 Grab usernames for which multiple records are present in the database. More...
 
 hasUniqueIndex ()
 Check if this database's user table has already had a unique user_name index applied. More...
 
 lock ()
 We don't want anybody to mess with our stuff... More...
 
 lockTable ( $table)
 
 reassignEdits ( $from, $to)
 
 trimAccount ( $userid)
 Remove a user account line. More...
 
 unlock ()
 

Private Member Functions

 out ( $str)
 Output some text via the output callback provided. More...
 

Private Attributes

 $db
 
 $failed
 
 $outputCallback
 
 $reassigned
 
 $trimmed
 

Detailed Description

Look for duplicate user table entries and optionally prune them.

This is still used by our MysqlUpdater at: includes/installer/MysqlUpdater.php

Definition at line 35 of file userDupes.inc.

Constructor & Destructor Documentation

◆ __construct()

UserDupes::__construct ( $database,
  $outputCallback 
)

Definition at line 42 of file userDupes.inc.

References $outputCallback.

Member Function Documentation

◆ checkDupes()

UserDupes::checkDupes (   $doDelete = false)

Checks the database for duplicate user account records in preparation for application of a unique index on the user_name field.

Returns true if the table is clean or if duplicates can be resolved automatically.

Returns false if there are duplicates and resolution was not requested. (If doing resolution, edits may be reassigned.) Status information will be echo'd to stdout.

Parameters
bool$doDeletePass true to actually remove things from the database; false to just check.
Returns
bool

Definition at line 103 of file userDupes.inc.

References $name, as, captcha-old\count, examine(), getDupes(), hasUniqueIndex(), lock(), out(), unlock(), and wfWikiID().

Referenced by clearDupes().

◆ clearDupes()

UserDupes::clearDupes ( )

Checks the database for duplicate user account records and remove them in preparation for application of a unique index on the user_name field.

Returns true if the table is clean or if duplicates have been resolved automatically.

May return false if there are unresolvable problems. Status information will be echo'd to stdout.

Returns
bool

Definition at line 85 of file userDupes.inc.

References checkDupes().

◆ editCount()

UserDupes::editCount (   $userid)

Count the number of edits attributed to this user.

Does not currently check log table or other things where it might show up...

Parameters
int$userid
Returns
int
Access:\n private

Definition at line 265 of file userDupes.inc.

Referenced by examine().

◆ examine()

UserDupes::examine (   $name,
  $doDelete 
)

Examine user records for the given name.

Try to see which record will be the one that actually gets used, then check remaining records for edits. If the dupes have no edits, we can safely remove them.

Parameters
string$name
bool$doDelete
Access:\n private

Definition at line 216 of file userDupes.inc.

References $name, as, editCount(), out(), reassignEdits(), and trimAccount().

Referenced by checkDupes().

◆ getDupes()

UserDupes::getDupes ( )

Grab usernames for which multiple records are present in the database.

Returns
array
Access:\n private

Definition at line 192 of file userDupes.inc.

References $user, and as.

Referenced by checkDupes().

◆ hasUniqueIndex()

UserDupes::hasUniqueIndex ( )

Check if this database's user table has already had a unique user_name index applied.

Returns
bool

Definition at line 60 of file userDupes.inc.

References out().

Referenced by checkDupes().

◆ lock()

UserDupes::lock ( )

We don't want anybody to mess with our stuff...

Access:\n private

Definition at line 168 of file userDupes.inc.

References $tables.

Referenced by checkDupes().

◆ lockTable()

UserDupes::lockTable (   $table)

Definition at line 176 of file userDupes.inc.

◆ out()

UserDupes::out (   $str)
private

Output some text via the output callback provided.

Parameters
string$strText to print

Definition at line 51 of file userDupes.inc.

Referenced by checkDupes(), examine(), hasUniqueIndex(), reassignEdits(), and trimAccount().

◆ reassignEdits()

UserDupes::reassignEdits (   $from,
  $to 
)
Parameters
int$from
int$to
Access:\n private

Definition at line 278 of file userDupes.inc.

References out().

Referenced by examine().

◆ trimAccount()

UserDupes::trimAccount (   $userid)

Remove a user account line.

Parameters
int$userid
Access:\n private

Definition at line 292 of file userDupes.inc.

References out().

Referenced by examine().

◆ unlock()

UserDupes::unlock ( )
Access:\n private

Definition at line 183 of file userDupes.inc.

Referenced by checkDupes().

Member Data Documentation

◆ $db

UserDupes::$db
private

Definition at line 36 of file userDupes.inc.

◆ $failed

UserDupes::$failed
private

Definition at line 39 of file userDupes.inc.

◆ $outputCallback

UserDupes::$outputCallback
private

Definition at line 40 of file userDupes.inc.

Referenced by __construct().

◆ $reassigned

UserDupes::$reassigned
private

Definition at line 37 of file userDupes.inc.

◆ $trimmed

UserDupes::$trimmed
private

Definition at line 38 of file userDupes.inc.


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