Followup r85994: eliminate code duplication introduced by this revision, instead...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 25 Aug 2011 10:13:30 +0000 (10:13 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 25 Aug 2011 10:13:30 +0000 (10:13 +0000)
includes/Exception.php
includes/OutputPage.php

index 7660060..f380d5d 100644 (file)
@@ -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();
        }
 }
index 1b6dd80..bf4b184 100644 (file)
@@ -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();
        }