X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobQueueGroup.php;h=7a0d4eaff16f2cfeabcdaa7b777d1f598ec22f47;hb=d029197c7c5b083edef20fa79cc3e6d58e161f72;hp=b9c4157574054915e70ded1c3714b13a3b9c7dd7;hpb=777b59b3557c91720d67d014ef0d0738b9481ee5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueueGroup.php b/includes/jobqueue/JobQueueGroup.php index b9c4157574..7a0d4eaff1 100644 --- a/includes/jobqueue/JobQueueGroup.php +++ b/includes/jobqueue/JobQueueGroup.php @@ -118,6 +118,11 @@ class JobQueueGroup { $conf['readOnlyReason'] = $this->readOnlyReason; } + $services = MediaWikiServices::getInstance(); + $conf['stats'] = $services->getStatsdDataFactory(); + $conf['wanCache'] = $services->getMainWANObjectCache(); + $conf['stash'] = $services->getMainObjectStash(); + return JobQueue::factory( $conf ); } @@ -182,10 +187,6 @@ class JobQueueGroup { /** * Buffer jobs for insertion via push() or call it now if in CLI mode * - * Note that pushLazyJobs() is registered as a deferred update just before - * DeferredUpdates::doUpdates() in MediaWiki and JobRunner classes in order - * to be executed as the very last deferred update (T100085, T154425). - * * @param IJobSpecification|IJobSpecification[] $jobs A single Job or a list of Jobs * @return void * @since 1.26 @@ -209,17 +210,6 @@ class JobQueueGroup { DeferredUpdates::addUpdate( new JobQueueEnqueueUpdate( $this->domain, $jobs ) ); } - /** - * Push all jobs buffered via lazyPush() into their respective queues - * - * @return void - * @since 1.26 - * @deprecated Since 1.33 Not needed anymore - */ - public static function pushLazyJobs() { - wfDeprecated( __METHOD__, '1.33' ); - } - /** * Pop a job off one of the job queues * @@ -229,11 +219,21 @@ class JobQueueGroup { * @param int|string $qtype JobQueueGroup::TYPE_* constant or job type string * @param int $flags Bitfield of JobQueueGroup::USE_* constants * @param array $blacklist List of job types to ignore - * @return Job|bool Returns false on failure + * @return RunnableJob|bool Returns false on failure */ public function pop( $qtype = self::TYPE_DEFAULT, $flags = 0, array $blacklist = [] ) { + global $wgJobClasses; + $job = false; + if ( !WikiMap::isCurrentWikiDbDomain( $this->domain ) ) { + throw new JobQueueError( + "Cannot pop '{$qtype}' job off foreign '{$this->domain}' wiki queue." ); + } elseif ( is_string( $qtype ) && !isset( $wgJobClasses[$qtype] ) ) { + // Do not pop jobs if there is no class for the queue type + throw new JobQueueError( "Unrecognized job type '$qtype'." ); + } + if ( is_string( $qtype ) ) { // specific job type if ( !in_array( $qtype, $blacklist ) ) { $job = $this->get( $qtype )->pop();