$dstKey = $this->getOption( 'dst' );
if ( !isset( $wgJobQueueMigrationConfig[$srcKey] ) ) {
- $this->error( "\$wgJobQueueMigrationConfig not set for '$srcKey'.", 1 );
+ $this->fatalError( "\$wgJobQueueMigrationConfig not set for '$srcKey'." );
} elseif ( !isset( $wgJobQueueMigrationConfig[$dstKey] ) ) {
- $this->error( "\$wgJobQueueMigrationConfig not set for '$dstKey'.", 1 );
+ $this->fatalError( "\$wgJobQueueMigrationConfig not set for '$dstKey'." );
}
$types = ( $this->getOption( 'type' ) === 'all' )
? JobQueueGroup::singleton()->getQueueTypes()
- : array( $this->getOption( 'type' ) );
+ : [ $this->getOption( 'type' ) ];
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
foreach ( $types as $type ) {
- $baseConfig = array( 'type' => $type, 'wiki' => wfWikiID() );
+ $baseConfig = [ 'type' => $type, 'domain' => $dbDomain ];
$src = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$srcKey] );
$dst = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$dstKey] );
protected function copyJobs( JobQueue $src, JobQueue $dst, $jobs ) {
$total = 0;
$totalOK = 0;
- $batch = array();
+ $batch = [];
foreach ( $jobs as $job ) {
++$total;
$batch[] = $job;
- if ( count( $batch ) >= $this->mBatchSize ) {
+ if ( count( $batch ) >= $this->getBatchSize() ) {
$dst->push( $batch );
$totalOK += count( $batch );
- $batch = array();
+ $batch = [];
$dst->waitForBackups();
}
}
$dst->waitForBackups();
}
- return array( $total, $totalOK );
+ return [ $total, $totalOK ];
}
}
-$maintClass = 'CopyJobQueue';
+$maintClass = CopyJobQueue::class;
require_once RUN_MAINTENANCE_IF_MAIN;