Pass $archivedRevisionCount to the ArticleDeleteComplete hook
authorAndrew Otto <acotto@gmail.com>
Tue, 12 Jul 2016 18:42:33 +0000 (14:42 -0400)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 4 Aug 2016 01:05:59 +0000 (01:05 +0000)
Bug: T134502
Change-Id: I1df89beeadbec2a3592e51fbb525ed6db2424619

docs/hooks.txt
includes/page/WikiPage.php

index 57240c9..c53490a 100644 (file)
@@ -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.
index 26028b1..a63a784 100644 (file)
@@ -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