Update DeferredUpdates::enqueueUpdates() to look for the DB domain
[lhc/web/wiklou.git] / includes / deferred / DeferredUpdates.php
index a14b25c..3b7de9d 100644 (file)
@@ -263,7 +263,8 @@ class DeferredUpdates {
                        if ( $mode === 'enqueue' && $update instanceof EnqueueableDataUpdate ) {
                                // Run only the job enqueue logic to complete the update later
                                $spec = $update->getAsJobSpecification();
-                               JobQueueGroup::singleton( $spec['wiki'] )->push( $spec['job'] );
+                               $domain = $spec['domain'] ?? $spec['wiki'];
+                               JobQueueGroup::singleton( $domain )->push( $spec['job'] );
                        } elseif ( $update instanceof TransactionRoundDefiningUpdate ) {
                                $update->doUpdate();
                        } else {
@@ -280,16 +281,6 @@ class DeferredUpdates {
                        }
                        MWExceptionHandler::rollbackMasterChangesAndLog( $e );
 
-                       // Try to push the update as a job so it can run later perhaps
-                       if ( $mode !== 'enqueue' && $update instanceof EnqueueableDataUpdate ) {
-                               try {
-                                       $spec = $update->getAsJobSpecification();
-                                       JobQueueGroup::singleton( $spec['wiki'] )->push( $spec['job'] );
-                               } catch ( Exception $e ) {
-                                       MWExceptionHandler::rollbackMasterChangesAndLog( $e );
-                               }
-                       }
-
                        // VW-style hack to work around T190178, so we can make sure
                        // PageMetaDataUpdater doesn't throw exceptions.
                        if ( defined( 'MW_PHPUNIT_TEST' ) ) {
@@ -345,7 +336,8 @@ class DeferredUpdates {
                foreach ( $updates as $update ) {
                        if ( $update instanceof EnqueueableDataUpdate ) {
                                $spec = $update->getAsJobSpecification();
-                               JobQueueGroup::singleton( $spec['wiki'] )->push( $spec['job'] );
+                               $domain = $spec['domain'] ?? $spec['wiki'];
+                               JobQueueGroup::singleton( $domain )->push( $spec['job'] );
                        } else {
                                $remaining[] = $update;
                        }