MediaWiki master
NullJob.php
Go to the documentation of this file.
1<?php
22
50class NullJob extends Job implements GenericParameterJob {
54 public function __construct( array $params ) {
55 parent::__construct( 'null', $params );
56 if ( !isset( $this->params['lives'] ) ) {
57 $this->params['lives'] = 1;
58 }
59 if ( !isset( $this->params['usleep'] ) ) {
60 $this->params['usleep'] = 0;
61 }
62 $this->removeDuplicates = !empty( $this->params['removeDuplicates'] );
63 }
64
65 public function run() {
66 if ( $this->params['usleep'] > 0 ) {
67 usleep( $this->params['usleep'] );
68 }
69 if ( $this->params['lives'] > 1 ) {
71 $params['lives']--;
72 $job = new self( $params );
73 MediaWikiServices::getInstance()->getJobQueueGroup()->push( $job );
74 }
75
76 return true;
77 }
78}
array $params
The job parameters.
Describe and execute a background job.
Definition Job.php:41
Service locator for MediaWiki core services.
No-op job that does nothing.
Definition NullJob.php:50
run()
Run the job.
Definition NullJob.php:65
__construct(array $params)
Definition NullJob.php:54
Interface for generic jobs only uses the parameters field and are JSON serializable.
if(count( $args)< 1) $job