From 97d9916a3d168c075cca59d9bc0b05cad255f677 Mon Sep 17 00:00:00 2001 From: Reedy Date: Thu, 6 Oct 2016 14:44:00 +0100 Subject: [PATCH] Make more ContentHandler replaced hooks emit deprecation warnings ArticleAfterFetchContent, ArticleSave Bug: T145728 Bug: T147387 Bug: T147389 Change-Id: I58a0c46b95b8ef02ff55851cfdec7e9d6eeed83c --- RELEASE-NOTES-1.28 | 5 +++-- includes/EditPage.php | 4 ++-- includes/page/Article.php | 12 ++++++++++-- includes/page/WikiPage.php | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28 index ba5c689e49..0078399d45 100644 --- a/RELEASE-NOTES-1.28 +++ b/RELEASE-NOTES-1.28 @@ -214,8 +214,9 @@ changes to languages because of Phabricator reports. * IP::isConfiguredProxy() and IP::isTrustedProxy() were removed. Callers should migrate to using the same functions on a ProxyLookup instance, obtainable from MediaWikiServices. -* The ArticleViewCustom, EditPageGetDiffText, EditPageGetPreviewText and ShowRawCssJs - hooks will now emit deprecation warnings if used. +* The ArticleAfterFetchContent, ArticleSave, ArticleViewCustom, EditPageGetDiffText, + EditPageGetPreviewText and ShowRawCssJs hooks will now emit deprecation warnings if + used. == Compatibility == diff --git a/includes/EditPage.php b/includes/EditPage.php index c1ba3cef8f..8ca7105684 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1613,8 +1613,8 @@ class EditPage { protected function runPostMergeFilters( Content $content, Status $status, User $user ) { // Run old style post-section-merge edit filter if ( !ContentHandler::runLegacyHooks( 'EditFilterMerged', - [ $this, $content, &$this->hookError, $this->summary ] ) - ) { + [ $this, $content, &$this->hookError, $this->summary ] + ) ) { # Error messages etc. could be handled within the hook... $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR; diff --git a/includes/page/Article.php b/includes/page/Article.php index 4fdbdea78c..94286090aa 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -347,7 +347,11 @@ class Article implements Page { // @todo Get rid of mContent everywhere! $this->mContent = ContentHandler::getContentText( $content ); - ContentHandler::runLegacyHooks( 'ArticleAfterFetchContent', [ &$this, &$this->mContent ] ); + ContentHandler::runLegacyHooks( + 'ArticleAfterFetchContent', + [ &$this, &$this->mContent ], + '1.21' + ); return $this->mContent; } @@ -424,7 +428,11 @@ class Article implements Page { $this->mContentObject = $content; $this->mRevIdFetched = $this->mRevision->getId(); - Hooks::run( 'ArticleAfterFetchContentObject', [ &$this, &$this->mContentObject ] ); + ContentHandler::runLegacyHooks( + 'ArticleAfterFetchContentObject', + [ &$this, &$this->mContentObject ], + '1.21' + ); return $this->mContentObject; } diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 98428dd0e8..6c85070acc 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1678,7 +1678,7 @@ class WikiPage implements Page, IDBAccessObject { $flags & EDIT_MINOR, null, null, &$flags, &$hookStatus ]; // Check if the hook rejected the attempted save if ( !Hooks::run( 'PageContentSave', $hook_args ) - || !ContentHandler::runLegacyHooks( 'ArticleSave', $hook_args ) + || !ContentHandler::runLegacyHooks( 'ArticleSave', $hook_args, '1.21' ) ) { if ( $hookStatus->isOK() ) { // Hook returned false but didn't call fatal(); use generic message -- 2.20.1