Merge "RCLFilters: support longer page names"
[lhc/web/wiklou.git] / maintenance / migrateComments.php
index 4313806..c000871 100644 (file)
@@ -144,6 +144,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                $primaryKey = (array)$primaryKey;
                $pkFilter = array_flip( $primaryKey );
                $this->output( "Beginning migration of $table.$oldField to $table.$newField\n" );
+               wfWaitForSlaves();
 
                $dbw = $this->getDB( DB_MASTER );
                $next = '1=1';
@@ -161,7 +162,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                                __METHOD__,
                                [
                                        'ORDER BY' => $primaryKey,
-                                       'LIMIT' => $this->mBatchSize,
+                                       'LIMIT' => $this->getBatchSize(),
                                ]
                        );
                        if ( !$res->numRows() ) {
@@ -206,6 +207,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                        }
                        $prompt = join( ' ', array_reverse( $prompt ) );
                        $this->output( "... $prompt\n" );
+                       wfWaitForSlaves();
                }
 
                $this->output(
@@ -222,7 +224,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
         * comment ID field.
         * Blanks the old fields while migrating.
         *
-        * @param string $oldTable Table to migrate
+        * @param string $table Table to migrate
         * @param string $primaryKey Primary key of the table.
         * @param string $oldField Old comment field name
         * @param string $newPrimaryKey Primary key of the new table.
@@ -231,6 +233,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
        protected function migrateToTemp( $table, $primaryKey, $oldField, $newPrimaryKey, $newField ) {
                $newTable = $table . '_comment_temp';
                $this->output( "Beginning migration of $table.$oldField to $newTable.$newField\n" );
+               wfWaitForSlaves();
 
                $dbw = $this->getDB( DB_MASTER );
                $next = [];
@@ -245,7 +248,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                                __METHOD__,
                                [
                                        'ORDER BY' => $primaryKey,
-                                       'LIMIT' => $this->mBatchSize,
+                                       'LIMIT' => $this->getBatchSize(),
                                ],
                                [ $newTable => [ 'LEFT JOIN', "{$primaryKey}={$newPrimaryKey}" ] ]
                        );
@@ -279,6 +282,7 @@ class MigrateComments extends LoggedUpdateMaintenance {
                        // Calculate the "next" condition
                        $next = [ $primaryKey . ' > ' . $dbw->addQuotes( $row->$primaryKey ) ];
                        $this->output( "... {$row->$primaryKey}\n" );
+                       wfWaitForSlaves();
                }
 
                $this->output(