MediaWiki  1.30.0
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 }
JobQueueSecondTestQueue\__construct
__construct(array $params)
Definition: JobQueueSecondTestQueue.php:30
JobQueueSecondTestQueue\getAllAcquiredJobs
getAllAcquiredJobs()
Get an iterator to traverse over all claimed jobs in this queue.
Definition: JobQueueSecondTestQueue.php:233
JobQueueSecondTestQueue\supportsDelayedJobs
supportsDelayedJobs()
Find out if delayed jobs are supported for configuration validation.
Definition: JobQueueSecondTestQueue.php:71
JobQueueSecondTestQueue\getAllAbandonedJobs
getAllAbandonedJobs()
Get an iterator to traverse over all abandoned jobs in this queue.
Definition: JobQueueSecondTestQueue.php:244
JobQueueSecondTestQueue\doDeduplicateRootJob
doDeduplicateRootJob(IJobSpecification $job)
Definition: JobQueueSecondTestQueue.php:153
$params
$params
Definition: styleTest.css.php:40
JobQueueSecondTestQueue\$debugQueue
JobQueue $debugQueue
Definition: JobQueueSecondTestQueue.php:28
JobQueueSecondTestQueue\doGetSize
doGetSize()
Definition: JobQueueSecondTestQueue.php:87
php
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:35
Job
Class to both describe a background job and handle jobs.
Definition: Job.php:31
JobQueueSecondTestQueue\doGetAbandonedCount
doGetAbandonedCount()
Definition: JobQueueSecondTestQueue.php:111
JobQueueSecondTestQueue\getRootJobCacheKey
getRootJobCacheKey( $signature)
Definition: JobQueueSecondTestQueue.php:170
MWException
MediaWiki exception.
Definition: MWException.php:26
JobQueueSecondTestQueue\doBatchPush
doBatchPush(array $jobs, $flags)
Definition: JobQueueSecondTestQueue.php:120
JobQueueSecondTestQueue\doGetSiblingQueueSizes
doGetSiblingQueueSizes(array $types)
Definition: JobQueueSecondTestQueue.php:272
JobQueueSecondTestQueue\doGetAcquiredCount
doGetAcquiredCount()
Definition: JobQueueSecondTestQueue.php:95
JobQueueSecondTestQueue\doGetDelayedCount
doGetDelayedCount()
Definition: JobQueueSecondTestQueue.php:103
JobQueueSecondTestQueue\doWaitForBackups
doWaitForBackups()
Definition: JobQueueSecondTestQueue.php:187
JobQueueSecondTestQueue\doPop
doPop()
Definition: JobQueueSecondTestQueue.php:134
JobQueue\factory
static factory(array $params)
Get a job queue object of the specified type.
Definition: JobQueue.php:108
JobQueueSecondTestQueue\doAck
doAck(Job $job)
Definition: JobQueueSecondTestQueue.php:143
JobQueueSecondTestQueue\optimalOrder
optimalOrder()
Get the default queue order to use if configuration does not specify one.
Definition: JobQueueSecondTestQueue.php:62
JobQueueSecondTestQueue
A wrapper for the JobQueue that delegates all the method calls to a single, main queue,...
Definition: JobQueueSecondTestQueue.php:18
$job
if(count( $args)< 1) $job
Definition: recompressTracked.php:47
JobQueueSecondTestQueue\getAllDelayedJobs
getAllDelayedJobs()
Get an iterator to traverse over all delayed jobs in this queue.
Definition: JobQueueSecondTestQueue.php:219
JobQueueSecondTestQueue\doDelete
doDelete()
Definition: JobQueueSecondTestQueue.php:179
JobQueue
Class to handle enqueueing and running of background jobs.
Definition: JobQueue.php:31
JobQueueSecondTestQueue\supportedOrders
supportedOrders()
Get the allowed queue orders for configuration validation.
Definition: JobQueueSecondTestQueue.php:53
JobQueueSecondTestQueue\doIsRootJobOldDuplicate
doIsRootJobOldDuplicate(Job $job)
Definition: JobQueueSecondTestQueue.php:162
JobQueueSecondTestQueue\getCoalesceLocationInternal
getCoalesceLocationInternal()
Do not use this function outside of JobQueue/JobQueueGroup.
Definition: JobQueueSecondTestQueue.php:254
JobQueueSecondTestQueue\assertNotReadOnly
assertNotReadOnly()
Definition: JobQueueSecondTestQueue.php:279
JobQueueSecondTestQueue\doFlushCaches
doFlushCaches()
Definition: JobQueueSecondTestQueue.php:195
JobQueueSecondTestQueue\$mainQueue
JobQueue $mainQueue
Definition: JobQueueSecondTestQueue.php:23
JobQueueSecondTestQueue\getAllQueuedJobs
getAllQueuedJobs()
Get an iterator to traverse over all available jobs in this queue.
Definition: JobQueueSecondTestQueue.php:207
JobQueueSecondTestQueue\doIsEmpty
doIsEmpty()
Definition: JobQueueSecondTestQueue.php:79
IJobSpecification
Job queue task description interface.
Definition: JobSpecification.php:30
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2801
array
the array() calling protocol came about after MediaWiki 1.4rc1.
MWExceptionHandler\logException
static logException( $e, $catcher=self::CAUGHT_BY_OTHER)
Log an exception to the exception log (if enabled).
Definition: MWExceptionHandler.php:613
JobQueueSecondTestQueue\doGetSiblingQueuesWithJobs
doGetSiblingQueuesWithJobs(array $types)
Definition: JobQueueSecondTestQueue.php:263