From: Jackmcbarn Date: Wed, 3 Sep 2014 14:25:47 +0000 (-0400) Subject: Warn when a restricted displaytitle is ignored X-Git-Tag: 1.31.0-rc.0~6983^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=b34d4e2cf394c356ef3ad0d4c11a424266e2e683;p=lhc%2Fweb%2Fwiklou.git Warn when a restricted displaytitle is ignored If a page contains a call to DISPLAYTITLE that is ignored because of $wgRestrictDisplayTitle, output a warning. Bug: 26546 Change-Id: I6ae6d5d0e567ba9c86e46c32240ee51a2ca5d8d1 --- diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index a55ddf3f66..3b8b513dfd 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -456,10 +456,18 @@ class CoreParserFunctions { $converter->markNoConversion( wfEscapeWikiText( $text ) ) )->inContentLanguage()->text() . ''; + } else { + return ''; } + } else { + $converter = $parser->getConverterLanguage()->getConverter(); + return '' . + wfMessage( 'restricted-displaytitle', + // Message should be parsed, but this param should only be escaped. + $converter->markNoConversion( wfEscapeWikiText( $text ) ) + )->inContentLanguage()->text() . + ''; } - - return ''; } /** diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 10072b9e2b..10bf2c989e 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -3513,6 +3513,7 @@ "timezone-local": "Local", "duplicate-defaultsort": "Warning: Default sort key \"$2\" overrides earlier default sort key \"$1\".", "duplicate-displaytitle": "Warning: Display title \"$2\" overrides earlier display title \"$1\".", + "restricted-displaytitle": "Warning: Display title \"$1\" was ignored since it is not equivalent to the page's actual title.", "invalid-indicator-name": "Error: Page status indicators' name attribute must not be empty.", "version": "Version", "version-summary": "", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index bc92b05c0a..0a38088be8 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -3691,6 +3691,7 @@ "timezone-local": "Label to indicate that a time is in the user's local timezone.\n{{Identical|Local}}", "duplicate-defaultsort": "See definition of [[w:Sorting|sort key]] on Wikipedia. Parameters:\n* $1 - old default sort key\n* $2 - new default sort key", "duplicate-displaytitle": "Warning shown when a page has its display title set multiple times. Parameters:\n* $1 - old display title\n* $2 - new display title", + "restricted-displaytitle": "Warning shown a display title is ignored because it is not equivalent to its actual title. Parameters:\n* $1 - the ignored display title", "invalid-indicator-name": "Warning shown when the [https://www.mediawiki.org/wiki/Help:Page_status_indicators <indicator name=\"''unique-identifier''\">''content''</indicator>] parser tag is used incorrectly.", "version": "{{doc-special|Version}}\n{{Identical|Version}}", "version-summary": "{{doc-specialpagesummary|version}}", diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 23bdbde92f..e8baa3fe9e 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -20592,6 +20592,7 @@ this is not the the title !! html/php Screen

this is not the the title +Warning: Display title "whatever" was ignored since it is not equivalent to the page's actual title.

!! end