MediaWiki
REL1_21
|
00001 <?php 00031 class NullJob extends Job { 00037 function __construct( $title, $params, $id = 0 ) { 00038 parent::__construct( 'null', $title, $params, $id ); 00039 if ( !isset( $this->params['lives'] ) ) { 00040 $this->params['lives'] = 1; 00041 } 00042 if ( !isset( $this->params['usleep'] ) ) { 00043 $this->params['usleep'] = 0; 00044 } 00045 $this->removeDuplicates = !empty( $this->params['removeDuplicates'] ); 00046 } 00047 00048 public function run() { 00049 if ( $this->params['usleep'] > 0 ) { 00050 usleep( $this->params['usleep'] ); 00051 } 00052 if ( $this->params['lives'] > 1 ) { 00053 $params = $this->params; 00054 $params['lives']--; 00055 $job = new self( $this->title, $params ); 00056 JobQueueGroup::singleton()->push( $job ); 00057 } 00058 return true; 00059 } 00060 }