X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcopyJobQueue.php;h=e1d697d88de91a7dd5963424acd716215ebd78ef;hb=93eef8d2c568891e5ae13014ff6093e33be088be;hp=a9c9547ec7d83fa2f14156777fb43f047796cd88;hpb=96764fbc9a67fa6040c6123d31ac3746fc6fd98f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/copyJobQueue.php b/maintenance/copyJobQueue.php index a9c9547ec7..e1d697d88d 100644 --- a/maintenance/copyJobQueue.php +++ b/maintenance/copyJobQueue.php @@ -34,7 +34,7 @@ require_once __DIR__ . '/Maintenance.php'; class CopyJobQueue extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Copy jobs from one queue system to another."; + $this->addDescription( 'Copy jobs from one queue system to another.' ); $this->addOption( 'src', 'Key to $wgJobQueueMigrationConfig for source', true, true ); $this->addOption( 'dst', 'Key to $wgJobQueueMigrationConfig for destination', true, true ); $this->addOption( 'type', 'Types of jobs to copy (use "all" for all)', true, true ); @@ -55,10 +55,10 @@ class CopyJobQueue extends Maintenance { $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 ) { $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 ]; } }