Merge "Revert "Removed useless JobQueue return values""
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 16 Apr 2014 17:50:07 +0000 (17:50 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 16 Apr 2014 17:50:07 +0000 (17:50 +0000)
1  2 
includes/jobqueue/JobQueue.php

@@@ -304,11 -304,11 +304,11 @@@ abstract class JobQueue 
         *
         * @param Job|array $jobs A single job or an array of Jobs
         * @param int $flags Bitfield (supports JobQueue::QOS_ATOMIC)
-        * @return void
+        * @return bool Returns false on failure
         * @throws JobQueueError
         */
        final public function push( $jobs, $flags = 0 ) {
-               $this->batchPush( is_array( $jobs ) ? $jobs : array( $jobs ), $flags );
+               return $this->batchPush( is_array( $jobs ) ? $jobs : array( $jobs ), $flags );
        }
  
        /**
         *
         * @param array $jobs List of Jobs
         * @param int $flags Bitfield (supports JobQueue::QOS_ATOMIC)
-        * @return void
         * @throws MWException
+        * @return bool Returns false on failure
         */
        final public function batchPush( array $jobs, $flags = 0 ) {
                if ( !count( $jobs ) ) {
                }
  
                wfProfileIn( __METHOD__ );
-               $this->doBatchPush( $jobs, $flags );
+               $ok = $this->doBatchPush( $jobs, $flags );
                wfProfileOut( __METHOD__ );
+               return $ok;
        }
  
        /**
         * @see JobQueue::batchPush()
         * @param array $jobs
         * @param $flags
+        * @return bool
         */
        abstract protected function doBatchPush( array $jobs, $flags );
  
                // Flag this job as an old duplicate based on its "root" job...
                try {
                        if ( $job && $this->isRootJobOldDuplicate( $job ) ) {
 -                              JobQueue::incrStats( 'job-pop-duplicate', $this->type );
 +                              JobQueue::incrStats( 'job-pop-duplicate', $this->type, 1, $this->wiki );
                                $job = DuplicateJob::newFromJob( $job ); // convert to a no-op
                        }
                } catch ( MWException $e ) {
         * Outside callers should use JobQueueGroup::ack() instead of this function.
         *
         * @param Job $job
-        * @return void
         * @throws MWException
+        * @return bool
         */
        final public function ack( Job $job ) {
                if ( $job->getType() !== $this->type ) {
                        throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
                }
                wfProfileIn( __METHOD__ );
-               $this->doAck( $job );
+               $ok = $this->doAck( $job );
                wfProfileOut( __METHOD__ );
+               return $ok;
        }
  
        /**
         * @see JobQueue::ack()
         * @param Job $job
+        * @return bool
         */
        abstract protected function doAck( Job $job );
  
        /**
         * Deleted all unclaimed and delayed jobs from the queue
         *
+        * @return bool Success
         * @throws JobQueueError
         * @since 1.22
-        * @return void
         */
        final public function delete() {
                wfProfileIn( __METHOD__ );
-               $this->doDelete();
+               $res = $this->doDelete();
                wfProfileOut( __METHOD__ );
+               return $res;
        }
  
        /**
         * @see JobQueue::delete()
         * @throws MWException
+        * @return bool Success
         */
        protected function doDelete() {
                throw new MWException( "This method is not implemented." );
         * @param string $key Event type
         * @param string $type Job type
         * @param int $delta
 +       * @param string $wiki Wiki ID (added in 1.23)
         * @since 1.22
         */
 -      public static function incrStats( $key, $type, $delta = 1 ) {
 +      public static function incrStats( $key, $type, $delta = 1, $wiki = null ) {
                wfIncrStats( $key, $delta );
                wfIncrStats( "{$key}-{$type}", $delta );
 +              if ( $wiki !== null ) {
 +                      wfIncrStats( "{$key}-{$type}-{$wiki}", $delta );
 +              }
        }
  
        /**