MediaWiki  REL1_21
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 ()
 getRootJobParams ()
 getTitle ()
 getType ()
 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

Reimplemented in PublishStashedFileJob, and AssembleUploadChunksJob.

Definition at line 187 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:
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.

Returns:
Array Map of key/values

Reimplemented in RefreshLinksJob2, PublishStashedFileJob, AssembleUploadChunksJob, and RefreshLinksJob.

Definition at line 196 of file Job.php.

Referenced by JobQueueDB\insertFields().

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

Definition at line 152 of file Job.php.

Referenced by JobQueueDB\doAck(), and DuplicateJob\newFromJob().

Definition at line 284 of file Job.php.

Returns:
Array

Definition at line 225 of file Job.php.

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

Returns:
Title

Definition at line 166 of file Job.php.

Referenced by JobQueueDB\insertFields(), and DuplicateJob\newFromJob().

Returns:
string

Definition at line 159 of file Job.php.

Referenced by JobQueue\ack(), JobQueue\deduplicateRootJob(), JobQueueDB\insertFields(), and DuplicateJob\newFromJob().

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

Definition at line 180 of file Job.php.

Insert a single job into the queue.

Returns:
bool true on success
Deprecated:
1.21

Definition at line 241 of file Job.php.

static Job::newRootJobParams ( key) [static]
Parameters:
string$keyA key that identifies the task
Returns:
Array

Definition at line 215 of file Job.php.

Referenced by HTMLCacheUpdate\doUpdate(), LinksUpdate\queueRecursiveJobs(), 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:
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:
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:
1.21

Definition at line 102 of file Job.php.

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

Definition at line 248 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: