Merge "Add @group medium to ApiUploadTest"
[lhc/web/wiklou.git] / maintenance / populateRevisionLength.php
index 4acc579..042790f 100644 (file)
@@ -53,22 +53,23 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance {
                }
 
                $this->output( "Populating rev_len column\n" );
-               $rev = $this->doLenUpdates( 'revision', 'rev_id', 'rev' );
+               $rev = $this->doLenUpdates( 'revision', 'rev_id', 'rev', Revision::selectFields() );
 
                $this->output( "Populating ar_len column\n" );
-               $ar = $this->doLenUpdates( 'archive', 'ar_id', 'ar' );
+               $ar = $this->doLenUpdates( 'archive', 'ar_id', 'ar', Revision::selectArchiveFields() );
 
                $this->output( "rev_len and ar_len population complete [$rev revision rows, $ar archive rows].\n" );
                return true;
        }
 
        /**
-        * @param $table
-        * @param $idCol
-        * @param $prefix
+        * @param string $table
+        * @param string $idCol
+        * @param string $prefix
+        * @param array $fields
         * @return int
         */
-       protected function doLenUpdates( $table, $idCol, $prefix ) {
+       protected function doLenUpdates( $table, $idCol, $prefix, $fields ) {
                $db = $this->getDB( DB_MASTER );
                $start = $db->selectField( $table, "MIN($idCol)", false, __METHOD__ );
                $end = $db->selectField( $table, "MAX($idCol)", false, __METHOD__ );
@@ -81,9 +82,9 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance {
                $blockStart = intval( $start );
                $blockEnd = intval( $start ) + $this->mBatchSize - 1;
                $count = 0;
-               $fields = Revision::selectFields();
+
                while ( $blockStart <= $end ) {
-                       $this->output( "...doing rev_id from $blockStart to $blockEnd\n" );
+                       $this->output( "...doing $idCol from $blockStart to $blockEnd\n" );
                        $res = $db->select(
                                $table,
                                $fields,
@@ -114,9 +115,9 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance {
 
        /**
         * @param $row
-        * @param $table
-        * @param $idCol
-        * @param $prefix
+        * @param string $table
+        * @param string $idCol
+        * @param string $prefix
         * @return bool
         */
        protected function upgradeRow( $row, $table, $idCol, $prefix ) {