MediaWiki REL1_32
ErrorPageError.php
Go to the documentation of this file.
1<?php
29
37 public function __construct( $title, $msg, $params = [] ) {
38 $this->title = $title;
39 $this->msg = $msg;
40 $this->params = $params;
41
42 // T46111: Messages in the log files should be in English and not
43 // customized by the local wiki. So get the default English version for
44 // passing to the parent constructor. Our overridden report() below
45 // makes sure that the page shown to the user is not forced to English.
46 $enMsg = $this->getMessageObject();
47 $enMsg->inLanguage( 'en' )->useDatabase( false );
48 parent::__construct( $enMsg->text() );
49 }
50
56 public function getMessageObject() {
57 if ( $this->msg instanceof Message ) {
58 return clone $this->msg;
59 }
60 return wfMessage( $this->msg, $this->params );
61 }
62
63 public function report() {
64 if ( self::isCommandLine() || defined( 'MW_API' ) ) {
65 parent::report();
66 } else {
67 global $wgOut;
68 $wgOut->showErrorPage( $this->title, $this->msg, $this->params );
69 $wgOut->output();
70 }
71 }
72}
$wgOut
Definition Setup.php:915
An error page which can definitely be safely rendered using the OutputPage.
report()
Output a report about the exception and takes care of formatting.
getMessageObject()
Return a Message object for this exception.
__construct( $title, $msg, $params=[])
Note: these arguments are keys into wfMessage(), not text!
MediaWiki exception.
msg( $key, $fallback)
Get a message from i18n.
The Message class provides methods which fulfil two basic services:
Definition Message.php:160
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
Interface for MediaWiki-localized exceptions.