Manual:Hooks/ParserLimitReport

From Linux Web Expert

ParserLimitReport
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
<translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 465792)</tvar></translate>
called at the end of Parser::parse() when the parser will add a report about size and complexity of the text parsed as a HTML comment
<translate> Define function:</translate>
public static function onParserLimitReport( $parser, $limitReport ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ParserLimitReport": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserLimitReport"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> Parser.php
<translate> Function(s):</translate> makeLimitReport
<translate> Interface:</translate> ParserLimitReportHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ParserLimitReport extensions</tvar>.</translate>

Details

Used to create the NewPP parser report. Parameters:

  • $parser: Parser object
  • $limitReport: text that will be included (without comment tags); extensions are expected to append their own lines.

Hints

When adding some limts to a page and show that limit in the limit report, you should also add a limitation warning (Parser::limitationWarn) with a tracking category to get all pages, which reach that limit.