From 040860277bb5e96557f6e761d1fbd9a5974e45de Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 23 Jun 2016 18:44:17 +0200 Subject: [PATCH] Mark the APIEditBeforeSave hook as deprecated Bug: T137832 Depends-On: I9d0b7e7713c805ebc7bf59f55456e69c6491e265 (AbuseFilter) Depends-On: I27f244631e9dcd160bffff70349e5034f2a537ea (ConfirmEdit) Depends-On: I7b0e1d125b196379dd5bf26658ff642d32ba832a (ProofreadPage) Depends-On: I97f6a3c20476f1a42e3fadc701df5870a30c790c (SpamBlacklist) Change-Id: I6947d5373aa33224141f8d21cf3a1ee1f641d952 --- RELEASE-NOTES-1.28 | 1 + docs/hooks.txt | 3 ++- includes/api/ApiEditPage.php | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28 index c6251435eb..4c075fc66c 100644 --- a/RELEASE-NOTES-1.28 +++ b/RELEASE-NOTES-1.28 @@ -53,6 +53,7 @@ changes to languages because of Phabricator reports. * (T128697) Improved handling of large diffs. * [BREAKING CHANGE] $wgExtendedLoginCookies has been removed. You can use or update a custom session provider if needed. +* Deprecated APIEditBeforeSave hook in favor of EditFilterMergedContent. == Compatibility == diff --git a/docs/hooks.txt b/docs/hooks.txt index fa664c37eb..c0c01f47a0 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -371,7 +371,8 @@ $user: Current user &$message: API usage message to die with, as a message key or array as accepted by ApiBase::dieUsageMsg. -'APIEditBeforeSave': Before saving a page with api.php?action=edit, after +'APIEditBeforeSave': DEPRECATED! Use EditFilterMergedContent instead. +Before saving a page with api.php?action=edit, after processing request parameters. Return false to let the request fail, returning an error message or an tag if $resultArr was filled. Unlike for example 'EditFilterMergedContent' this also being run on undo. diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index d3d7a4df6b..00daba94b5 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -401,7 +401,8 @@ class ApiEditPage extends ApiBase { // Run hooks // Handle APIEditBeforeSave parameters $r = []; - if ( !Hooks::run( 'APIEditBeforeSave', [ $ep, $content, &$r ] ) ) { + // Deprecated in favour of EditFilterMergedContent + if ( !Hooks::run( 'APIEditBeforeSave', [ $ep, $content, &$r ], '1.28' ) ) { if ( count( $r ) ) { $r['result'] = 'Failure'; $apiResult->addValue( null, $this->getModuleName(), $r ); -- 2.20.1