MediaWiki  1.28.0
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

UserDupes::__construct ( $database,
  $outputCallback 
)

Definition at line 42 of file userDupes.inc.

References $outputCallback.

Member Function Documentation

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 $count, $name, as, examine(), getDupes(), hasUniqueIndex(), lock(), out(), unlock(), and wfWikiID().

Referenced by 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().

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:
private

Definition at line 265 of file userDupes.inc.

Referenced by 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:
private

Definition at line 216 of file userDupes.inc.

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

Referenced by checkDupes().

UserDupes::getDupes ( )

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

Returns
array
Access:
private

Definition at line 192 of file userDupes.inc.

References $user, and as.

Referenced by checkDupes().

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().

UserDupes::lock ( )

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

Access:
private

Definition at line 168 of file userDupes.inc.

References $tables.

Referenced by checkDupes().

UserDupes::lockTable (   $table)

Definition at line 176 of file userDupes.inc.

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().

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

Definition at line 278 of file userDupes.inc.

References $from, and out().

Referenced by examine().

UserDupes::trimAccount (   $userid)

Remove a user account line.

Parameters
int$userid
Access:
private

Definition at line 292 of file userDupes.inc.

References out().

Referenced by examine().

UserDupes::unlock ( )
Access:
private

Definition at line 183 of file userDupes.inc.

Referenced by checkDupes().

Member Data Documentation

UserDupes::$db
private

Definition at line 36 of file userDupes.inc.

UserDupes::$failed
private

Definition at line 39 of file userDupes.inc.

UserDupes::$outputCallback
private

Definition at line 40 of file userDupes.inc.

Referenced by __construct().

UserDupes::$reassigned
private

Definition at line 37 of file userDupes.inc.

UserDupes::$trimmed
private

Definition at line 38 of file userDupes.inc.


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