Follow-up r83240: seems people prefer returning false than the current version when...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 5 Mar 2011 17:55:21 +0000 (17:55 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 5 Mar 2011 17:55:21 +0000 (17:55 +0000)
includes/Article.php

index 85226be..63d9bf9 100644 (file)
@@ -4543,7 +4543,7 @@ class Article {
         * @since 1.16 (r52326) for LiquidThreads
         *
         * @param $oldid mixed integer Revision ID or null
-        * @return ParserOutput
+        * @return ParserOutput or false if the given revsion ID is not found
         */
        public function getParserOutput( $oldid = null ) {
                global $wgEnableParserCache, $wgUser;
@@ -4567,16 +4567,15 @@ class Article {
                        }
                }
 
-               $text = false;
                // Cache miss; parse and output it.
-               if ( $oldid !== null ) {
+               if ( $oldid === null ) {
+                       $text = $this->getRawText();
+               } else {
                        $rev = Revision::newFromTitle( $this->getTitle(), $oldid );
-                       if ( $rev !== null ) {
-                               $text = $rev->getText();
+                       if ( $rev === null ) {
+                               return false;
                        }
-               }
-               if ( $text === false ) {
-                       $text = $this->getRawText();
+                       $text = $rev->getText();
                }
 
                return $this->getOutputFromWikitext( $text, $useParserCache );