Ottomata has uploaded a new change for review. https://gerrit.wikimedia.org/r/298555
Change subject: Pass articleIsRedirect to ArticleDeleteComplete hook ...................................................................... Pass articleIsRedirect to ArticleDeleteComplete hook The ArticleDeleteComplete hook has the $article object, but after the deletion has already occured. At this time, $article->isRedirect() returns empty. This saves the state of $article-isRedirect before the delete occurs, and then passes it to ArticleDeleteComplete hook directly. Change-Id: Iab1e7c78a45775cf6371a154f011e1804229554e --- M docs/hooks.txt M includes/page/WikiPage.php 2 files changed, 8 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/55/298555/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index 6258abc..192588a 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -609,6 +609,7 @@ $content: the Content of the deleted page $logEntry: the ManualLogEntry used to record the deletion $archivedRevisionCount: the number of revisions archived during the deletion +$articleIsRedirect: bool for if the article was a redirect when it was deleted '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 88cae41..ad1ffb0 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -2931,6 +2931,12 @@ // Save this so we can pass it to the ArticleDeleteComplete hook. $archivedRevisionCount = $dbw->affectedRows(); + // Before we actually delete this page, save the fact that is + // is a redirect. After it is deleted, this information + // is not available via $this->isRedirect(). This will be passed + // to the ArticleDeleteComplete hook. + $articleIsRedirect = $this->isRedirect(); + // Now that it's safely backed up, delete it $dbw->delete( 'page', [ 'page_id' => $id ], __METHOD__ ); @@ -2961,7 +2967,7 @@ $this->doDeleteUpdates( $id, $content ); Hooks::run( 'ArticleDeleteComplete', - [ &$this, &$user, $reason, $id, $content, $logEntry, $archivedRevisionCount ] ); + [ &$this, &$user, $reason, $id, $content, $logEntry, $archivedRevisionCount, $articleIsRedirect ] ); $status->value = $logid; // Show log excerpt on 404 pages rather than just a link -- To view, visit https://gerrit.wikimedia.org/r/298555 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iab1e7c78a45775cf6371a154f011e1804229554e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Ottomata <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits