From b10bb9c5f5793e6959e83e30f1bfc5ccc81be29d Mon Sep 17 00:00:00 2001 From: Andrew Otto Date: Tue, 12 Jul 2016 14:42:33 -0400 Subject: [PATCH] Pass $archivedRevisionCount to the ArticleDeleteComplete hook Bug: T134502 Change-Id: I1df89beeadbec2a3592e51fbb525ed6db2424619 --- docs/hooks.txt | 1 + includes/page/WikiPage.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 57240c98f9..c53490a112 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -608,6 +608,7 @@ $reason: the reason the article was deleted $id: id of the article that was deleted $content: the Content of the deleted page $logEntry: the ManualLogEntry used to record the deletion +$archivedRevisionCount: the number of revisions archived during the deletion 'ArticleEditUpdateNewTalk': Before updating user_newtalk when a user talk page was changed. diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 26028b1f2a..a63a784793 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -2927,6 +2927,8 @@ class WikiPage implements Page, IDBAccessObject { ], __METHOD__ ); + // Save this so we can pass it to the ArticleDeleteComplete hook. + $archivedRevisionCount = $dbw->affectedRows(); // Now that it's safely backed up, delete it $dbw->delete( 'page', [ 'page_id' => $id ], __METHOD__ ); @@ -2957,7 +2959,7 @@ class WikiPage implements Page, IDBAccessObject { $this->doDeleteUpdates( $id, $content ); Hooks::run( 'ArticleDeleteComplete', - [ &$this, &$user, $reason, $id, $content, $logEntry ] ); + [ &$this, &$user, $reason, $id, $content, $logEntry, $archivedRevisionCount ] ); $status->value = $logid; // Show log excerpt on 404 pages rather than just a link -- 2.20.1