MediaWiki
REL1_19
|
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. | |
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. | |
editCount ($userid) | |
Count the number of edits attributed to this user. | |
editCountOn ($table, $field, $userid) | |
Count the number of hits on a given table for this account. | |
examine ($name, $doDelete) | |
Examine user records for the given name. | |
getDupes () | |
Grab usernames for which multiple records are present in the database. | |
hasUniqueIndex () | |
Check if this database's user table has already had a unique user_name index applied. | |
lock () | |
We don't want anybody to mess with our stuff... | |
lockTable ($table) | |
newSchema () | |
reassignEdits ($from, $to) | |
reassignEditsOn ($table, $field, $from, $to) | |
trimAccount ($userid) | |
Remove a user account line. | |
unlock () | |
Public Attributes | |
$db | |
$failed | |
$reassigned | |
$trimmed | |
Private Member Functions | |
out ($str) | |
Output some text via the output callback provided. | |
Private Attributes | |
$outputCallback |
Look for duplicate user table entries and optionally prune them.
Definition at line 31 of file userDupes.inc.
UserDupes::__construct | ( | &$ | database, |
$ | outputCallback | ||
) |
Definition at line 38 of file userDupes.inc.
References $outputCallback.
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.
$doDelete | bool: pass true to actually remove things from the database; false to just check. |
Definition at line 98 of file userDupes.inc.
References $count, echo, examine(), getDupes(), hasUniqueIndex(), lock(), out(), unlock(), and wfWikiID().
Referenced by 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.
Definition at line 80 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...
$userid | int |
Definition at line 264 of file userDupes.inc.
References editCountOn(), and newSchema().
Referenced by examine().
UserDupes::editCountOn | ( | $ | table, |
$ | field, | ||
$ | userid | ||
) |
Count the number of hits on a given table for this account.
$table | string |
$field | string |
$userid | int |
Definition at line 281 of file userDupes.inc.
Referenced by editCount().
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.
$name | string |
$doDelete | bool |
Definition at line 215 of file userDupes.inc.
References $result, editCount(), out(), reassignEdits(), and trimAccount().
Referenced by checkDupes().
Grab usernames for which multiple records are present in the database.
Definition at line 192 of file userDupes.inc.
References $result, and $user.
Referenced by checkDupes().
Check if this database's user table has already had a unique user_name index applied.
Definition at line 56 of file userDupes.inc.
References out().
Referenced by checkDupes().
UserDupes::lock | ( | ) |
We don't want anybody to mess with our stuff...
Definition at line 156 of file userDupes.inc.
References newSchema().
Referenced by checkDupes().
UserDupes::lockTable | ( | $ | table | ) |
Definition at line 168 of file userDupes.inc.
Definition at line 176 of file userDupes.inc.
References MWInit\classExists().
Referenced by editCount(), lock(), and reassignEdits().
UserDupes::out | ( | $ | str | ) | [private] |
Output some text via the output callback provided.
$str | String Text to print |
Definition at line 47 of file userDupes.inc.
Referenced by checkDupes(), examine(), hasUniqueIndex(), reassignEditsOn(), and trimAccount().
UserDupes::reassignEdits | ( | $ | from, |
$ | to | ||
) |
$from | int |
$to | int |
Definition at line 294 of file userDupes.inc.
References newSchema(), and reassignEditsOn().
Referenced by examine().
UserDupes::reassignEditsOn | ( | $ | table, |
$ | field, | ||
$ | from, | ||
$ | to | ||
) |
$table | string |
$field | string |
$from | int |
$to | int |
Definition at line 310 of file userDupes.inc.
References out().
Referenced by reassignEdits().
UserDupes::trimAccount | ( | $ | userid | ) |
Remove a user account line.
$userid | int |
Definition at line 324 of file userDupes.inc.
References out().
Referenced by examine().
Definition at line 183 of file userDupes.inc.
Referenced by checkDupes().
UserDupes::$db |
Definition at line 32 of file userDupes.inc.
UserDupes::$failed |
Definition at line 35 of file userDupes.inc.
UserDupes::$outputCallback [private] |
Definition at line 36 of file userDupes.inc.
Referenced by __construct().
UserDupes::$reassigned |
Definition at line 33 of file userDupes.inc.
UserDupes::$trimmed |
Definition at line 34 of file userDupes.inc.