From bde1c2e28be596738aaac9d27daf77761caa9590 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 24 May 2019 14:01:17 -0700 Subject: [PATCH] Cleanup DerivedPageDataUpdater::doSecondaryDataUpdates and remove redundant caller option Change-Id: I8bbc6cd76d035635d47d1158df34c625879a8cc3 --- includes/Storage/DerivedPageDataUpdater.php | 17 ++++++++--------- includes/jobqueue/jobs/RefreshLinksJob.php | 3 +-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/includes/Storage/DerivedPageDataUpdater.php b/includes/Storage/DerivedPageDataUpdater.php index bc48a0e7bd..ff5541d800 100644 --- a/includes/Storage/DerivedPageDataUpdater.php +++ b/includes/Storage/DerivedPageDataUpdater.php @@ -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 { diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index b1c805b4a4..a0b6e07aef 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -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']; -- 2.20.1