MediaWiki  master
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)
 getId ()
 getLastError ()
 getParams ()
 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 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
 $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 136 of file Job.php.


Member Function Documentation

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:
$jobsarray of Job objects
Deprecated:
1.21

Definition at line 84 of file Job.php.

Referenced by DoubleRedirectJob\fixRedirects(), FixDoubleRedirects\queueJobs(), LinksUpdate\queueRecursiveJobs(), and RefreshLinksJob2\run().

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

Create the appropriate object to handle a specific job.

Parameters:
$commandString: Job command
$titleTitle: Associated title
$paramsArray|bool: Job parameters
$idInt: Job identifier
Exceptions:
MWException
Returns:
Job

Definition at line 65 of file Job.php.

Referenced by DoubleRedirectJob\run().

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

Definition at line 148 of file Job.php.

Referenced by JobQueueDB\doAck().

Definition at line 218 of file Job.php.

Returns:
array

Definition at line 169 of file Job.php.

Referenced by JobQueueDB\insertFields().

Returns:
Title

Definition at line 162 of file Job.php.

Referenced by JobQueueDB\insertFields().

Returns:
string

Definition at line 155 of file Job.php.

Referenced by JobQueueGroup\ack(), JobQueue\ack(), and JobQueueDB\insertFields().

Returns:
bool

Definition at line 176 of file Job.php.

Insert a single job into the queue.

Returns:
bool true on success
Deprecated:
1.21

Definition at line 185 of file Job.php.

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 122 of file Job.php.

Referenced by UploadFromUrlTest\doAsyncUpload(), UploadFromUrlTest\testClearQueue(), UploadFromUrlTest\testLeaveMessage(), UploadFromUrlTest\testSetupUrlDownload(), and UploadFromUrlTest\testSyncDownload().

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

Definition at line 111 of file Job.php.

Job::run ( ) [abstract]
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:
$jobsarray of Job objects
Deprecated:
1.21

Definition at line 98 of file Job.php.

Job::setLastError ( error) [protected]

Definition at line 214 of file Job.php.

References $error.

Referenced by DoubleRedirectJob\run().

Returns:
string

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

Referenced by setLastError().

Job::$removeDuplicates

Definition at line 35 of file Job.php.


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