MediaWiki
1.23.0
|
Class to both describe a background job and handle jobs. More...
Public Member Functions | |
__construct ( $command, $title, $params=false) | |
allowRetries () | |
getDeduplicationInfo () | |
Subclasses may need to override this to make duplication detection work. More... | |
getLastError () | |
getParams () | |
getReleaseTimestamp () | |
getRootJobParams () | |
getTitle () | |
getType () | |
hasRootJobParams () | |
ignoreDuplicates () | |
insert () | |
Insert a single job into the queue. More... | |
run () | |
Run the job. More... | |
toString () | |
workItemCount () | |
Static Public Member Functions | |
static | batchInsert ( $jobs) |
Batch-insert a group of jobs into the queue. More... | |
static | factory ( $command, Title $title, $params=false) |
Create the appropriate object to handle a specific job. More... | |
static | newRootJobParams ( $key) |
static | pop () |
Pop a job off the front of the queue. More... | |
static | pop_type ( $type) |
Pop a job of a certain type. More... | |
static | safeBatchInsert ( $jobs) |
Insert a group of jobs into the queue. More... | |
Public Attributes | |
string | $command |
array | $metadata = array() |
Additional queue metadata *. More... | |
array bool | $params |
Array of job parameters or false if none *. More... | |
Protected Member Functions | |
setLastError ( $error) | |
Protected Attributes | |
string | $error |
Text for error that occurred last *. More... | |
bool | $removeDuplicates |
Expensive jobs may set this to true *. More... | |
Title | $title |
Class to both describe a background job and handle jobs.
The queue aspects of this class are now deprecated. Using the class to push jobs onto queues is deprecated (use JobSpecification).
Job::__construct | ( | $command, | |
$title, | |||
$params = false |
|||
) |
Job::allowRetries | ( | ) |
Reimplemented in PublishStashedFileJob, and AssembleUploadChunksJob.
|
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.
array | $jobs | of Job objects |
Definition at line 88 of file Job.php.
References JobQueueGroup\singleton().
Create the appropriate object to handle a specific job.
MWException |
Definition at line 67 of file Job.php.
References $command, $params, $title, and global.
Referenced by JobQueueDB\doPop(), JobQueueDB\getAllQueuedJobs(), JobQueueRedis\getJobFromFields(), and JobQueueRedis\getJobFromUidInternal().
Job::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.
Implements IJobSpecification.
Reimplemented in RefreshLinksJob, PublishStashedFileJob, RefreshLinksJob2, and AssembleUploadChunksJob.
Definition at line 213 of file Job.php.
References array(), getParams(), getTitle(), and getType().
Job::getParams | ( | ) |
Implements IJobSpecification.
Definition at line 166 of file Job.php.
References $params.
Referenced by getDeduplicationInfo().
Job::getReleaseTimestamp | ( | ) |
Implements IJobSpecification.
Definition at line 174 of file Job.php.
References TS_UNIX, and wfTimestampOrNull().
Job::getRootJobParams | ( | ) |
Definition at line 251 of file Job.php.
References array().
Referenced by RefreshLinksJob2\getSingleTitleJobs(), HTMLCacheUpdateJob\run(), RefreshLinksJob2\run(), and RefreshLinksJob\run().
Job::getTitle | ( | ) |
Implements IJobSpecification.
Definition at line 159 of file Job.php.
References $title.
Referenced by getDeduplicationInfo().
Job::getType | ( | ) |
Implements IJobSpecification.
Definition at line 152 of file Job.php.
References $command.
Referenced by JobQueueGroup\ack(), JobQueueGroup\deduplicateRootJob(), and getDeduplicationInfo().
Job::hasRootJobParams | ( | ) |
Job::ignoreDuplicates | ( | ) |
Implements IJobSpecification.
Definition at line 183 of file Job.php.
References $removeDuplicates.
Job::insert | ( | ) |
Insert a single job into the queue.
Definition at line 277 of file Job.php.
References JobQueueGroup\singleton().
|
static |
string | $key | A key that identifies the task |
Definition at line 239 of file Job.php.
References array(), and wfTimestampNow().
Referenced by HTMLCacheUpdate\doUpdate(), LinksUpdate\queueRecursiveJobsForTable(), RefreshLinksPartitionTest\testRefreshLinks(), and JobQueueTest\testRootDeduplication().
|
static |
Pop a job off the front of the queue.
This is subject to $wgJobTypesExcludedFromDefaultQueue.
Definition at line 127 of file Job.php.
References JobQueueGroup\singleton().
|
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.
$type | string |
Definition at line 116 of file Job.php.
References $type, and JobQueueGroup\singleton().
|
abstract |
Run the job.
Reimplemented in DoubleRedirectJob, NullJob, RefreshLinksJob, DuplicateJob, UploadFromUrlJob, HTMLCacheUpdateJob, RefreshLinksJob2, AssembleUploadChunksJob, EmaillingJob, PublishStashedFileJob, and EnotifNotifyJob.
|
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.
array | $jobs | of Job objects |
Definition at line 103 of file Job.php.
References JobQueue\QOS_ATOMIC, and JobQueueGroup\singleton().
|
protected |
Definition at line 317 of file Job.php.
References $error.
Referenced by AssembleUploadChunksJob\run(), PublishStashedFileJob\run(), DoubleRedirectJob\run(), and RefreshLinksJob\runForTitle().
Job::toString | ( | ) |
Job::workItemCount | ( | ) |
Reimplemented in RefreshLinksJob, and HTMLCacheUpdateJob.
string Job::$command |
|
protected |
Text for error that occurred last *.
Definition at line 42 of file Job.php.
Referenced by getLastError(), and setLastError().
array bool Job::$params |
Array of job parameters or false if none *.
Definition at line 34 of file Job.php.
Referenced by AssembleUploadChunksJob\__construct(), EnotifNotifyJob\__construct(), PublishStashedFileJob\__construct(), EmaillingJob\__construct(), RefreshLinksJob2\__construct(), HTMLCacheUpdateJob\__construct(), DuplicateJob\__construct(), UploadFromUrlJob\__construct(), RefreshLinksJob\__construct(), NullJob\__construct(), DoubleRedirectJob\__construct(), __construct(), factory(), getParams(), and NullJob\run().
|
protected |
Expensive jobs may set this to true *.
Definition at line 40 of file Job.php.
Referenced by ignoreDuplicates().
|
protected |
Definition at line 38 of file Job.php.
Referenced by AssembleUploadChunksJob\__construct(), EnotifNotifyJob\__construct(), PublishStashedFileJob\__construct(), RefreshLinksJob2\__construct(), DuplicateJob\__construct(), HTMLCacheUpdateJob\__construct(), UploadFromUrlJob\__construct(), RefreshLinksJob\__construct(), NullJob\__construct(), DoubleRedirectJob\__construct(), __construct(), factory(), DoubleRedirectJob\fixRedirects(), DoubleRedirectJob\getFinalDestination(), RefreshLinksJob2\getSingleTitleJobs(), getTitle(), HTMLCacheUpdateJob\invalidateTitles(), NullJob\run(), and RefreshLinksJob\runForTitle().