Deprecate infrequently-used parser-related hooks
The following parser-related hooks have no users in deployed code: - InternalParseBeforeSanitize - ParserFetchTemplate - ParserSectionCreate - ParserPreSaveTransformComplete - BeforeParserrenderImageGallery Code search in WMF-deployed code: https://codesearch.wmflabs.org/deployed/?q=%5Cb%28InternalParseBeforeSanitize%7CParserFetchTemplate%7CParserSectionCreate%7CParserPreSaveTransformComplete%7CBeforeParserrenderImageGallery%29%5Cb&i=nope&files=&repos= Code search in all code: https://codesearch.wmflabs.org/search/?q=%5Cb%28InternalParseBeforeSanitize%7CParserFetchTemplate%7CParserSectionCreate%7CParserPreSaveTransformComplete%7CBeforeParserrenderImageGallery%29%5Cb&i=nope&files=&repos= Removing as many infrequently-used hooks as possible will aid our transition from the legacy parser to alternative parsers. Bug: T236809 Change-Id: I3a09fbe6436232ae0b417ad61b19f8df6d0485e0
This commit is contained in:
parent
7a2331706f
commit
d8bb54a965
3 changed files with 27 additions and 10 deletions
|
|
@ -869,6 +869,18 @@ because of Phabricator reports.
|
|||
- ::$mRevisionSize
|
||||
- ::$mInputSize
|
||||
- ::$mInParse
|
||||
* The following parser-related hooks have been deprecated:
|
||||
- InternalParseBeforeSanitize
|
||||
* Use an alternative hook which doesn't expose internal half-parsed state,
|
||||
like ParserBeforeInternalParse or ParserAfterTidy
|
||||
- ParserFetchTemplate
|
||||
* Use BeforeParserFetchTemplateAndTitle
|
||||
- ParserSectionCreate
|
||||
* No replacement; <section> tag wrapping will be done by core in future.
|
||||
- ParserPreSaveTransformComplete
|
||||
* No replacement; Content::preSaveTransform() provides for customizable PSTs
|
||||
- BeforeParserrenderImageGallery
|
||||
* No replacement; MediaHandler provides for customizable media rendering
|
||||
* The accessor/mutator methods Parser::Options(), Parser::OutputType(), and
|
||||
Parser::Title() have been deprecated; use the appropriate Parser::get*
|
||||
or Parser::set* methods instead.
|
||||
|
|
|
|||
|
|
@ -854,7 +854,8 @@ $title: title of the template
|
|||
&$skip: skip this template and link it?
|
||||
&$id: the id of the revision being parsed
|
||||
|
||||
'BeforeParserrenderImageGallery': Before an image gallery is rendered by Parser.
|
||||
'BeforeParserrenderImageGallery': DEPRECATED since 1.35!
|
||||
Before an image gallery is rendered by Parser.
|
||||
[&]$parser: Parser object
|
||||
[&]$ig: ImageGallery object
|
||||
|
||||
|
|
@ -1900,7 +1901,8 @@ but after nowiki/noinclude/includeonly/onlyinclude and other processings.
|
|||
&$text: string containing partially parsed text
|
||||
[&]$stripState: Parser's internal StripState object
|
||||
|
||||
'InternalParseBeforeSanitize': during Parser's internalParse method just before
|
||||
'InternalParseBeforeSanitize': DEPRECATED since 1.35!
|
||||
During Parser's internalParse method just before
|
||||
the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/
|
||||
includeonly/onlyinclude and other processings. Ideal for syntax-extensions after
|
||||
template/parser function execution which respect nowiki and HTML-comments.
|
||||
|
|
@ -2595,7 +2597,8 @@ $revId: ID of the revision that was parsed to create $parserOutput
|
|||
'ParserCloned': Called when the parser is cloned.
|
||||
$parser: Newly-cloned Parser object
|
||||
|
||||
'ParserFetchTemplate': Called when the parser fetches a template
|
||||
'ParserFetchTemplate': DEPRECATED since 1.35!
|
||||
Called when the parser fetches a template
|
||||
$parser: Parser Parser object or false
|
||||
$title: Title object of the template to be fetched
|
||||
$rev: Revision object of the template
|
||||
|
|
@ -2666,13 +2669,15 @@ $parserOutput: The ParserOutput object.
|
|||
&$text: The text being transformed, before core transformations are done.
|
||||
&$options: The options array being used for the transformation.
|
||||
|
||||
'ParserPreSaveTransformComplete': Called from Parser::preSaveTransform() after
|
||||
'ParserPreSaveTransformComplete': DEPRECATED since 1.35!
|
||||
Called from Parser::preSaveTransform() after
|
||||
processing is complete, giving the extension a chance to further modify the
|
||||
wikitext.
|
||||
$parser: the calling Parser instance
|
||||
&$text: The transformed text, which can be modified by the hook
|
||||
|
||||
'ParserSectionCreate': Called each time the parser creates a document section
|
||||
'ParserSectionCreate': DEPRECATED since 1.35!
|
||||
Called each time the parser creates a document section
|
||||
from wikitext. Use this to apply per-section modifications to HTML (like
|
||||
wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV
|
||||
can begin in one section and end in another. Make sure your code can handle
|
||||
|
|
|
|||
|
|
@ -1548,7 +1548,7 @@ class Parser {
|
|||
$text = $this->replaceVariables( $text );
|
||||
}
|
||||
|
||||
Hooks::run( 'InternalParseBeforeSanitize', [ &$parser, &$text, &$this->mStripState ] );
|
||||
Hooks::run( 'InternalParseBeforeSanitize', [ &$parser, &$text, &$this->mStripState ], '1.35' );
|
||||
$text = Sanitizer::removeHTMLtags(
|
||||
$text,
|
||||
// Callback from the Sanitizer for expanding items found in
|
||||
|
|
@ -3934,7 +3934,7 @@ class Parser {
|
|||
$text = $content ? $content->getWikitextForTransclusion() : null;
|
||||
|
||||
Hooks::run( 'ParserFetchTemplate',
|
||||
[ $parser, $title, $rev, &$text, &$deps ] );
|
||||
[ $parser, $title, $rev, &$text, &$deps ], '1.35' );
|
||||
|
||||
if ( $text === false || $text === null ) {
|
||||
$text = false;
|
||||
|
|
@ -4715,7 +4715,7 @@ class Parser {
|
|||
* &$sectionContent : ref to the content of the section
|
||||
* $maybeShowEditLinks : boolean describing whether this section has an edit link
|
||||
*/
|
||||
Hooks::run( 'ParserSectionCreate', [ $this, $i, &$sections[$i], $maybeShowEditLink ] );
|
||||
Hooks::run( 'ParserSectionCreate', [ $this, $i, &$sections[$i], $maybeShowEditLink ], '1.35' );
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -4769,7 +4769,7 @@ class Parser {
|
|||
$text = $this->mStripState->unstripBoth( $text );
|
||||
|
||||
Hooks::run( 'ParserPreSaveTransformComplete',
|
||||
[ $this, &$text ] );
|
||||
[ $this, &$text ], '1.35' );
|
||||
|
||||
$this->setUser( null ); # Reset
|
||||
|
||||
|
|
@ -5279,7 +5279,7 @@ class Parser {
|
|||
|
||||
// Avoid PHP 7.1 warning from passing $this by reference
|
||||
$parser = $this;
|
||||
Hooks::run( 'BeforeParserrenderImageGallery', [ &$parser, &$ig ] );
|
||||
Hooks::run( 'BeforeParserrenderImageGallery', [ &$parser, &$ig ], '1.35' );
|
||||
|
||||
$lines = StringUtils::explode( "\n", $text );
|
||||
foreach ( $lines as $line ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue