$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';
__METHOD__,
[
'ORDER BY' => $primaryKey,
- 'LIMIT' => $this->mBatchSize,
+ 'LIMIT' => $this->getBatchSize(),
]
);
if ( !$res->numRows() ) {
$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(
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 = [];
__METHOD__,
[
'ORDER BY' => $primaryKey,
- 'LIMIT' => $this->mBatchSize,
+ 'LIMIT' => $this->getBatchSize(),
],
[ $newTable => [ 'LEFT JOIN', "{$primaryKey}={$newPrimaryKey}" ] ]
);
// Calculate the "next" condition
$next = [ $primaryKey . ' > ' . $dbw->addQuotes( $row->$primaryKey ) ];
$this->output( "... {$row->$primaryKey}\n" );
+ wfWaitForSlaves();
}
$this->output(
}
}
-$maintClass = "MigrateComments";
+$maintClass = MigrateComments::class;
require_once RUN_MAINTENANCE_IF_MAIN;