X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobQueueSecondTestQueue.php;h=01f467f20b4e75e14177486f4b6b933f879cf0e8;hb=813133743d9ee02c58eb9b6012a9e312742c50e9;hp=4e3409af73b2a1311cf12711a7a8881369875885;hpb=16c80e429be5904fb42a93f260f8de3d18f0c692;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueueSecondTestQueue.php b/includes/jobqueue/JobQueueSecondTestQueue.php index 4e3409af73..01f467f20b 100644 --- a/includes/jobqueue/JobQueueSecondTestQueue.php +++ b/includes/jobqueue/JobQueueSecondTestQueue.php @@ -27,6 +27,11 @@ class JobQueueSecondTestQueue extends JobQueue { */ private $debugQueue; + /** + * @var bool + */ + private $onlyWriteToDebugQueue; + protected function __construct( array $params ) { if ( !isset( $params['mainqueue'] ) ) { throw new MWException( "mainqueue parameter must be provided to the debug queue" ); @@ -39,6 +44,7 @@ class JobQueueSecondTestQueue extends JobQueue { $conf = [ 'wiki' => $params['wiki'], 'type' => $params['type'] ]; $this->mainQueue = JobQueue::factory( $params['mainqueue'] + $conf ); $this->debugQueue = JobQueue::factory( $params['debugqueue'] + $conf ); + $this->onlyWriteToDebugQueue = isset( $params['readonly'] ) ? $params['readonly'] : false; // We need to construct parent after creating the main and debug queue // because super constructor calls some methods we delegate to the main queue. @@ -118,7 +124,9 @@ class JobQueueSecondTestQueue extends JobQueue { * @param int $flags */ protected function doBatchPush( array $jobs, $flags ) { - $this->mainQueue->doBatchPush( $jobs, $flags ); + if ( !$this->onlyWriteToDebugQueue ) { + $this->mainQueue->doBatchPush( $jobs, $flags ); + } try { $this->debugQueue->doBatchPush( $jobs, $flags );