From 72feb394572fff7fbc26312dc07d13c247025d96 Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Wed, 13 Apr 2011 22:30:13 +0000 Subject: [PATCH] Unbundle OutputPage::showErrorPage() in Exception.php to allow ErrorPageError objects to be passed a Message object for a more complicated display. --- includes/Exception.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/includes/Exception.php b/includes/Exception.php index ad345a3bbf..0d3cc776cf 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -324,13 +324,35 @@ class ErrorPageError extends MWException { $this->title = $title; $this->msg = $msg; $this->params = $params; - parent::__construct( wfMsg( $msg ) ); + + if( $msg instanceof Message ){ + parent::__construct( $msg ); + } else { + parent::__construct( wfMsg( $msg ) ); + } } function report() { global $wgOut; - $wgOut->showErrorPage( $this->title, $this->msg, $this->params ); + if ( $wgOut->getTitle() ) { + $wgOut->debug( 'Original title: ' . $wgOut->getTitle()->getPrefixedText() . "\n" ); + } + $wgOut->setPageTitle( wfMsg( $this->title ) ); + $wgOut->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); + $wgOut->setRobotPolicy( 'noindex,nofollow' ); + $wgOut->setArticleRelated( false ); + $wgOut->enableClientCache( false ); + $wgOut->mRedirect = ''; + $wgOut->clearHTML(); + + if( $this->msg instanceof Message ){ + $wgOut->addHTML( $this->msg->parse() ); + } else { + $wgOut->addWikiMsgArray( $this->msg, $this->params ); + } + + $wgOut->returnToMain(); $wgOut->output(); } } -- 2.20.1