MediaWiki master
DuplicateJob.php
Go to the documentation of this file.
1<?php
29final class DuplicateJob extends Job implements GenericParameterJob {
35 public 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}
No-op job that does nothing.
__construct(array $params)
Callers should use DuplicateJob::newFromJob() instead.
static newFromJob(RunnableJob $job)
Get a duplicate no-op version of a job.
run()
Run the job.
Describe and execute a background job.
Definition Job.php:40
array $params
Array of job parameters.
Definition Job.php:45
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