Mark 3 hooks deprecated by ContentHandler as such

ArticleViewCustom, EditPageGetDiffText and EditPageGetPreviewText hooks
now marked as deprecated in 1.21.

TitleIsCssOrJsPage and TitleIsWikitextPage deprecation version dropped
from 1.25 to 1.21 to match other hooks.

Bug: T145728
Bug: T147382
Bug: T147383
Bug: T147384
Bug: T147385
Bug: T147386
Change-Id: I59b6b9f253857eb1040dad879a71e0d8cf141553
This commit is contained in:
Reedy 2016-10-05 01:20:08 +01:00
parent 34587fa3b2
commit dee0d1ce4e
5 changed files with 16 additions and 8 deletions

View file

@ -214,6 +214,8 @@ changes to languages because of Phabricator reports.
* IP::isConfiguredProxy() and IP::isTrustedProxy() were removed. Callers should * IP::isConfiguredProxy() and IP::isTrustedProxy() were removed. Callers should
migrate to using the same functions on a ProxyLookup instance, obtainable from migrate to using the same functions on a ProxyLookup instance, obtainable from
MediaWikiServices. MediaWikiServices.
* The ArticleViewCustom, EditPageGetDiffText and EditPageGetPreviewText hooks will
now emit deprecation warnings if used.
== Compatibility == == Compatibility ==

View file

@ -3416,7 +3416,7 @@ HTML
} }
if ( $newContent ) { if ( $newContent ) {
ContentHandler::runLegacyHooks( 'EditPageGetDiffText', [ $this, &$newContent ] ); ContentHandler::runLegacyHooks( 'EditPageGetDiffText', [ $this, &$newContent ], '1.21' );
Hooks::run( 'EditPageGetDiffContent', [ $this, &$newContent ] ); Hooks::run( 'EditPageGetDiffContent', [ $this, &$newContent ] );
$popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang ); $popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang );
@ -3829,7 +3829,7 @@ HTML
} }
$hook_args = [ $this, &$content ]; $hook_args = [ $this, &$content ];
ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args ); ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args, '1.25' );
Hooks::run( 'EditPageGetPreviewContent', $hook_args ); Hooks::run( 'EditPageGetPreviewContent', $hook_args );
$parserResult = $this->doPreviewParse( $content ); $parserResult = $this->doPreviewParse( $content );

View file

@ -243,7 +243,7 @@ abstract class ContentHandler {
} }
// Hook can force JS/CSS // Hook can force JS/CSS
Hooks::run( 'TitleIsCssOrJsPage', [ $title, &$isCodePage ], '1.25' ); Hooks::run( 'TitleIsCssOrJsPage', [ $title, &$isCodePage ], '1.21' );
// Is this a user subpage containing code? // Is this a user subpage containing code?
$isCodeSubpage = NS_USER == $ns $isCodeSubpage = NS_USER == $ns
@ -258,7 +258,7 @@ abstract class ContentHandler {
$isWikitext = $isWikitext && !$isCodePage && !$isCodeSubpage; $isWikitext = $isWikitext && !$isCodePage && !$isCodeSubpage;
// Hook can override $isWikitext // Hook can override $isWikitext
Hooks::run( 'TitleIsWikitextPage', [ $title, &$isWikitext ], '1.25' ); Hooks::run( 'TitleIsWikitextPage', [ $title, &$isWikitext ], '1.21' );
if ( !$isWikitext ) { if ( !$isWikitext ) {
switch ( $ext ) { switch ( $ext ) {

View file

@ -620,7 +620,11 @@ class DifferenceEngine extends ContextSource {
} }
} elseif ( !Hooks::run( 'ArticleContentViewCustom', [ $this->mNewContent, $this->mNewPage, $out ] ) ) { } elseif ( !Hooks::run( 'ArticleContentViewCustom', [ $this->mNewContent, $this->mNewPage, $out ] ) ) {
// Handled by extension // Handled by extension
} elseif ( !ContentHandler::runLegacyHooks( 'ArticleViewCustom', [ $this->mNewContent, $this->mNewPage, $out ] ) ) { } elseif ( !ContentHandler::runLegacyHooks(
'ArticleViewCustom',
[ $this->mNewContent, $this->mNewPage, $out ],
'1.21'
) ) {
// NOTE: deprecated hook, B/C only // NOTE: deprecated hook, B/C only
// Handled by extension // Handled by extension
} else { } else {

View file

@ -623,9 +623,11 @@ class Article implements Page {
# Allow extensions do their own custom view for certain pages # Allow extensions do their own custom view for certain pages
$outputDone = true; $outputDone = true;
} elseif ( !ContentHandler::runLegacyHooks( 'ArticleViewCustom', } elseif ( !ContentHandler::runLegacyHooks(
[ $this->fetchContentObject(), $this->getTitle(), $outputPage ] ) ) { 'ArticleViewCustom',
[ $this->fetchContentObject(), $this->getTitle(), $outputPage ],
'1.21'
) ) {
# Allow extensions do their own custom view for certain pages # Allow extensions do their own custom view for certain pages
$outputDone = true; $outputDone = true;
} }