From 199f6c3055528d4f42a1eb0f7099fb75695032fd Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 24 Sep 2015 15:45:09 -0700 Subject: [PATCH] Refactored global state out of EnqueueableDataUpdate * Follow-up 25a44aa3e4fa * The static DataUpdate::enqueueUpdates() method will deal with JobQueueGroup construction instead Change-Id: Id7741a770cee81fdc3f61804b7574ccf737bc338 --- includes/deferred/DataUpdate.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/deferred/DataUpdate.php b/includes/deferred/DataUpdate.php index e07fc87fcd..4a61b2aff3 100644 --- a/includes/deferred/DataUpdate.php +++ b/includes/deferred/DataUpdate.php @@ -134,7 +134,8 @@ abstract class DataUpdate implements DeferrableUpdate { foreach ( $updates as $update ) { if ( $update instanceof EnqueueableDataUpdate ) { - $update->enqueueUpdate(); + $spec = $update->getAsJobSpecification(); + JobQueueGroup::singleton( $spec['wiki'] )->push( $spec['job'] ); } else { $remaining[] = $update; } @@ -145,11 +146,16 @@ abstract class DataUpdate implements DeferrableUpdate { } /** + * Interface that marks a DataUpdate as enqueuable via the JobQueue + * + * Such updates must be representable using IJobSpecification, so that + * they can be serialized into jobs and enqueued for later execution + * * @since 1.26 */ interface EnqueueableDataUpdate { /** - * Push the update into the job queue + * @return array (wiki => wiki ID, job => IJobSpecification) */ - public function enqueueUpdate(); + public function getAsJobSpecification(); } -- 2.20.1