From: Roan Kattouw Date: Thu, 25 Aug 2011 10:13:30 +0000 (+0000) Subject: Followup r85994: eliminate code duplication introduced by this revision, instead... X-Git-Tag: 1.31.0-rc.0~28073 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=7d1384b58d0497cc59584bf01f22263681a2e036;p=lhc%2Fweb%2Fwiklou.git Followup r85994: eliminate code duplication introduced by this revision, instead make OutputPage::showErrorPage() accept Message objects --- diff --git a/includes/Exception.php b/includes/Exception.php index 7660060363..f380d5d0b4 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -255,24 +255,7 @@ class ErrorPageError extends MWException { function report() { global $wgOut; - 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->showErrorPage( $this->title, $this->msg, $this->params ); $wgOut->output(); } } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1b6dd800bb..bf4b184282 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1893,9 +1893,12 @@ class OutputPage extends ContextSource { /** * Output a standard error page * + * showErrorPage( 'titlemsg', 'pagetextmsg', array( 'param1', 'param2' ) ); + * showErrorPage( 'titlemsg', $messageObject ); + * * @param $title String: message key for page title - * @param $msg String: message key for page text - * @param $params Array: message parameters + * @param $msg Mixed: message key (string) for page text, or a Message object + * @param $params Array: message parameters; ignored if $msg is a Message object */ public function showErrorPage( $title, $msg, $params = array() ) { if ( $this->getTitle() ) { @@ -1909,7 +1912,11 @@ class OutputPage extends ContextSource { $this->mRedirect = ''; $this->mBodytext = ''; - $this->addWikiMsgArray( $msg, $params ); + if ( $msg instanceof Message ){ + $wgOut->addHTML( $msg->parse() ); + } else { + $wgOut->addWikiMsgArray( $msg, $params ); + } $this->returnToMain(); }