MediaWiki  1.33.0
JobSpecification Class Reference

Job queue task description base code. More...

Inheritance diagram for JobSpecification:
Collaboration diagram for JobSpecification:

Public Member Functions

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

Static Public Member Functions

static newFromArray (array $map)
 

Protected Member Functions

 validateParams (array $params)
 

Protected Attributes

array $opts
 
array $params
 Array of job parameters or false if none. More...
 
Title $title
 
string $type
 

Detailed Description

Job queue task description base code.

Example usage:

'null',
array( 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ),
array( 'removeDuplicates' => 1 ),
);
Since
1.23

Definition at line 40 of file JobSpecification.php.

Constructor & Destructor Documentation

◆ __construct()

JobSpecification::__construct (   $type,
array  $params,
array  $opts = [],
Title  $title = null 
)
Parameters
string$type
array$paramsMap of key/values
array$optsMap of key/values; includes 'removeDuplicates'
Title | null$titleOptional descriptive title

Definition at line 59 of file JobSpecification.php.

References $opts, $params, $type, Title\makeTitle(), NS_SPECIAL, captcha-old\opts, title, type, 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 106 of file JobSpecification.php.

References getParams(), getTitle(), and getType().

◆ getParams()

JobSpecification::getParams ( )
Returns
array

Implements IJobSpecification.

Definition at line 92 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 96 of file JobSpecification.php.

References wfTimestampOrNull().

◆ getRootJobParams()

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

Implements IJobSpecification.

Definition at line 124 of file JobSpecification.php.

References null.

◆ getTitle()

JobSpecification::getTitle ( )
Returns
Title Descriptive title (this can simply be informative)

Implements IJobSpecification.

Definition at line 88 of file JobSpecification.php.

References $title.

Referenced by getDeduplicationInfo().

◆ getType()

JobSpecification::getType ( )
Returns
string Job type

Implements IJobSpecification.

Definition at line 84 of file JobSpecification.php.

References $type.

Referenced by getDeduplicationInfo().

◆ hasRootJobParams()

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

Implements IJobSpecification.

Definition at line 131 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 102 of file JobSpecification.php.

References captcha-old\opts.

◆ isRootJob()

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

Implements IJobSpecification.

Definition at line 136 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 161 of file JobSpecification.php.

References $title, and Title\makeTitle().

Referenced by EnqueueJob\run().

◆ toSerializableArray()

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

Definition at line 144 of file JobSpecification.php.

References $opts, $params, $type, and title.

◆ validateParams()

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

Definition at line 74 of file JobSpecification.php.

References $params, and as.

Referenced by __construct().

Member Data Documentation

◆ $opts

array JobSpecification::$opts
protected

Definition at line 51 of file JobSpecification.php.

Referenced by __construct(), and toSerializableArray().

◆ $params

array JobSpecification::$params
protected

Array of job parameters or false if none.

Definition at line 45 of file JobSpecification.php.

Referenced by __construct(), getParams(), toSerializableArray(), and validateParams().

◆ $title

Title JobSpecification::$title
protected

Definition at line 48 of file JobSpecification.php.

Referenced by getTitle(), and newFromArray().

◆ $type

string JobSpecification::$type
protected

Definition at line 42 of file JobSpecification.php.

Referenced by __construct(), getType(), and toSerializableArray().


The documentation for this class was generated from the following file:
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:53
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:576
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
JobQueueGroup\singleton
static singleton( $domain=false)
Definition: JobQueueGroup.php:70
$job
if(count( $args)< 1) $job
Definition: recompressTracked.php:49
JobSpecification
Job queue task description base code.
Definition: JobSpecification.php:40