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