57 abstract public function run();
71 if ( isset( $wgJobClasses[
$command] ) ) {
80 throw new InvalidArgumentException(
"Invalid job command '{$command}'" );
94 $this->removeDuplicates =
false;
96 if ( !isset( $this->params[
'requestId'] ) ) {
144 return isset( $this->params[
'jobReleaseTimestamp'] )
154 return isset( $this->metadata[
'timestamp'] )
166 return isset( $this->params[
'requestId'] )
167 ? $this->params[
'requestId']
223 'namespace' => $this->
getTitle()->getNamespace(),
224 'title' => $this->
getTitle()->getDBkey(),
227 if ( is_array( $info[
'params'] ) ) {
229 unset( $info[
'params'][
'rootJobSignature'] );
230 unset( $info[
'params'][
'rootJobTimestamp'] );
232 unset( $info[
'params'][
'jobReleaseTimestamp'] );
234 unset( $info[
'params'][
'requestId'] );
236 ksort( $info[
'params'] );
263 'rootJobIsSelf' =>
true,
264 'rootJobSignature' => sha1( $key ),
276 'rootJobSignature' => isset( $this->params[
'rootJobSignature'] )
277 ? $this->params[
'rootJobSignature']
279 'rootJobTimestamp' => isset( $this->params[
'rootJobTimestamp'] )
280 ? $this->params[
'rootJobTimestamp']
291 return isset( $this->params[
'rootJobSignature'] )
292 && isset( $this->params[
'rootJobTimestamp'] );
300 return $this->
hasRootJobParams() && !empty( $this->params[
'rootJobIsSelf'] );
308 $this->teardownCallbacks[] = $callback;
317 foreach ( $this->teardownCallbacks
as $callback ) {
318 call_user_func( $callback );
337 if ( $this->params ) {
338 foreach ( $this->params
as $key =>
$value ) {
339 if ( $paramString !=
'' ) {
342 if ( is_array(
$value ) ) {
346 if ( $json ===
false || mb_strlen( $json ) > 512 ) {
347 $filteredValue[$k] = gettype( $v ) .
'(...)';
349 $filteredValue[$k] = $v;
352 if ( count( $filteredValue ) <= 10 ) {
357 } elseif ( is_object(
$value ) && !method_exists(
$value,
'__toString' ) ) {
362 if ( mb_strlen(
$value ) > 1024 ) {
363 $flatValue =
"string(" . mb_strlen(
$value ) .
")";
366 $paramString .=
"$key={$flatValue}";
371 foreach ( $this->metadata
as $key =>
$value ) {
372 if ( is_scalar(
$value ) && mb_strlen(
$value ) < 1024 ) {
373 $metaString .= ( $metaString ?
",$key=$value" :
"$key=$value" );
378 if ( is_object( $this->
title ) ) {
379 $s .=
" {$this->title->getPrefixedDBkey()}";
381 if ( $paramString !=
'' ) {
382 $s .=
" $paramString";
384 if ( $metaString !=
'' ) {
385 $s .=
" ($metaString)";
callable[] $teardownCallbacks
static getRequestId()
Get the unique request ID.
addTeardownCallback($callback)
static batchInsert($jobs)
Batch-insert a group of jobs into the queue.
teardown()
Do any final cleanup after run(), deferred updates, and all DB commits happen.
string $error
Text for error that occurred last.
Class to both describe a background job and handle jobs.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
static newRootJobParams($key)
Get "root job" parameters for a task.
Represents a title within MediaWiki.
when a variable name is used in a it is silently declared as a new local masking the global
insert()
Insert a single job into the queue.
$wgJobClasses
Maps jobs to their handling classes; extensions can add to this to provide custom jobs...
ignoreDuplicates()
Whether the queue should reject insertion of this job if a duplicate exists.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfDeprecated($function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
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
static singleton($wiki=false)
__construct($command, $title, $params=false)
bool $removeDuplicates
Expensive jobs may set this to true.
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
static factory($command, Title $title, $params=[])
Create the appropriate object to handle a specific job.
unless you explicitly specified the no dev flag during the install In this case just run composer update Otherwise follow the installation instructions in the PHPUnit Manual the tests runs are controlled with a makefile Run command
array $metadata
Additional queue metadata.
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
array $params
Array of job parameters.
Job queue task description interface.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
wfTimestampOrNull($outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
getDeduplicationInfo()
Subclasses may need to override this to make duplication detection work.