MediaWiki  REL1_22
Job Class Reference

Class to both describe a background job and handle jobs. More...

Inheritance diagram for Job:
Collaboration diagram for Job:

List of all members.

Public Member Functions

 __construct ($command, $title, $params=false, $id=0)
 allowRetries ()
 getDeduplicationInfo ()
 Subclasses may need to override this to make duplication detection work.
 getId ()
 getLastError ()
 getParams ()
 getReleaseTimestamp ()
 getRootJobParams ()
 getTitle ()
 getType ()
 hasRootJobParams ()
 ignoreDuplicates ()
 insert ()
 Insert a single job into the queue.
 run ()
 Run the job.
 toString ()

Static Public Member Functions

static batchInsert ($jobs)
 Batch-insert a group of jobs into the queue.
static factory ($command, Title $title, $params=false, $id=0)
 Create the appropriate object to handle a specific job.
static newRootJobParams ($key)
static pop ()
 Pop a job off the front of the queue.
static pop_type ($type)
 Pop a job of a certain type.
static safeBatchInsert ($jobs)
 Insert a group of jobs into the queue.

Public Attributes

 $command
 $error
 $id
Array $metadata = array()
 Additional queue metadata *.
 $params
 $removeDuplicates
Title $title

Protected Member Functions

 setLastError ($error)

Detailed Description

Class to both describe a background job and handle jobs.

The queue aspects of this class are now deprecated.

Definition at line 30 of file Job.php.


Constructor & Destructor Documentation

Job::__construct ( command,
title,
params = false,
id = 0 
)
Parameters:
$command
$title
$paramsarray|bool
$idint

Definition at line 140 of file Job.php.


Member Function Documentation

Returns:
bool Whether this job can be retried on failure by job runners
Since:
1.21

Reimplemented in PublishStashedFileJob, and AssembleUploadChunksJob.

Definition at line 199 of file Job.php.

static Job::batchInsert ( jobs) [static]

Batch-insert a group of jobs into the queue.

This will be wrapped in a transaction with a forced commit.

This may add duplicate at insert time, but they will be removed later on, when the first one is popped.

Parameters:
array$jobsof Job objects
Returns:
bool
Deprecated:
since 1.21

Definition at line 87 of file Job.php.

static Job::factory ( command,
Title title,
params = false,
id = 0 
) [static]

Create the appropriate object to handle a specific job.

Parameters:
string$commandJob command
$titleTitle: Associated title
array | bool$paramsJob parameters
int$idJob identifier
Exceptions:
MWException
Returns:
Job

Definition at line 67 of file Job.php.

Referenced by DoubleRedirectJob\run().

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
Since:
1.21

Reimplemented in RefreshLinksJob2, PublishStashedFileJob, AssembleUploadChunksJob, and RefreshLinksJob.

Definition at line 212 of file Job.php.

Returns:
integer May be 0 for jobs stored outside the DB
Deprecated:
since 1.22

Definition at line 153 of file Job.php.

Definition at line 316 of file Job.php.

Returns:
array

Definition at line 174 of file Job.php.

Referenced by DuplicateJob\newFromJob().

Returns:
integer|null UNIX timestamp to delay running this job until, otherwise null
Since:
1.22

Definition at line 182 of file Job.php.

See also:
JobQueue::deduplicateRootJob()
Returns:
Array
Since:
1.21

Definition at line 247 of file Job.php.

Referenced by RefreshLinksJob2\getSingleTitleJobs(), and RefreshLinksJob2\run().

Returns:
Title

Definition at line 167 of file Job.php.

Referenced by DuplicateJob\newFromJob().

Returns:
string

Definition at line 160 of file Job.php.

Referenced by DuplicateJob\newFromJob().

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

Definition at line 263 of file Job.php.

Returns:
bool Whether only one of each identical set of jobs should be run

Definition at line 191 of file Job.php.

Insert a single job into the queue.

Returns:
bool true on success
Deprecated:
since 1.21

Definition at line 273 of file Job.php.

static Job::newRootJobParams ( key) [static]
See also:
JobQueue::deduplicateRootJob()
Parameters:
string$keyA key that identifies the task
Returns:
Array
Since:
1.21

Definition at line 235 of file Job.php.

Referenced by HTMLCacheUpdate\doUpdate(), and JobQueueTest\testRootDeduplication().

static Job::pop ( ) [static]

Pop a job off the front of the queue.

This is subject to $wgJobTypesExcludedFromDefaultQueue.

Returns:
Job or false if there's no jobs
Deprecated:
since 1.21

Definition at line 126 of file Job.php.

static Job::pop_type ( type) [static]

Pop a job of a certain type.

This tries less hard than pop() to actually find a job; it may be adversely affected by concurrent job runners.

Parameters:
$typestring
Returns:
Job|bool Returns false if there are no jobs
Deprecated:
since 1.21

Definition at line 115 of file Job.php.

static Job::safeBatchInsert ( jobs) [static]

Insert a group of jobs into the queue.

Same as batchInsert() but does not commit and can thus be rolled-back as part of a larger transaction. However, large batches of jobs can cause slave lag.

Parameters:
array$jobsof Job objects
Returns:
bool
Deprecated:
since 1.21

Definition at line 102 of file Job.php.

Job::setLastError ( error) [protected]
Returns:
string

Definition at line 280 of file Job.php.


Member Data Documentation

Job::$command

Definition at line 35 of file Job.php.

Job::$error

Definition at line 35 of file Job.php.

Array Job::$metadata = array()

Additional queue metadata *.

Definition at line 41 of file Job.php.

Job::$removeDuplicates

Definition at line 35 of file Job.php.


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