Show a warning in edit preview when a template loop is detected
authorMatěj Suchánek <matejsuchanek97@gmail.com>
Fri, 16 Jun 2017 08:16:11 +0000 (10:16 +0200)
committerMatěj Suchánek <matejsuchanek97@gmail.com>
Fri, 16 Jun 2017 08:16:11 +0000 (10:16 +0200)
Follow-up to Ib888634af.

Bug: T162149
Change-Id: I870dc22c984c900568ccacdc88d1bd31194394e1

includes/parser/Parser.php
languages/i18n/en.json
languages/i18n/qqq.json

index d8722ba..c0a648c 100644 (file)
@@ -3261,6 +3261,8 @@ class Parser {
                                        . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text()
                                        . '</span>';
                                $this->addTrackingCategory( 'template-loop-category' );
                                        . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text()
                                        . '</span>';
                                $this->addTrackingCategory( 'template-loop-category' );
+                               $this->mOutput->addWarning( wfMessage( 'template-loop-warning',
+                                       wfEscapeWikiText( $titleText ) )->text() );
                                wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" );
                        }
                }
                                wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" );
                        }
                }
index 766acf3..fad1314 100644 (file)
        "parser-template-loop-warning": "Template loop detected: [[$1]]",
        "template-loop-category": "Pages with template loops",
        "template-loop-category-desc": "The page contains a template loop, ie. a template which calls itself recursively.",
        "parser-template-loop-warning": "Template loop detected: [[$1]]",
        "template-loop-category": "Pages with template loops",
        "template-loop-category-desc": "The page contains a template loop, ie. a template which calls itself recursively.",
+       "template-loop-warning": "<strong>Warning:</strong> This page calls [[:$1]] which causes a template loop (an infinite recursive call).",
        "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",
        "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",
index 73033d6..ae15883 100644 (file)
        "parser-template-loop-warning": "Parameters:\n* $1 - page title",
        "template-loop-category": "This message is used as a category name for a [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]] where pages with template loops will be listed.",
        "template-loop-category-desc": "Pages with template loops category description. Shown on [[Special:TrackingCategories]].\n\nSee also:\n* {{msg-mw|Template-loop-category}}",
        "parser-template-loop-warning": "Parameters:\n* $1 - page title",
        "template-loop-category": "This message is used as a category name for a [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]] where pages with template loops will be listed.",
        "template-loop-category-desc": "Pages with template loops category description. Shown on [[Special:TrackingCategories]].\n\nSee also:\n* {{msg-mw|Template-loop-category}}",
+       "template-loop-warning": "This message is displayed in edit preview when a template loop is detected on the previewed page.\n\nParameters:\n* $1 - the full title of template which causes the template loop.",
        "parser-template-recursion-depth-warning": "Parameters:\n* $1 - limit value of recursion depth",
        "language-converter-depth-warning": "Error message shown when a page uses too deeply nested language conversion syntax. Parameters:\n* $1 - 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.\n\nSee also:\n* {{msg-mw|Node-count-exceeded-warning}}",
        "parser-template-recursion-depth-warning": "Parameters:\n* $1 - limit value of recursion depth",
        "language-converter-depth-warning": "Error message shown when a page uses too deeply nested language conversion syntax. Parameters:\n* $1 - 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.\n\nSee also:\n* {{msg-mw|Node-count-exceeded-warning}}",