From: Happy-melon Date: Wed, 13 Apr 2011 22:30:13 +0000 (+0000) Subject: Unbundle OutputPage::showErrorPage() in Exception.php to allow ErrorPageError objects... X-Git-Tag: 1.31.0-rc.0~30867 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=72feb394572fff7fbc26312dc07d13c247025d96;p=lhc%2Fweb%2Fwiklou.git Unbundle OutputPage::showErrorPage() in Exception.php to allow ErrorPageError objects to be passed a Message object for a more complicated display. --- 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(); } }