MediaWiki  REL1_19
UserDupes Class Reference

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

List of all members.

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

Detailed Description

Look for duplicate user table entries and optionally prune them.

Definition at line 31 of file userDupes.inc.


Constructor & Destructor Documentation

UserDupes::__construct ( &$  database,
outputCallback 
)

Definition at line 38 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:
$doDeletebool: pass true to actually remove things from the database; false to just check.
Returns:
bool

Definition at line 98 of file userDupes.inc.

References $count, echo, examine(), getDupes(), hasUniqueIndex(), lock(), out(), unlock(), and wfWikiID().

Referenced by clearDupes().

Here is the call graph for this function:

Here is the caller graph for this function:

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 80 of file userDupes.inc.

References checkDupes().

Here is the call graph for this function:

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:
$useridint
Returns:
int
Access:
private

Definition at line 264 of file userDupes.inc.

References editCountOn(), and newSchema().

Referenced by examine().

Here is the call graph for this function:

Here is the caller graph for this function:

UserDupes::editCountOn ( table,
field,
userid 
)

Count the number of hits on a given table for this account.

Parameters:
$tablestring
$fieldstring
$useridint
Returns:
int
Access:
private

Definition at line 281 of file userDupes.inc.

Referenced by editCount().

Here is the caller graph for this function:

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:
$namestring
$doDeletebool
Access:
private

Definition at line 215 of file userDupes.inc.

References $result, editCount(), out(), reassignEdits(), and trimAccount().

Referenced by checkDupes().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Returns:
array
Access:
private

Definition at line 192 of file userDupes.inc.

References $result, and $user.

Referenced by checkDupes().

Here is the caller graph for this function:

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

Returns:
bool

Definition at line 56 of file userDupes.inc.

References out().

Referenced by checkDupes().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Access:
private

Definition at line 156 of file userDupes.inc.

References newSchema().

Referenced by checkDupes().

Here is the call graph for this function:

Here is the caller graph for this function:

UserDupes::lockTable ( table)

Definition at line 168 of file userDupes.inc.

Returns:
bool
Access:
private

Definition at line 176 of file userDupes.inc.

References MWInit\classExists().

Referenced by editCount(), lock(), and reassignEdits().

Here is the call graph for this function:

Here is the caller graph for this function:

UserDupes::out ( str) [private]

Output some text via the output callback provided.

Parameters:
$strString Text to print

Definition at line 47 of file userDupes.inc.

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

Here is the caller graph for this function:

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

Definition at line 294 of file userDupes.inc.

References newSchema(), and reassignEditsOn().

Referenced by examine().

Here is the call graph for this function:

Here is the caller graph for this function:

UserDupes::reassignEditsOn ( table,
field,
from,
to 
)
Parameters:
$tablestring
$fieldstring
$fromint
$toint
Access:
private

Definition at line 310 of file userDupes.inc.

References out().

Referenced by reassignEdits().

Here is the call graph for this function:

Here is the caller graph for this function:

UserDupes::trimAccount ( userid)

Remove a user account line.

Parameters:
$useridint
Access:
private

Definition at line 324 of file userDupes.inc.

References out().

Referenced by examine().

Here is the call graph for this function:

Here is the caller graph for this function:

Access:
private

Definition at line 183 of file userDupes.inc.

Referenced by checkDupes().

Here is the caller graph for this function:


Member Data Documentation

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.


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