MediaWiki REL1_30
JobQueueSecondTestQueue.php
Go to the documentation of this file.
1<?php
2
19
23 private $mainQueue;
24
28 private $debugQueue;
29
30 protected function __construct( array $params ) {
31 if ( !isset( $params['mainqueue'] ) ) {
32 throw new MWException( "mainqueue parameter must be provided to the debug queue" );
33 }
34
35 if ( !isset( $params['debugqueue'] ) ) {
36 throw new MWException( "debugqueue parameter must be provided to the debug queue" );
37 }
38
39 $conf = [ 'wiki' => $params['wiki'], 'type' => $params['type'] ];
40 $this->mainQueue = JobQueue::factory( $params['mainqueue'] + $conf );
41 $this->debugQueue = JobQueue::factory( $params['debugqueue'] + $conf );
42
43 // We need to construct parent after creating the main and debug queue
44 // because super constructor calls some methods we delegate to the main queue.
45 parent::__construct( $params );
46 }
47
53 protected function supportedOrders() {
54 return $this->mainQueue->supportedOrders();
55 }
56
62 protected function optimalOrder() {
63 return $this->mainQueue->optimalOrder();
64 }
65
71 protected function supportsDelayedJobs() {
72 return $this->mainQueue->supportsDelayedJobs();
73 }
74
79 protected function doIsEmpty() {
80 return $this->mainQueue->doIsEmpty();
81 }
82
87 protected function doGetSize() {
88 return $this->mainQueue->doGetSize();
89 }
90
95 protected function doGetAcquiredCount() {
96 return $this->mainQueue->doGetAcquiredCount();
97 }
98
103 protected function doGetDelayedCount() {
104 return $this->mainQueue->doGetDelayedCount();
105 }
106
111 protected function doGetAbandonedCount() {
112 return $this->mainQueue->doGetAbandonedCount();
113 }
114
120 protected function doBatchPush( array $jobs, $flags ) {
121 $this->mainQueue->doBatchPush( $jobs, $flags );
122
123 try {
124 $this->debugQueue->doBatchPush( $jobs, $flags );
125 } catch ( Exception $exception ) {
126 MWExceptionHandler::logException( $exception );
127 }
128 }
129
134 protected function doPop() {
135 return $this->mainQueue->doPop();
136 }
137
143 protected function doAck( Job $job ) {
144 return $this->mainQueue->doAck( $job );
145 }
146
154 return $this->mainQueue->doDeduplicateRootJob( $job );
155 }
156
162 protected function doIsRootJobOldDuplicate( Job $job ) {
163 return $this->mainQueue->doIsRootJobOldDuplicate( $job );
164 }
165
170 protected function getRootJobCacheKey( $signature ) {
171 return $this->mainQueue->getRootJobCacheKey( $signature );
172 }
173
179 protected function doDelete() {
180 return $this->mainQueue->doDelete();
181 }
182
187 protected function doWaitForBackups() {
188 $this->mainQueue->doWaitForBackups();
189 }
190
195 protected function doFlushCaches() {
196 $this->mainQueue->doFlushCaches();
197 }
198
207 public function getAllQueuedJobs() {
208 return $this->mainQueue->getAllQueuedJobs();
209 }
210
219 public function getAllDelayedJobs() {
220 return $this->mainQueue->getAllDelayedJobs();
221 }
222
233 public function getAllAcquiredJobs() {
234 return $this->mainQueue->getAllAcquiredJobs();
235 }
236
244 public function getAllAbandonedJobs() {
245 return $this->mainQueue->getAllAbandonedJobs();
246 }
247
254 public function getCoalesceLocationInternal() {
255 return $this->mainQueue->getCoalesceLocationInternal();
256 }
257
263 protected function doGetSiblingQueuesWithJobs( array $types ) {
264 return $this->mainQueue->doGetSiblingQueuesWithJobs( $types );
265 }
266
272 protected function doGetSiblingQueueSizes( array $types ) {
273 return $this->mainQueue->doGetSiblingQueueSizes( $types );
274 }
275
279 protected function assertNotReadOnly() {
280 $this->mainQueue->assertNotReadOnly();
281 }
282}
A wrapper for the JobQueue that delegates all the method calls to a single, main queue,...
getAllAcquiredJobs()
Get an iterator to traverse over all claimed jobs in this queue.
doDeduplicateRootJob(IJobSpecification $job)
getAllDelayedJobs()
Get an iterator to traverse over all delayed jobs in this queue.
supportsDelayedJobs()
Find out if delayed jobs are supported for configuration validation.
getAllQueuedJobs()
Get an iterator to traverse over all available jobs in this queue.
getAllAbandonedJobs()
Get an iterator to traverse over all abandoned jobs in this queue.
getCoalesceLocationInternal()
Do not use this function outside of JobQueue/JobQueueGroup.
supportedOrders()
Get the allowed queue orders for configuration validation.
optimalOrder()
Get the default queue order to use if configuration does not specify one.
Class to handle enqueueing and running of background jobs.
Definition JobQueue.php:31
static factory(array $params)
Get a job queue object of the specified type.
Definition JobQueue.php:108
Class to both describe a background job and handle jobs.
Definition Job.php:31
MediaWiki exception.
the array() calling protocol came about after MediaWiki 1.4rc1.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition hooks.txt:2805
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37
Job queue task description interface.
if(count( $args)< 1) $job
$params