MediaWiki master
DisabledSpecialPage.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\SpecialPage;
25
26use Closure;
29
42
44 protected $errorMessage;
45
52 public static function getCallback( $name, $errorMessage = null ) {
53 return static function () use ( $name, $errorMessage ) {
54 return new DisabledSpecialPage( $name, $errorMessage );
55 };
56 }
57
62 public function __construct( $name, $errorMessage = null ) {
63 parent::__construct( $name );
64 $this->errorMessage = $errorMessage ?: 'disabledspecialpage-disabled';
65 }
66
67 public function execute( $subPage ) {
68 $this->setHeaders();
69 $this->outputHeader();
70
71 $error = Html::rawElement( 'div', [
72 'class' => 'error',
73 ], $this->msg( $this->errorMessage )->parseAsBlock() );
74 $this->getOutput()->addHTML( $error );
75 }
76
77}
78
80class_alias( DisabledSpecialPage::class, 'DisabledSpecialPage' );
This class is a collection of static functions that serve two purposes:
Definition Html.php:56
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:157
This class is a drop-in replacement for other special pages that need to be manually disabled.
static getCallback( $name, $errorMessage=null)
Create a callback suitable for use in $wgSpecialPages.
execute( $subPage)
Default execute method Checks user permissions.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Shortcut to construct a special page which is unlisted by default.