From 069a4b22800bf2fde9c59bc9bcea4123f1c30dc7 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 21 Apr 2012 13:09:03 +0200 Subject: [PATCH] (bug 22887) Add warning and tracking category for preprocessor errors I have only add things and not change the current error strings to messages, because bug 21521 is WONTFIX Change of Preprocessor_HipHop.php is not tested Change-Id: I7a7243b8ba010dbb395bdbbb3e00e3217088038e --- RELEASE-NOTES-1.20 | 1 + includes/parser/Preprocessor_DOM.php | 8 ++++++++ includes/parser/Preprocessor_Hash.php | 8 ++++++++ includes/parser/Preprocessor_HipHop.hphp | 8 ++++++++ languages/messages/MessagesEn.php | 4 ++++ languages/messages/MessagesQqq.php | 10 ++++++++++ maintenance/language/messages.inc | 4 ++++ 7 files changed, 43 insertions(+) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 318768cd77..a9e9a32898 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -45,6 +45,7 @@ production. * (bug 35685) api.php URL and other entry point URLs are now listed on Special:Version * Edit notices can now be translated. +* (bug 22887) Add warning and tracking category for preprocessor errors === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index f129f73df8..18bd01c8b2 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -958,10 +958,18 @@ class PPFrame_DOM implements PPFrame { } if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->getMaxPPNodeCount() ) { + $this->parser->limitationWarn( 'node-count-exceeded', + $this->parser->mPPNodeCount, + $this->parser->mOptions->getMaxPPNodeCount() + ); return 'Node-count limit exceeded'; } if ( $expansionDepth > $this->parser->mOptions->getMaxPPExpandDepth() ) { + $this->parser->limitationWarn( 'expansion-depth-exceeded', + $expansionDepth, + $this->parser->mOptions->getMaxPPExpandDepth() + ); return 'Expansion depth limit exceeded'; } wfProfileIn( __METHOD__ ); diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 28283c74b2..4acb1240c6 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -915,9 +915,17 @@ class PPFrame_Hash implements PPFrame { } if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->getMaxPPNodeCount() ) { + $this->parser->limitationWarn( 'node-count-exceeded', + $this->parser->mPPNodeCount, + $this->parser->mOptions->getMaxPPNodeCount() + ); return 'Node-count limit exceeded'; } if ( $expansionDepth > $this->parser->mOptions->getMaxPPExpandDepth() ) { + $this->parser->limitationWarn( 'expansion-depth-exceeded', + $expansionDepth, + $this->parser->mOptions->getMaxPPExpandDepth() + ); return 'Expansion depth limit exceeded'; } ++$expansionDepth; diff --git a/includes/parser/Preprocessor_HipHop.hphp b/includes/parser/Preprocessor_HipHop.hphp index aedcac23a5..a23168ad6f 100644 --- a/includes/parser/Preprocessor_HipHop.hphp +++ b/includes/parser/Preprocessor_HipHop.hphp @@ -1073,9 +1073,17 @@ class PPFrame_HipHop implements PPFrame { } if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->getMaxPPNodeCount() ) { + $this->parser->limitationWarn( 'node-count-exceeded', + $this->parser->mPPNodeCount, + $this->parser->mOptions->getMaxPPNodeCount() + ); return 'Node-count limit exceeded'; } if ( $expansionDepth > $this->parser->mOptions->getMaxPPExpandDepth() ) { + $this->parser->limitationWarn( 'expansion-depth-exceeded', + $expansionDepth, + $this->parser->mOptions->getMaxPPExpandDepth() + ); return 'Expansion depth limit exceeded'; } ++$expansionDepth; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 2fa9002736..bb080780fd 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1478,6 +1478,10 @@ These arguments have been omitted.", 'parser-template-loop-warning' => 'Template loop detected: [[$1]]', 'parser-template-recursion-depth-warning' => 'Template recursion depth limit exceeded ($1)', 'language-converter-depth-warning' => 'Language converter depth limit exceeded ($1)', +'node-count-exceeded-category' => 'Pages where node-count is exceeded', +'node-count-exceeded-warning' => 'Page exceeded the node-count', +'expansion-depth-exceeded-category' => 'Pages where expansion depth is exceeded', +'expansion-depth-exceeded-warning' => 'Page exceeded the expansion depth', # "Undo" feature 'undo-success' => 'The edit can be undone. diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index bd7733e36e..a9c77ee8b0 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -1020,6 +1020,16 @@ When templates are expanded, there is a size limit for the number of bytes yield 'language-converter-depth-warning' => 'Error message shown when a page uses too deeply nested language conversion syntax * $1 is the value of the depth limit', +'node-count-exceeded-category' => 'This message is used as a category name for a [[mw:Help:Tracking categories|tracking category]] where pages are placed automatically if the node-count of the preprocessor exceeds the limit.', +'node-count-exceeded-warning' => 'Error message shown when a page exceeded the node-count limit of the preprocessor + +* $1 is the value of the node-count limit +* $2 is the value of the max node-count limit', +'expansion-depth-exceeded-category' => 'This message is used as a category name for a [[mw:Help:Tracking categories|tracking category]] where pages are placed automatically if the expansion depth of the preprocessor exceeds the limit.', +'expansion-depth-exceeded-warning' => 'Error message shown when a page exceeded the expansion depth limit of the preprocessor + +* $1 is the value of the depth limit +* $2 is the value of the max depth limit', # "Undo" feature 'undo-success' => 'Text on special page to confirm edit revert. You arrive on this page by clicking on the "undo" link on a revision history special page. diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index b65600070b..d22449b8c3 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -688,6 +688,10 @@ $wgMessageStructure = array( 'parser-template-loop-warning', 'parser-template-recursion-depth-warning', 'language-converter-depth-warning', + 'node-count-exceeded-category', + 'node-count-exceeded-warning', + 'expansion-depth-exceeded-category', + 'expansion-depth-exceeded-warning', ), 'undo' => array( 'undo-success', -- 2.20.1