X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=blobdiff_plain;f=maintenance%2FcopyJobQueue.php;h=7dd40b839fe705efbe0f226cd28e4f8e7b7bb868;hb=bd83a8ca88447ab9dcb2e2a1c8be2cf2ec64157f;hp=42c2dd4d7703819ab8e4192ab26bc47a672dd97a;hpb=5d97e895562ec09d9233e199c21f5af7c6d58c9f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/copyJobQueue.php b/maintenance/copyJobQueue.php index 42c2dd4d77..7dd40b839f 100644 --- a/maintenance/copyJobQueue.php +++ b/maintenance/copyJobQueue.php @@ -48,17 +48,17 @@ class CopyJobQueue extends Maintenance { $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' ) ]; foreach ( $types as $type ) { - $baseConfig = array( 'type' => $type, 'wiki' => wfWikiID() ); + $baseConfig = [ 'type' => $type, 'wiki' => wfWikiID() ]; $src = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$srcKey] ); $dst = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$dstKey] ); @@ -73,14 +73,14 @@ class CopyJobQueue extends Maintenance { 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(); } } @@ -90,7 +90,7 @@ class CopyJobQueue extends Maintenance { $dst->waitForBackups(); } - return array( $total, $totalOK ); + return [ $total, $totalOK ]; } }