MediaWiki  master
UserBlockedError.php
Go to the documentation of this file.
1 <?php
24 
40  public function __construct(
41  Block $block,
42  UserIdentity $user = null,
43  Language $language = null,
44  $ip = null
45  ) {
46  if ( $user === null || $language === null || $ip === null ) {
47  // If any of these are not passed in, use the global context
48  $context = RequestContext::getMain();
49  $user = $context->getUser();
50  $language = $context->getLanguage();
51  $ip = $context->getRequest()->getIP();
52  }
53 
54  // @todo This should be passed in via the constructor
55  $message = MediaWikiServices::getInstance()->getBlockErrorFormatter()
56  ->getMessage( $block, $user, $language, $ip );
57  parent::__construct( 'blockedtitle', $message );
58  }
59 }
UserBlockedError
Show an error when the user tries to do something whilst blocked.
Definition: UserBlockedError.php:32
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:193
UserBlockedError\__construct
__construct(Block $block, UserIdentity $user=null, Language $language=null, $ip=null)
Definition: UserBlockedError.php:40
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition: UserIdentity.php:39
MediaWiki\Block\Block
Represents a block that may prevent users from performing specific operations.
Definition: Block.php:37
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:484
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:30
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:42