From 608879edbff5a2c6a386eceaa494c98a93c7436e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Thu, 15 Nov 2018 18:22:26 -0800 Subject: [PATCH] Add special page class for disabling special pages Similar to the ApiDisabled class, but for special pages. Change-Id: Ib56860bc3f8a14fd332b775b1e7f50953641ee82 --- autoload.php | 1 + includes/specialpage/DisabledSpecialPage.php | 71 ++++++++++++++++++++ languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 4 files changed, 74 insertions(+) create mode 100644 includes/specialpage/DisabledSpecialPage.php diff --git a/autoload.php b/autoload.php index 02e35a85c3..6f253bb783 100644 --- a/autoload.php +++ b/autoload.php @@ -408,6 +408,7 @@ $wgAutoloadLocalClasses = [ 'DifferenceEngine' => __DIR__ . '/includes/diff/DifferenceEngine.php', 'DifferenceEngineSlotDiffRenderer' => __DIR__ . '/includes/diff/DifferenceEngineSlotDiffRenderer.php', 'Digit2Html' => __DIR__ . '/maintenance/language/digit2html.php', + 'DisabledSpecialPage' => __DIR__ . '/includes/specialpage/DisabledSpecialPage.php', 'DjVuHandler' => __DIR__ . '/includes/media/DjVuHandler.php', 'DjVuImage' => __DIR__ . '/includes/media/DjVuImage.php', 'DnsSrvDiscoverer' => __DIR__ . '/includes/libs/DnsSrvDiscoverer.php', diff --git a/includes/specialpage/DisabledSpecialPage.php b/includes/specialpage/DisabledSpecialPage.php new file mode 100644 index 0000000000..ebcd8e58cc --- /dev/null +++ b/includes/specialpage/DisabledSpecialPage.php @@ -0,0 +1,71 @@ +errorMessage = $errorMessage ?: 'disabledspecialpage-disabled'; + } + + public function execute( $subPage ) { + $this->setHeaders(); + $this->outputHeader(); + + $error = Html::rawElement( 'div', [ + 'class' => 'error', + ], $this->msg( $this->errorMessage )->parseAsBlock() ); + $this->getOutput()->addHTML( $error ); + } + +} diff --git a/languages/i18n/en.json b/languages/i18n/en.json index ba6353f795..28fae1e40e 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -3943,6 +3943,7 @@ "specialpages-group-developer": "Developer tools", "blankpage": "Blank page", "intentionallyblankpage": "This page is intentionally left blank.", + "disabledspecialpage-disabled": "This page has been disabled by a system administrator.", "external_image_whitelist": " #Leave this line exactly as it is
\n#Put regular expression fragments (just the part that goes between the //) below\n#These will be matched with the URLs of external (hotlinked) images\n#Those that match will be displayed as images, otherwise only a link to the image will be shown\n#Lines beginning with # are treated as comments\n#This is case-insensitive\n\n#Put all regex fragments above this line. Leave this line exactly as it is
", "tags": "Valid change tags", "tags-summary": "", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 1d058893ff..7261affe74 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -4146,6 +4146,7 @@ "specialpages-group-developer": "{{doc-special-group|that=are related to tools for developers}}", "blankpage": "{{doc-special|BlankPage|unlisted=1}}\nSee also:\n* {{msg-mw|Intentionallyblankpage|text}}", "intentionallyblankpage": "Text displayed in [[Special:BlankPage]].\n\nSee also:\n* {{msg-mw|Intentionallyblankpage|page title}}", + "disabledspecialpage-disabled": "Default message used on disabled special pages.", "external_image_whitelist": "As usual please leave all the wiki markup, including the spaces, as they are. You can translate the text, including 'Leave this line exactly as it is'. The first line of this messages has one (1) leading space.\n\nSee definition of [[w:Regular_expression|regular expression]] on Wikipedia.", "tags": "Shown on [[Special:Specialpages]] for page listing the tags that the software may mark an edit with, and their meaning. For more information on tags see [[mw:Manual:Tags|MediaWiki]].\n\nIt appears that the word 'valid' describes 'tags', not 'change'. It also appears that you could use the term 'defined' instead of 'valid', or perhaps use a phrase meaning 'The change tags that are in use'.", "tags-summary": "{{doc-specialpagesummary|tags}}", -- 2.20.1