From 2a176864eb7781599e49a97ce7921262bb8fdcc6 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 18 May 2015 19:06:49 -0700 Subject: [PATCH] Made pushLazyJobs() handle all queue groups * This avoids __destruct() warnings * Also remove push() code in __destruct() that just made more warnings since it's too late Change-Id: I32a3cfabc94e36b9d2808b45d55209f3df46e47d --- includes/MediaWiki.php | 4 ++-- includes/jobqueue/JobQueueGroup.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 84001ffd4e..62ab667cfd 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -459,7 +459,7 @@ class MediaWiki { */ public function postSendUpdates() { try { - JobQueueGroup::singleton()->pushLazyJobs(); + JobQueueGroup::pushLazyJobs(); $this->triggerJobs(); $this->restInPeace(); } catch ( Exception $e ) { @@ -626,7 +626,7 @@ class MediaWiki { DeferredUpdates::doUpdates( 'commit' ); // Make sure any lazy jobs are pushed - JobQueueGroup::singleton()->pushLazyJobs(); + JobQueueGroup::pushLazyJobs(); // Log profiling data, e.g. in the database or UDP wfLogProfilingData(); diff --git a/includes/jobqueue/JobQueueGroup.php b/includes/jobqueue/JobQueueGroup.php index 72d2537ee1..3d2393e528 100644 --- a/includes/jobqueue/JobQueueGroup.php +++ b/includes/jobqueue/JobQueueGroup.php @@ -28,7 +28,7 @@ * @since 1.21 */ class JobQueueGroup { - /** @var array */ + /** @var JobQueueGroup[] */ protected static $instances = array(); /** @var ProcessCacheLRU */ @@ -166,10 +166,11 @@ class JobQueueGroup { * @return void * @since 1.26 */ - public function pushLazyJobs() { - $this->push( $this->bufferedJobs ); - - $this->bufferedJobs = array(); + public static function pushLazyJobs() { + foreach ( self::$instances as $group ) { + $group->push( $group->bufferedJobs ); + $group->bufferedJobs = array(); + } } /** @@ -416,7 +417,6 @@ class JobQueueGroup { $n = count( $this->bufferedJobs ); if ( $n > 0 ) { trigger_error( __METHOD__ . ": $n buffered job(s) never inserted." ); - $this->pushLazyJobs(); // try to do it now } } } -- 2.20.1