X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FmigrateComments.php;h=c35315d71b8d10e7236495d3fde6067587d9cb64;hb=3e16cc20e886a1fc487bad746632ed50bfd7906c;hp=9d4e2615c0c981779ddd216f7f5e1e02d9e8c28a;hpb=fb291fe9d31cba69ae8cebeb5ba04f76f35d7816;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/migrateComments.php b/maintenance/migrateComments.php index 9d4e2615c0..c35315d71b 100644 --- a/maintenance/migrateComments.php +++ b/maintenance/migrateComments.php @@ -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( @@ -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( @@ -287,5 +291,5 @@ class MigrateComments extends LoggedUpdateMaintenance { } } -$maintClass = "MigrateComments"; +$maintClass = MigrateComments::class; require_once RUN_MAINTENANCE_IF_MAIN;