Merge "[JobQueue] Added __METHOD__ to delete() call."
authorDemon <chadh@wikimedia.org>
Fri, 7 Dec 2012 12:37:11 +0000 (12:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 7 Dec 2012 12:37:11 +0000 (12:37 +0000)
1  2 
includes/job/JobQueueDB.php

@@@ -174,7 -174,6 +174,7 @@@ class JobQueueDB extends JobQueue 
                        }
                        $job = Job::factory( $row->job_cmd, $title,
                                self::extractBlob( $row->job_params ), $row->job_id );
 +                      $job->id = $row->job_id; // XXX: work around broken subclasses
                        // Flag this job as an old duplicate based on its "root" job...
                        if ( $this->isRootJobOldDuplicate( $job ) ) {
                                $job = DuplicateJob::newFromJob( $job ); // convert to a no-op
         * @return Job|bool
         */
        protected function doAck( Job $job ) {
 +              if ( !$job->getId() ) {
 +                      throw new MWException( "Job of type '{$job->getType()}' has no ID." );
 +              }
 +
                $dbw = $this->getMasterDB();
                $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction
  
                // Delete a row with a single DELETE without holding row locks over RTTs...
-               $dbw->delete( 'job', array( 'job_cmd' => $this->type, 'job_id' => $job->getId() ) );
+               $dbw->delete( 'job',
+                       array( 'job_cmd' => $this->type, 'job_id' => $job->getId() ), __METHOD__ );
  
                return true;
        }