From a1421792e94275b7e3c3589f03155dd68fd1ca5c Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Thu, 5 Oct 2017 21:03:30 -0700 Subject: [PATCH] Use normal lint error updating logic for page deletions Page deletions were bypassing the logic in RecordLintJob that ensured the right category totals cache was cleared and the statsd updates. Fix that by just using RecordLintJob directly. Bug: T170313 Change-Id: I06b821b65f65609ddac8ed4e7c662336082d8266 --- includes/Hooks.php | 10 ++++++---- includes/RecordLintJob.php | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index 6793e98e..cab24dfe 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -81,10 +81,12 @@ class Hooks { public static function onWikiPageDeletionUpdates( WikiPage $wikiPage, Content $content, array &$updates ) { - $id = $wikiPage->getId(); - $updates[] = new MWCallableUpdate( function () use ( $id ) { - $database = new Database( $id ); - $database->setForPage( [] ); + $title = $wikiPage->getTitle(); + $updates[] = new MWCallableUpdate( function () use ( $title ) { + $job = new RecordLintJob( + $title, [ 'errors' => [] ] + ); + $job->run(); }, __METHOD__ ); } diff --git a/includes/RecordLintJob.php b/includes/RecordLintJob.php index 7063169a..b0632785 100644 --- a/includes/RecordLintJob.php +++ b/includes/RecordLintJob.php @@ -35,7 +35,9 @@ class RecordLintJob extends Job { } public function run() { - if ( $this->title->getLatestRevID() != $this->params['revision'] ) { + if ( isset( $this->params['revision'] ) + && $this->title->getLatestRevID() != $this->params['revision'] + ) { // Outdated now, let a later job handle it return true; }