MediaWiki master
DuplicateJob.php
Go to the documentation of this file.
1<?php
8
12
21final class DuplicateJob extends Job implements GenericParameterJob {
27 public function __construct( array $params ) {
28 parent::__construct( 'duplicate', $params );
29 }
30
37 public static function newFromJob( RunnableJob $job ) {
38 $djob = new self( $job->getParams() );
39 $djob->command = $job->getType();
40 $djob->params = is_array( $djob->params ) ? $djob->params : [];
41 $djob->params = [ 'isDuplicate' => true ] + $djob->params;
42 $djob->metadata = $job->getMetadata();
43
44 return $djob;
45 }
46
48 public function run() {
49 return true;
50 }
51}
52
54class_alias( DuplicateJob::class, 'DuplicateJob' );
Describe and execute a background job.
Definition Job.php:28
array $params
Array of job parameters.
Definition Job.php:33
No-op job that does nothing.
static newFromJob(RunnableJob $job)
Get a duplicate no-op version of a job.
run()
Run the job.If this method returns false or completes exceptionally, the job runner will retry execut...
__construct(array $params)
Callers should use DuplicateJob::newFromJob() instead.
Interface for generic jobs only uses the parameters field and are JSON serializable.
Job that has a run() method and metadata accessors for JobQueue::pop() and JobQueue::ack().
if(count( $args)< 1) $job