Public Member Functions | |
UserDupes (&$database) | |
hasUniqueIndex () | |
Check if this database's user table has already had a unique user_name index applied. | |
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. | |
checkDupes ($doDelete=false) | |
Checks the database for duplicate user account records in preparation for application of a unique index on the user_name field. | |
lock () | |
We don't want anybody to mess with our stuff. | |
lockTable ($table) | |
newSchema () | |
unlock () | |
getDupes () | |
Grab usernames for which multiple records are present in the database. | |
examine ($name, $doDelete) | |
Examine user records for the given name. | |
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. | |
reassignEdits ($from, $to) | |
reassignEditsOn ($table, $field, $from, $to) | |
trimAccount ($userid) | |
Remove a user account line. | |
Public Attributes | |
$db | |
$reassigned | |
$trimmed | |
$failed |
Definition at line 29 of file userDupes.inc.
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 87 of file userDupes.inc.
References $count, $name, examine(), getDupes(), hasUniqueIndex(), lock(), unlock(), wfOut(), 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.
Definition at line 69 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 260 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 277 of file userDupes.inc.
References $fname.
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 209 of file userDupes.inc.
References $fname, $name, $result, $row, editCount(), reassignEdits(), trimAccount(), and wfOut().
Referenced by checkDupes().
UserDupes::getDupes | ( | ) |
Grab usernames for which multiple records are present in the database.
Definition at line 183 of file userDupes.inc.
References $fname, $result, $row, and $user.
Referenced by checkDupes().
UserDupes::hasUniqueIndex | ( | ) |
Check if this database's user table has already had a unique user_name index applied.
Definition at line 44 of file userDupes.inc.
References $fname, and wfOut().
Referenced by checkDupes().
UserDupes::lock | ( | ) |
We don't want anybody to mess with our stuff.
..
Definition at line 145 of file userDupes.inc.
References $fname, and newSchema().
Referenced by checkDupes().
UserDupes::lockTable | ( | $ | table | ) |
Definition at line 158 of file userDupes.inc.
UserDupes::newSchema | ( | ) |
Definition at line 166 of file userDupes.inc.
Referenced by editCount(), lock(), and reassignEdits().
UserDupes::reassignEdits | ( | $ | from, | |
$ | to | |||
) |
$from | int | |
$to | int |
Definition at line 291 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 307 of file userDupes.inc.
References $fname, and wfOut().
Referenced by reassignEdits().
UserDupes::trimAccount | ( | $ | userid | ) |
Remove a user account line.
$userid | int |
Definition at line 322 of file userDupes.inc.
References $fname, and wfOut().
Referenced by examine().
UserDupes::unlock | ( | ) |
Definition at line 173 of file userDupes.inc.
References $fname.
Referenced by checkDupes().
UserDupes::UserDupes | ( | &$ | database | ) |
UserDupes::$db |
Definition at line 30 of file userDupes.inc.
UserDupes::$failed |
Definition at line 33 of file userDupes.inc.
UserDupes::$reassigned |
Definition at line 31 of file userDupes.inc.
UserDupes::$trimmed |
Definition at line 32 of file userDupes.inc.