MediaWiki REL1_32
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 );
71 JobQueueGroup::singleton()->push( $job );
72 }
73
74 return true;
75 }
76}
Class to both describe a background job and handle jobs.
Definition Job.php:30
Title $title
Definition Job.php:41
array $params
Array of job parameters.
Definition Job.php:35
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(count( $args)< 1) $job