title = $title; $this->msg = $msg; $this->params = $params; // T46111: Messages in the log files should be in English and not // customized by the local wiki. So get the default English version for // passing to the parent constructor. Our overridden report() below // makes sure that the page shown to the user is not forced to English. $enMsg = $this->getMessageObject(); $enMsg->inLanguage( 'en' )->useDatabase( false ); parent::__construct( $enMsg->text() ); } /** * Return a Message object for this exception * @since 1.29 * @return Message */ public function getMessageObject() { if ( $this->msg instanceof Message ) { return clone $this->msg; } return wfMessage( $this->msg, $this->params ); } public function report( $action = self::SEND_OUTPUT ) { if ( self::isCommandLine() || defined( 'MW_API' ) ) { parent::report(); } else { global $wgOut; $wgOut->showErrorPage( $this->title, $this->msg, $this->params ); // Allow skipping of the final output step, so that web-based page views // from MediaWiki.php, can inspect the staged OutputPage state, and perform // graceful shutdown via doPreOutputCommit first, just like for regular // output when there isn't an error page. if ( $action === self::SEND_OUTPUT ) { $wgOut->output(); } } } }