X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FmigrateComments.php;h=cdecab03c3fdcb9bd2d6be74d61ee8f02aa7df80;hb=1f907d500a257a8af6b7d67072843a1ab4d3becf;hp=9d4e2615c0c981779ddd216f7f5e1e02d9e8c28a;hpb=f739a8f368ab64d63a2f21d15caf2caa766d6fc5;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/migrateComments.php b/maintenance/migrateComments.php index 9d4e2615c0..cdecab03c3 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() ) { @@ -204,8 +205,9 @@ class MigrateComments extends LoggedUpdateMaintenance { $next = "$field > $value OR $field = $value AND ($next)"; } } - $prompt = join( ' ', array_reverse( $prompt ) ); + $prompt = implode( ' ', 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}" ] ] ); @@ -287,5 +290,5 @@ class MigrateComments extends LoggedUpdateMaintenance { } } -$maintClass = "MigrateComments"; +$maintClass = MigrateComments::class; require_once RUN_MAINTENANCE_IF_MAIN;