r95470 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95469‎ | r95470 | r95471 >
Date:10:13, 25 August 2011
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Followup r85994: eliminate code duplication introduced by this revision, instead make OutputPage::showErrorPage() accept Message objects
Modified paths:
  • /trunk/phase3/includes/Exception.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Exception.php
@@ -255,24 +255,7 @@
256256 function report() {
257257 global $wgOut;
258258
259 - if ( $wgOut->getTitle() ) {
260 - $wgOut->debug( 'Original title: ' . $wgOut->getTitle()->getPrefixedText() . "\n" );
261 - }
262 - $wgOut->setPageTitle( wfMsg( $this->title ) );
263 - $wgOut->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
264 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
265 - $wgOut->setArticleRelated( false );
266 - $wgOut->enableClientCache( false );
267 - $wgOut->mRedirect = '';
268 - $wgOut->clearHTML();
269 -
270 - if( $this->msg instanceof Message ){
271 - $wgOut->addHTML( $this->msg->parse() );
272 - } else {
273 - $wgOut->addWikiMsgArray( $this->msg, $this->params );
274 - }
275 -
276 - $wgOut->returnToMain();
 259+ $wgOut->showErrorPage( $this->title, $this->msg, $this->params );
277260 $wgOut->output();
278261 }
279262 }
Index: trunk/phase3/includes/OutputPage.php
@@ -1893,9 +1893,12 @@
18941894 /**
18951895 * Output a standard error page
18961896 *
 1897+ * showErrorPage( 'titlemsg', 'pagetextmsg', array( 'param1', 'param2' ) );
 1898+ * showErrorPage( 'titlemsg', $messageObject );
 1899+ *
18971900 * @param $title String: message key for page title
1898 - * @param $msg String: message key for page text
1899 - * @param $params Array: message parameters
 1901+ * @param $msg Mixed: message key (string) for page text, or a Message object
 1902+ * @param $params Array: message parameters; ignored if $msg is a Message object
19001903 */
19011904 public function showErrorPage( $title, $msg, $params = array() ) {
19021905 if ( $this->getTitle() ) {
@@ -1909,7 +1912,11 @@
19101913 $this->mRedirect = '';
19111914 $this->mBodytext = '';
19121915
1913 - $this->addWikiMsgArray( $msg, $params );
 1916+ if ( $msg instanceof Message ){
 1917+ $wgOut->addHTML( $msg->parse() );
 1918+ } else {
 1919+ $wgOut->addWikiMsgArray( $msg, $params );
 1920+ }
19141921
19151922 $this->returnToMain();
19161923 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r95475Fix stupid copypaste mistake in r95470catrope10:56, 25 August 2011
r964981.18: MFT r95171, r95409, r95436, r95458, r95467, r95470, r95475, r95493, r95...catrope21:04, 7 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85994Unbundle OutputPage::showErrorPage() in Exception.php to allow ErrorPageError...happy-melon22:30, 13 April 2011

Comments

#Comment by Siebrand (talk | contribs)   10:56, 25 August 2011

PHP Notice: Undefined variable: wgOut in /www/w/includes/OutputPage.php on line 1918

#Comment by Catrope (talk | contribs)   10:57, 25 August 2011

Fixed in r95475.

Status & tagging log