MediaWiki REL1_37
NullJob.php
Go to the documentation of this file.
1<?php
47class NullJob extends Job implements GenericParameterJob {
51 public function __construct( array $params ) {
52 parent::__construct( 'null', $params );
53 if ( !isset( $this->params['lives'] ) ) {
54 $this->params['lives'] = 1;
55 }
56 if ( !isset( $this->params['usleep'] ) ) {
57 $this->params['usleep'] = 0;
58 }
59 $this->removeDuplicates = !empty( $this->params['removeDuplicates'] );
60 }
61
62 public function run() {
63 if ( $this->params['usleep'] > 0 ) {
64 usleep( $this->params['usleep'] );
65 }
66 if ( $this->params['lives'] > 1 ) {
68 $params['lives']--;
69 $job = new self( $params );
70 JobQueueGroup::singleton()->push( $job );
71 }
72
73 return true;
74 }
75}
Class to both describe a background job and handle jobs.
Definition Job.php:37
array $params
Array of job parameters.
Definition Job.php:42
Degenerate job that does nothing, but can optionally replace itself in the queue and/or sleep for a b...
Definition NullJob.php:47
run()
Run the job.
Definition NullJob.php:62
__construct(array $params)
Definition NullJob.php:51
Interface for generic jobs only uses the parameters field and are JSON serializable.
if(count( $args)< 1) $job