MediaWiki REL1_30
NullJob.php
Go to the documentation of this file.
1<?php
47class NullJob extends Job {
52 function __construct( Title $title, array $params ) {
53 parent::__construct( 'null', $title, $params );
54 if ( !isset( $this->params['lives'] ) ) {
55 $this->params['lives'] = 1;
56 }
57 if ( !isset( $this->params['usleep'] ) ) {
58 $this->params['usleep'] = 0;
59 }
60 $this->removeDuplicates = !empty( $this->params['removeDuplicates'] );
61 }
62
63 public function run() {
64 if ( $this->params['usleep'] > 0 ) {
65 usleep( $this->params['usleep'] );
66 }
67 if ( $this->params['lives'] > 1 ) {
69 $params['lives']--;
70 $job = new self( $this->title, $params );
72 }
73
74 return true;
75 }
76}
static singleton( $wiki=false)
Class to both describe a background job and handle jobs.
Definition Job.php:31
Title $title
Definition Job.php:42
array $params
Array of job parameters.
Definition Job.php:36
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:63
__construct(Title $title, array $params)
Definition NullJob.php:52
Represents a title within MediaWiki.
Definition Title.php:39
if(count( $args)< 1) $job