X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FuserDupes.inc;h=44a1aab91a26f8f007e1b7d08c89c5fb459e929c;hb=9ed334b55c57fa387cb25bd3a14bc90af345903e;hp=6fb29be90522e60ec400bfc30cfc9ca4b637b416;hpb=3dc6844ae15512838c9ec70b4903090c2723967f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc index 6fb29be905..44a1aab91a 100644 --- a/maintenance/userDupes.inc +++ b/maintenance/userDupes.inc @@ -1,6 +1,6 @@ * http://www.mediawiki.org/ @@ -158,11 +158,7 @@ class UserDupes { * @access private */ function lock() { - if ( $this->newSchema() ) { - $set = array( 'user', 'revision' ); - } else { - $set = array( 'user', 'cur', 'old' ); - } + $set = array( 'user', 'revision' ); $names = array_map( array( $this, 'lockTable' ), $set ); $tables = implode( ',', $names ); @@ -173,14 +169,6 @@ class UserDupes { return $this->db->tableName( $table ) . ' WRITE'; } - /** - * @return bool - * @access private - */ - function newSchema() { - return MWInit::classExists( 'Revision' ); - } - /** * @access private */ @@ -196,7 +184,7 @@ class UserDupes { function getDupes() { $user = $this->db->tableName( 'user' ); $result = $this->db->query( - "SELECT user_name,COUNT(*) AS n + "SELECT user_name,COUNT(*) AS n FROM $user GROUP BY user_name HAVING n > 1", __METHOD__ ); @@ -266,27 +254,10 @@ class UserDupes { * @access private */ function editCount( $userid ) { - if ( $this->newSchema() ) { - return $this->editCountOn( 'revision', 'rev_user', $userid ); - } else { - return $this->editCountOn( 'cur', 'cur_user', $userid ) + - $this->editCountOn( 'old', 'old_user', $userid ); - } - } - - /** - * Count the number of hits on a given table for this account. - * @param $table string - * @param $field string - * @param $userid int - * @return int - * @access private - */ - function editCountOn( $table, $field, $userid ) { return intval( $this->db->selectField( - $table, + 'revision', 'COUNT(*)', - array( $field => $userid ), + array( 'rev_user' => $userid ), __METHOD__ ) ); } @@ -296,26 +267,10 @@ class UserDupes { * @access private */ function reassignEdits( $from, $to ) { - $set = $this->newSchema() - ? array( 'revision' => 'rev_user' ) - : array( 'cur' => 'cur_user', 'old' => 'old_user' ); - foreach ( $set as $table => $field ) { - $this->reassignEditsOn( $table, $field, $from, $to ); - } - } - - /** - * @param $table string - * @param $field string - * @param $from int - * @param $to int - * @access private - */ - function reassignEditsOn( $table, $field, $from, $to ) { - $this->out( "reassigning on $table... " ); - $this->db->update( $table, - array( $field => $to ), - array( $field => $from ), + $this->out( 'reassigning... ' ); + $this->db->update( 'revision', + array( 'rev_user' => $to ), + array( 'rev_user' => $from ), __METHOD__ ); $this->out( "ok. " ); }