Cleanup DerivedPageDataUpdater::doSecondaryDataUpdates and remove redundant caller...
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 24 May 2019 21:01:17 +0000 (14:01 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 24 May 2019 21:01:23 +0000 (14:01 -0700)
Change-Id: I8bbc6cd76d035635d47d1158df34c625879a8cc3

includes/Storage/DerivedPageDataUpdater.php
includes/jobqueue/jobs/RefreshLinksJob.php

index bc48a0e..ff5541d 100644 (file)
@@ -1582,10 +1582,10 @@ class DerivedPageDataUpdater implements IDBAccessObject {
                ];
                $deferValues = [ false, DeferredUpdates::PRESEND, DeferredUpdates::POSTSEND ];
                if ( !in_array( $options['defer'], $deferValues, true ) ) {
-                       throw new InvalidArgumentException( 'invalid value for defer: ' . $options['defer'] );
+                       throw new InvalidArgumentException( 'Invalid value for defer: ' . $options['defer'] );
                }
-               Assert::parameterType( 'integer|null', $options['transactionTicket'],
-                       '$options[\'transactionTicket\']' );
+               Assert::parameterType(
+                       'integer|null', $options['transactionTicket'], '$options[\'transactionTicket\']' );
 
                $updates = $this->getSecondaryDataUpdates( $options['recursive'] );
 
@@ -1596,14 +1596,13 @@ class DerivedPageDataUpdater implements IDBAccessObject {
                $causeAction = $this->options['causeAction'] ?? 'unknown';
                $causeAgent = $this->options['causeAgent'] ?? 'unknown';
                $legacyRevision = new Revision( $this->revision );
+               $ticket = $options['transactionTicket'];
 
-               if ( $options['defer'] === false && $options['transactionTicket'] !== null ) {
+               if ( $options['defer'] === false && $ticket !== null ) {
                        // For legacy hook handlers doing updates via LinksUpdateConstructed, make sure
                        // any pending writes they made get flushed before the doUpdate() calls below.
                        // This avoids snapshot-clearing errors in LinksUpdate::acquirePageLock().
-                       $this->loadbalancerFactory->commitAndWaitForReplication(
-                               __METHOD__, $options['transactionTicket']
-                       );
+                       $this->loadbalancerFactory->commitAndWaitForReplication( __METHOD__, $ticket );
                }
 
                foreach ( $updates as $update ) {
@@ -1616,8 +1615,8 @@ class DerivedPageDataUpdater implements IDBAccessObject {
                        }
 
                        if ( $options['defer'] === false ) {
-                               if ( $update instanceof DataUpdate && $options['transactionTicket'] !== null ) {
-                                       $update->setTransactionTicket( $options['transactionTicket'] );
+                               if ( $update instanceof DataUpdate && $ticket !== null ) {
+                                       $update->setTransactionTicket( $ticket );
                                }
                                $update->doUpdate();
                        } else {
index b1c805b..a0b6e07 100644 (file)
@@ -280,8 +280,7 @@ class RefreshLinksJob extends Job {
                        // Carry over cause so the update can do extra logging
                        'causeAction' => $this->params['causeAction'],
                        'causeAgent' => $this->params['causeAgent'],
-                       'defer' => false,
-                       'transactionTicket' => $ticket,
+                       'transactionTicket' => $ticket
                ];
                if ( !empty( $this->params['triggeringUser'] ) ) {
                        $userInfo = $this->params['triggeringUser'];