MediaWiki  1.34.0
DuplicateJob.php
Go to the documentation of this file.
1 <?php
29 final class DuplicateJob extends Job implements GenericParameterJob {
35  function __construct( array $params ) {
36  parent::__construct( 'duplicate', $params );
37  }
38 
45  public static function newFromJob( RunnableJob $job ) {
46  $djob = new self( $job->getParams() );
47  $djob->command = $job->getType();
48  $djob->params = is_array( $djob->params ) ? $djob->params : [];
49  $djob->params = [ 'isDuplicate' => true ] + $djob->params;
50  $djob->metadata = $job->getMetadata();
51 
52  return $djob;
53  }
54 
55  public function run() {
56  return true;
57  }
58 }
true
return true
Definition: router.php:92
RunnableJob
Job that has a run() method and metadata accessors for JobQueue::pop() and JobQueue::ack()
Definition: RunnableJob.php:35
Job\$params
array $params
Array of job parameters.
Definition: Job.php:35
DuplicateJob\newFromJob
static newFromJob(RunnableJob $job)
Get a duplicate no-op version of a job.
Definition: DuplicateJob.php:45
Job
Class to both describe a background job and handle jobs.
Definition: Job.php:30
DuplicateJob\__construct
__construct(array $params)
Callers should use DuplicateJob::newFromJob() instead.
Definition: DuplicateJob.php:35
DuplicateJob
No-op job that does nothing.
Definition: DuplicateJob.php:29
DuplicateJob\run
run()
Run the job.
Definition: DuplicateJob.php:55
$job
if(count( $args)< 1) $job
Definition: recompressTracked.php:50
GenericParameterJob
Interface for generic jobs only uses the parameters field and are JSON serializable.
Definition: GenericParameterJob.php:29