summaryrefslogtreecommitdiff
path: root/maintenance/userDupes.inc
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/userDupes.inc')
-rw-r--r--maintenance/userDupes.inc46
1 files changed, 23 insertions, 23 deletions
diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc
index 86b70e3b..2f224c3d 100644
--- a/maintenance/userDupes.inc
+++ b/maintenance/userDupes.inc
@@ -45,7 +45,7 @@ class UserDupes {
$fname = 'UserDupes::hasUniqueIndex';
$info = $this->db->indexInfo( 'user', 'user_name', $fname );
if( !$info ) {
- echo "WARNING: doesn't seem to have user_name index at all!\n";
+ wfOut( "WARNING: doesn't seem to have user_name index at all!\n" );
return false;
}
@@ -92,11 +92,11 @@ class UserDupes {
$this->lock();
- echo "Checking for duplicate accounts...\n";
+ wfOut( "Checking for duplicate accounts...\n" );
$dupes = $this->getDupes();
$count = count( $dupes );
- echo "Found $count accounts with duplicate records on ".wfWikiID().".\n";
+ wfOut( "Found $count accounts with duplicate records on ".wfWikiID().".\n" );
$this->trimmed = 0;
$this->reassigned = 0;
$this->failed = 0;
@@ -106,34 +106,34 @@ class UserDupes {
$this->unlock();
- echo "\n";
+ wfOut( "\n" );
if( $this->reassigned > 0 ) {
if( $doDelete ) {
- echo "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n";
+ wfOut( "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n" );
} else {
- echo "$this->reassigned duplicate accounts need to have edits reassigned.\n";
+ wfOut( "$this->reassigned duplicate accounts need to have edits reassigned.\n" );
}
}
if( $this->trimmed > 0 ) {
if( $doDelete ) {
- echo "$this->trimmed duplicate user records were deleted from ".wfWikiID().".\n";
+ wfOut( "$this->trimmed duplicate user records were deleted from ".wfWikiID().".\n" );
} else {
- echo "$this->trimmed duplicate user accounts were found on ".wfWikiID()." which can be removed safely.\n";
+ wfOut( "$this->trimmed duplicate user accounts were found on ".wfWikiID()." which can be removed safely.\n" );
}
}
if( $this->failed > 0 ) {
- echo "Something terribly awry; $this->failed duplicate accounts were not removed.\n";
+ wfOut( "Something terribly awry; $this->failed duplicate accounts were not removed.\n" );
return false;
}
if( $this->trimmed == 0 || $doDelete ) {
- echo "It is now safe to apply the unique index on user_name.\n";
+ wfOut( "It is now safe to apply the unique index on user_name.\n" );
return true;
} else {
- echo "Run this script again with the --fix option to automatically delete them.\n";
+ wfOut( "Run this script again with the --fix option to automatically delete them.\n" );
return false;
}
}
@@ -215,36 +215,36 @@ class UserDupes {
$firstRow = $this->db->fetchObject( $result );
$firstId = $firstRow->user_id;
- echo "Record that will be used for '$name' is user_id=$firstId\n";
+ wfOut( "Record that will be used for '$name' is user_id=$firstId\n" );
while( $row = $this->db->fetchObject( $result ) ) {
$dupeId = $row->user_id;
- echo "... dupe id $dupeId: ";
+ wfOut( "... dupe id $dupeId: " );
$edits = $this->editCount( $dupeId );
if( $edits > 0 ) {
$this->reassigned++;
- echo "has $edits edits! ";
+ wfOut( "has $edits edits! " );
if( $doDelete ) {
$this->reassignEdits( $dupeId, $firstId );
$newEdits = $this->editCount( $dupeId );
if( $newEdits == 0 ) {
- echo "confirmed cleaned. ";
+ wfOut( "confirmed cleaned. " );
} else {
$this->failed++;
- echo "WARNING! $newEdits remaining edits for $dupeId; NOT deleting user.\n";
+ wfOut( "WARNING! $newEdits remaining edits for $dupeId; NOT deleting user.\n" );
continue;
}
} else {
- echo "(will need to reassign edits on fix)";
+ wfOut( "(will need to reassign edits on fix)" );
}
} else {
- echo "ok, no edits. ";
+ wfOut( "ok, no edits. " );
}
$this->trimmed++;
if( $doDelete ) {
$this->trimAccount( $dupeId );
}
- echo "\n";
+ wfOut( "\n" );
}
$this->db->freeResult( $result );
}
@@ -306,12 +306,12 @@ class UserDupes {
*/
function reassignEditsOn( $table, $field, $from, $to ) {
$fname = 'UserDupes::reassignEditsOn';
- echo "reassigning on $table... ";
+ wfOut( "reassigning on $table... " );
$this->db->update( $table,
array( $field => $to ),
array( $field => $from ),
$fname );
- echo "ok. ";
+ wfOut( "ok. " );
}
/**
@@ -321,9 +321,9 @@ class UserDupes {
*/
function trimAccount( $userid ) {
$fname = 'UserDupes::trimAccount';
- echo "deleting...";
+ wfOut( "deleting..." );
$this->db->delete( 'user', array( 'user_id' => $userid ), $fname );
- echo " ok";
+ wfOut( " ok" );
}
}