MediaWiki master
JobSpecification Class Reference

Job queue task description base code. More...

Inherits IJobSpecification.

Collaboration diagram for JobSpecification:

Public Member Functions

 __construct ( $type, array $params, array $opts=[], PageReference $page=null)
 
 getDeduplicationInfo ()
 Subclasses may need to override this to make duplication detection work.
 
 getParams ()
 
 getReleaseTimestamp ()
 
 getRootJobParams ()
 
 getType ()
 
 hasRootJobParams ()
 
 ignoreDuplicates ()
 
 isRootJob ()
 
 toSerializableArray ()
 

Static Public Member Functions

static newFromArray (array $map)
 

Protected Member Functions

 validateParams (array $params)
 

Protected Attributes

array $opts
 
PageReference $page
 
array $params
 Array of job parameters or false if none.
 
string $type
 

Detailed Description

Job queue task description base code.

Example usage:

'null',
[ 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ],
[ 'removeDuplicates' => 1 ]
);
MediaWikiServices::getInstance()->getJobQueueGroup()->push( $job )
Job queue task description base code.
if(count( $args)< 1) $job
Since
1.23

Definition at line 41 of file JobSpecification.php.

Constructor & Destructor Documentation

◆ __construct()

JobSpecification::__construct ( $type,
array $params,
array $opts = [],
PageReference $page = null )
Parameters
string$type
array$paramsMap of key/values
array$optsMap of key/values 'removeDuplicates' key - whether to remove duplicate jobs 'removeDuplicatesIgnoreParams' key - array with parameters to ignore for deduplication
PageReference | null$page

Definition at line 62 of file JobSpecification.php.

References $params, MediaWiki\Page\PageReference\getDBkey(), MediaWiki\Page\PageReference\getNamespace(), NS_SPECIAL, and validateParams().

Member Function Documentation

◆ getDeduplicationInfo()

JobSpecification::getDeduplicationInfo ( )

Subclasses may need to override this to make duplication detection work.

The resulting map conveys everything that makes the job unique. This is only checked if ignoreDuplicates() returns true, meaning that duplicate jobs are supposed to be ignored.

Returns
array Map of key/values

Implements IJobSpecification.

Definition at line 121 of file JobSpecification.php.

References getParams(), and getType().

◆ getParams()

JobSpecification::getParams ( )
Returns
array Parameters that specify sources, targets, and options for execution

Implements IJobSpecification.

Definition at line 107 of file JobSpecification.php.

References $params.

Referenced by getDeduplicationInfo().

◆ getReleaseTimestamp()

JobSpecification::getReleaseTimestamp ( )
Returns
int|null UNIX timestamp to delay running this job until, otherwise null

Implements IJobSpecification.

Definition at line 111 of file JobSpecification.php.

References wfTimestampOrNull().

◆ getRootJobParams()

JobSpecification::getRootJobParams ( )
See also
JobQueue::deduplicateRootJob()
Returns
array
Since
1.26

Implements IJobSpecification.

Definition at line 144 of file JobSpecification.php.

◆ getType()

JobSpecification::getType ( )
Returns
string Job type that defines what sort of changes this job makes

Implements IJobSpecification.

Definition at line 103 of file JobSpecification.php.

Referenced by getDeduplicationInfo().

◆ hasRootJobParams()

JobSpecification::hasRootJobParams ( )
See also
JobQueue::deduplicateRootJob()
Returns
bool
Since
1.22

Implements IJobSpecification.

Definition at line 151 of file JobSpecification.php.

Referenced by isRootJob().

◆ ignoreDuplicates()

JobSpecification::ignoreDuplicates ( )
Returns
bool Whether only one of each identical set of jobs should be run

Implements IJobSpecification.

Definition at line 117 of file JobSpecification.php.

◆ isRootJob()

JobSpecification::isRootJob ( )
See also
JobQueue::deduplicateRootJob()
Returns
bool Whether this is job is a root job

Implements IJobSpecification.

Definition at line 156 of file JobSpecification.php.

References hasRootJobParams().

◆ newFromArray()

static JobSpecification::newFromArray ( array $map)
static
Parameters
array$mapField/value map
Returns
JobSpecification
Since
1.25

Definition at line 183 of file JobSpecification.php.

◆ toSerializableArray()

JobSpecification::toSerializableArray ( )
Deprecated
since 1.41
Returns
array Field/value map that can immediately be serialized
Since
1.25

Definition at line 165 of file JobSpecification.php.

References $params, and wfDeprecated().

◆ validateParams()

JobSpecification::validateParams ( array $params)
protected
Parameters
array$params

Definition at line 93 of file JobSpecification.php.

References $params, and validateParams().

Referenced by __construct(), and validateParams().

Member Data Documentation

◆ $opts

array JobSpecification::$opts
protected

Definition at line 52 of file JobSpecification.php.

◆ $page

PageReference JobSpecification::$page
protected

Definition at line 49 of file JobSpecification.php.

◆ $params

array JobSpecification::$params
protected

Array of job parameters or false if none.

Definition at line 46 of file JobSpecification.php.

◆ $type

string JobSpecification::$type
protected

Definition at line 43 of file JobSpecification.php.


The documentation for this class was generated from the following file: