MediaWiki
REL1_19
|
Class to both describe a background job and handle jobs. More...
Public Member Functions | |
__construct ($command, $title, $params=false, $id=0) | |
getLastError () | |
insert () | |
Insert a single job into the queue. | |
removeDuplicates () | |
Remove jobs in the job queue which are duplicates of this job. | |
run () | |
Run the job. | |
toString () | |
Static Public Member Functions | |
static | batchInsert ($jobs) |
Batch-insert a group of jobs into the queue. | |
static | extractBlob ($blob) |
static | factory ($command, $title, $params=false, $id=0) |
Create the appropriate object to handle a specific job. | |
static | makeBlob ($params) |
static | pop ($offset=0) |
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 | |
Protected Member Functions | |
insertFields () | |
setLastError ($error) |
Class to both describe a background job and handle jobs.
Definition at line 18 of file JobQueue.php.
Job::__construct | ( | $ | command, |
$ | title, | ||
$ | params = false , |
||
$ | id = 0 |
||
) |
$command | ||
$title | ||
$params | array | |
int | $id |
Definition at line 315 of file JobQueue.php.
References $command, $id, $params, $title, and removeDuplicates().
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.
$jobs | array of Job objects |
Definition at line 249 of file JobQueue.php.
References $job, $rows, wfGetDB(), and wfIncrStats().
Referenced by DoubleRedirectJob\fixRedirects(), HTMLCacheUpdate\insertJobs(), HTMLCacheUpdate\insertJobsFromTitles(), FixDoubleRedirects\queueJobs(), LinksUpdate\queueRecursiveJobs(), and RefreshLinksJob2\run().
static Job::extractBlob | ( | $ | blob | ) | [static] |
$blob |
Definition at line 232 of file JobQueue.php.
References $blob.
Referenced by pop(), and pop_type().
static Job::factory | ( | $ | command, |
$ | title, | ||
$ | params = false , |
||
$ | id = 0 |
||
) | [static] |
Create the appropriate object to handle a specific job.
$command | String: Job command |
$title | Title: Associated title |
$params | Array: Job parameters |
$id | Int: Job identifier |
Definition at line 207 of file JobQueue.php.
References $command, $id, $params, $title, and $wgJobClasses.
Referenced by pop(), pop_type(), and DoubleRedirectJob\run().
Definition at line 410 of file JobQueue.php.
Job::insert | ( | ) |
Insert a single job into the queue.
Definition at line 330 of file JobQueue.php.
References $res, insertFields(), removeDuplicates(), wfGetDB(), and wfIncrStats().
Job::insertFields | ( | ) | [protected] |
Definition at line 348 of file JobQueue.php.
References makeBlob(), and wfGetDB().
Referenced by insert(), and removeDuplicates().
static Job::makeBlob | ( | $ | params | ) | [static] |
$params |
Definition at line 220 of file JobQueue.php.
References $params.
Referenced by insertFields().
static Job::pop | ( | $ | offset = 0 | ) | [static] |
Pop a job off the front of the queue.
$offset | Integer: Number of jobs to skip |
Definition at line 104 of file JobQueue.php.
References $dbr, $job, $options, $title, $wgJobTypesExcludedFromDefaultQueue, extractBlob(), factory(), Title\makeTitleSafe(), wfGetDB(), wfIncrStats(), wfProfileIn(), and wfProfileOut().
Referenced by UploadFromUrlTest\doAsyncUpload(), MediaWiki\doJobs(), RunJobs\execute(), 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.
$type | string |
Definition at line 54 of file JobQueue.php.
References $job, $title, extractBlob(), factory(), Title\makeTitleSafe(), wfGetDB(), wfIncrStats(), and wfProfileOut().
Referenced by RunJobs\execute().
Remove jobs in the job queue which are duplicates of this job.
This is deadlock-prone and so starts its own transaction.
Definition at line 364 of file JobQueue.php.
References insertFields(), wfGetDB(), and wfIncrStats().
Referenced by __construct(), and insert().
Job::run | ( | ) | [abstract] |
Run the job.
Reimplemented in HTMLCacheUpdateJob, RefreshLinksJob2, DoubleRedirectJob, UploadFromUrlJob, RefreshLinksJob, EmaillingJob, and EnotifNotifyJob.
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.
$jobs | array of Job objects |
Definition at line 286 of file JobQueue.php.
References $job, $rows, wfGetDB(), and wfIncrStats().
Job::setLastError | ( | $ | error | ) | [protected] |
Definition at line 406 of file JobQueue.php.
References $error.
Referenced by DoubleRedirectJob\run().
Job::toString | ( | ) |
Definition at line 384 of file JobQueue.php.
Job::$command |
Definition at line 25 of file JobQueue.php.
Referenced by __construct(), and factory().
Job::$error |
Definition at line 25 of file JobQueue.php.
Referenced by setLastError().
Job::$id |
Definition at line 25 of file JobQueue.php.
Referenced by EmaillingJob\__construct(), EnotifNotifyJob\__construct(), RefreshLinksJob\__construct(), UploadFromUrlJob\__construct(), DoubleRedirectJob\__construct(), RefreshLinksJob2\__construct(), HTMLCacheUpdateJob\__construct(), __construct(), and factory().
Job::$params |
Definition at line 25 of file JobQueue.php.
Referenced by EmaillingJob\__construct(), EnotifNotifyJob\__construct(), RefreshLinksJob\__construct(), UploadFromUrlJob\__construct(), DoubleRedirectJob\__construct(), RefreshLinksJob2\__construct(), HTMLCacheUpdateJob\__construct(), __construct(), factory(), and makeBlob().
Job::$removeDuplicates |
Definition at line 25 of file JobQueue.php.
Job::$title |
Definition at line 23 of file JobQueue.php.
Referenced by EnotifNotifyJob\__construct(), RefreshLinksJob\__construct(), UploadFromUrlJob\__construct(), DoubleRedirectJob\__construct(), RefreshLinksJob2\__construct(), HTMLCacheUpdateJob\__construct(), __construct(), factory(), DoubleRedirectJob\fixRedirects(), DoubleRedirectJob\getFinalDestination(), pop(), pop_type(), and RefreshLinksJob2\run().