MediaWiki
REL1_22
|
00001 <?php 00047 class NullJob extends Job { 00053 function __construct( $title, $params, $id = 0 ) { 00054 parent::__construct( 'null', $title, $params, $id ); 00055 if ( !isset( $this->params['lives'] ) ) { 00056 $this->params['lives'] = 1; 00057 } 00058 if ( !isset( $this->params['usleep'] ) ) { 00059 $this->params['usleep'] = 0; 00060 } 00061 $this->removeDuplicates = !empty( $this->params['removeDuplicates'] ); 00062 } 00063 00064 public function run() { 00065 if ( $this->params['usleep'] > 0 ) { 00066 usleep( $this->params['usleep'] ); 00067 } 00068 if ( $this->params['lives'] > 1 ) { 00069 $params = $this->params; 00070 $params['lives']--; 00071 $job = new self( $this->title, $params ); 00072 JobQueueGroup::singleton()->push( $job ); 00073 } 00074 return true; 00075 } 00076 }