MediaWiki  1.28.0
JobQueueAggregator.php
Go to the documentation of this file.
1 <?php
30 abstract class JobQueueAggregator {
32  protected static $instance = null;
33 
37  public function __construct( array $params ) {
38  }
39 
44  final public static function singleton() {
45  global $wgJobQueueAggregator;
46 
47  if ( !isset( self::$instance ) ) {
48  $class = $wgJobQueueAggregator['class'];
49  $obj = new $class( $wgJobQueueAggregator );
50  if ( !( $obj instanceof JobQueueAggregator ) ) {
51  throw new MWException( "Class '$class' is not a JobQueueAggregator class." );
52  }
53  self::$instance = $obj;
54  }
55 
56  return self::$instance;
57  }
58 
64  final public static function destroySingleton() {
65  self::$instance = null;
66  }
67 
75  final public function notifyQueueEmpty( $wiki, $type ) {
76  $ok = $this->doNotifyQueueEmpty( $wiki, $type );
77 
78  return $ok;
79  }
80 
84  abstract protected function doNotifyQueueEmpty( $wiki, $type );
85 
93  final public function notifyQueueNonEmpty( $wiki, $type ) {
94  $ok = $this->doNotifyQueueNonEmpty( $wiki, $type );
95 
96  return $ok;
97  }
98 
102  abstract protected function doNotifyQueueNonEmpty( $wiki, $type );
103 
109  final public function getAllReadyWikiQueues() {
110  $res = $this->doGetAllReadyWikiQueues();
111 
112  return $res;
113  }
114 
118  abstract protected function doGetAllReadyWikiQueues();
119 
125  final public function purge() {
126  $res = $this->doPurge();
127 
128  return $res;
129  }
130 
134  abstract protected function doPurge();
135 
142  protected function findPendingWikiQueues() {
144 
145  $pendingDBs = []; // (job type => (db list))
146  foreach ( $wgLocalDatabases as $db ) {
147  foreach ( JobQueueGroup::singleton( $db )->getQueuesWithJobs() as $type ) {
148  $pendingDBs[$type][] = $db;
149  }
150  }
151 
152  return $pendingDBs;
153  }
154 }
155 
157  protected function doNotifyQueueEmpty( $wiki, $type ) {
158  return true;
159  }
160 
161  protected function doNotifyQueueNonEmpty( $wiki, $type ) {
162  return true;
163  }
164 
165  protected function doGetAllReadyWikiQueues() {
166  return [];
167  }
168 
169  protected function doPurge() {
170  return true;
171  }
172 }
the array() calling protocol came about after MediaWiki 1.4rc1.
Class to handle tracking information about all queues.
notifyQueueNonEmpty($wiki, $type)
Mark a queue as being non-empty.
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
static destroySingleton()
Destroy the singleton instance.
doNotifyQueueEmpty($wiki, $type)
$res
Definition: database.txt:21
$params
purge()
Purge all of the aggregator information.
doNotifyQueueNonEmpty($wiki, $type)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
static singleton($wiki=false)
static JobQueueAggregator $instance
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
$wgLocalDatabases
Other wikis on this site, can be administered from a single developer account.
notifyQueueEmpty($wiki, $type)
Mark a queue as being empty.
doNotifyQueueNonEmpty($wiki, $type)
findPendingWikiQueues()
Get all databases that have a pending job.
getAllReadyWikiQueues()
Get the list of all of the queues with jobs.
__construct(array $params)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2491