Merge "Changing default copyright notice per WMF Legal's suggestion."
[lhc/web/wiklou.git] / maintenance / userDupes.inc
index 6fb29be..8bd80c9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Helper class for update.php and upgrade1_5.php.
+ * Helper class for update.php.
  *
  * Copyright © 2005 Brion Vibber <brion@pobox.com>
  * 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
         */
@@ -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. " );
        }