From 6cd6b43c316cbd182981d8f8aeb3265413932478 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 19 Apr 2019 17:05:40 -0700 Subject: [PATCH] Avoid pre-send parse in DerivedPageDataUpdater due to isCountable() Bug: T216306 Change-Id: I08087f1019049fb8f31fed0d1e757f4df8733a05 --- includes/Storage/DerivedPageDataUpdater.php | 43 +++++++++++---------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/includes/Storage/DerivedPageDataUpdater.php b/includes/Storage/DerivedPageDataUpdater.php index 401806b8ca..bc48a0e7bd 100644 --- a/includes/Storage/DerivedPageDataUpdater.php +++ b/includes/Storage/DerivedPageDataUpdater.php @@ -1474,27 +1474,30 @@ class DerivedPageDataUpdater implements IDBAccessObject { return; } - if ( $this->options['oldcountable'] === 'no-change' || - ( !$this->options['changed'] && !$this->options['moved'] ) - ) { - $good = 0; - } elseif ( $this->options['created'] ) { - $good = (int)$this->isCountable(); - } elseif ( $this->options['oldcountable'] !== null ) { - $good = (int)$this->isCountable() - - (int)$this->options['oldcountable']; - } elseif ( isset( $this->pageState['oldCountable'] ) ) { - $good = (int)$this->isCountable() - - (int)$this->pageState['oldCountable']; - } else { - $good = 0; - } - $edits = $this->options['changed'] ? 1 : 0; - $pages = $this->options['created'] ? 1 : 0; + DeferredUpdates::addCallableUpdate( function () { + if ( + $this->options['oldcountable'] === 'no-change' || + ( !$this->options['changed'] && !$this->options['moved'] ) + ) { + $good = 0; + } elseif ( $this->options['created'] ) { + $good = (int)$this->isCountable(); + } elseif ( $this->options['oldcountable'] !== null ) { + $good = (int)$this->isCountable() + - (int)$this->options['oldcountable']; + } elseif ( isset( $this->pageState['oldCountable'] ) ) { + $good = (int)$this->isCountable() + - (int)$this->pageState['oldCountable']; + } else { + $good = 0; + } + $edits = $this->options['changed'] ? 1 : 0; + $pages = $this->options['created'] ? 1 : 0; - DeferredUpdates::addUpdate( SiteStatsUpdate::factory( - [ 'edits' => $edits, 'articles' => $good, 'pages' => $pages ] - ) ); + DeferredUpdates::addUpdate( SiteStatsUpdate::factory( + [ 'edits' => $edits, 'articles' => $good, 'pages' => $pages ] + ) ); + } ); // TODO: make search infrastructure aware of slots! $mainSlot = $this->revision->getSlot( SlotRecord::MAIN ); -- 2.20.1