X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FuserDupes.inc;h=15e1174f3ab3427c4ed0538c3420ae93b277d73e;hb=2700298740509a3f98a9e2cd81cfbce4f67ed114;hp=bd3338a9376f02b47df92ef7aaff214f6373a42f;hpb=f8568f7bd9b749ad2749c79b2e93f63271831341;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc index bd3338a937..15e1174f3a 100644 --- a/maintenance/userDupes.inc +++ b/maintenance/userDupes.inc @@ -61,6 +61,7 @@ class UserDupes { $info = $this->db->indexInfo( 'user', 'user_name', __METHOD__ ); if ( !$info ) { $this->out( "WARNING: doesn't seem to have user_name index at all!\n" ); + return false; } @@ -102,6 +103,7 @@ class UserDupes { function checkDupes( $doDelete = false ) { if ( $this->hasUniqueIndex() ) { echo wfWikiID() . " already has a unique index on its user table.\n"; + return true; } @@ -125,7 +127,8 @@ class UserDupes { if ( $this->reassigned > 0 ) { if ( $doDelete ) { - $this->out( "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n" ); + $this->out( "$this->reassigned duplicate accounts had edits " + . "reassigned to a canonical record id.\n" ); } else { $this->out( "$this->reassigned duplicate accounts need to have edits reassigned.\n" ); } @@ -133,22 +136,27 @@ class UserDupes { if ( $this->trimmed > 0 ) { if ( $doDelete ) { - $this->out( "$this->trimmed duplicate user records were deleted from " . wfWikiID() . ".\n" ); + $this->out( "$this->trimmed duplicate user records were deleted from " + . wfWikiID() . ".\n" ); } else { - $this->out( "$this->trimmed duplicate user accounts were found on " . wfWikiID() . " which can be removed safely.\n" ); + $this->out( "$this->trimmed duplicate user accounts were found on " + . wfWikiID() . " which can be removed safely.\n" ); } } if ( $this->failed > 0 ) { $this->out( "Something terribly awry; $this->failed duplicate accounts were not removed.\n" ); + return false; } if ( $this->trimmed == 0 || $doDelete ) { $this->out( "It is now safe to apply the unique index on user_name.\n" ); + return true; } else { $this->out( "Run this script again with the --fix option to automatically delete them.\n" ); + return false; } } @@ -193,6 +201,7 @@ class UserDupes { foreach ( $result as $row ) { $list[] = $row->user_name; } + return $list; } @@ -285,5 +294,4 @@ class UserDupes { $this->db->delete( 'user', array( 'user_id' => $userid ), __METHOD__ ); $this->out( " ok" ); } - }