From: Aaron Schulz Date: Wed, 17 Oct 2012 14:18:32 +0000 (-0700) Subject: [JobQueue] Added more b/c wrapper functions. X-Git-Tag: 1.31.0-rc.0~21986^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=8967edfa4c0706fc95b3e22a116d2d1e108bd5e9;p=lhc%2Fweb%2Fwiklou.git [JobQueue] Added more b/c wrapper functions. * Also made some small doc fixes. Change-Id: Id525bd7e14b49f0ed24530d7f94a8198ff7bf4d8 --- diff --git a/includes/job/Job.php b/includes/job/Job.php index d11446e02f..0d2803e1bf 100644 --- a/includes/job/Job.php +++ b/includes/job/Job.php @@ -23,7 +23,7 @@ /** * Class to both describe a background job and handle jobs. - * This queue aspects of this class are now deprecated. + * The queue aspects of this class are now deprecated. * * @ingroup JobQueue */ @@ -80,7 +80,7 @@ abstract class Job { * removed later on, when the first one is popped. * * @param $jobs array of Job objects - * @deprecated 1.20 + * @deprecated 1.21 */ public static function batchInsert( $jobs ) { return JobQueueGroup::singleton()->push( $jobs ); @@ -94,12 +94,36 @@ abstract class Job { * large batches of jobs can cause slave lag. * * @param $jobs array of Job objects - * @deprecated 1.20 + * @deprecated 1.21 */ public static function safeBatchInsert( $jobs ) { return JobQueueGroup::singleton()->push( $jobs, JobQueue::QoS_Atomic ); } + /** + * Pop a job of a certain type. This tries less hard than pop() to + * actually find a job; it may be adversely affected by concurrent job + * runners. + * + * @param $type string + * @return Job + * @deprecated 1.21 + */ + public static function pop_type( $type ) { + return JobQueueGroup::singleton()->get( $type )->pop(); + } + + /** + * Pop a job off the front of the queue. + * This is subject to $wgJobTypesExcludedFromDefaultQueue. + * + * @return Job or false if there's no jobs + * @deprecated 1.21 + */ + public static function pop() { + return JobQueueGroup::singleton()->pop(); + } + /*------------------------------------------------------------------------- * Non-static functions *------------------------------------------------------------------------*/ @@ -157,7 +181,7 @@ abstract class Job { /** * Insert a single job into the queue. * @return bool true on success - * @deprecated 1.20 + * @deprecated 1.21 */ public function insert() { return JobQueueGroup::singleton()->push( $this );