r83304 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83303‎ | r83304 | r83305 >
Date:17:55, 5 March 2011
Author:ialex
Status:ok
Tags:
Comment:
Follow-up r83240: seems people prefer returning false than the current version when no revision with given ID is found
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -4543,7 +4543,7 @@
45444544 * @since 1.16 (r52326) for LiquidThreads
45454545 *
45464546 * @param $oldid mixed integer Revision ID or null
4547 - * @return ParserOutput
 4547+ * @return ParserOutput or false if the given revsion ID is not found
45484548 */
45494549 public function getParserOutput( $oldid = null ) {
45504550 global $wgEnableParserCache, $wgUser;
@@ -4567,17 +4567,16 @@
45684568 }
45694569 }
45704570
4571 - $text = false;
45724571 // Cache miss; parse and output it.
4573 - if ( $oldid !== null ) {
 4572+ if ( $oldid === null ) {
 4573+ $text = $this->getRawText();
 4574+ } else {
45744575 $rev = Revision::newFromTitle( $this->getTitle(), $oldid );
4575 - if ( $rev !== null ) {
4576 - $text = $rev->getText();
 4576+ if ( $rev === null ) {
 4577+ return false;
45774578 }
 4579+ $text = $rev->getText();
45784580 }
4579 - if ( $text === false ) {
4580 - $text = $this->getRawText();
4581 - }
45824581
45834582 return $this->getOutputFromWikitext( $text, $useParserCache );
45844583 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r83311Follow-up r83304: don't crash if Article::getParserOutput() returns falseialex19:17, 5 March 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83240* (bug 27763) Article::getParserOutput() no longer throws a fatal given when ...ialex20:16, 4 March 2011

Status & tagging log