Use the context's WikiPage object if the title of the new revision is the same as...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 15 Jan 2012 22:00:04 +0000 (22:00 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 15 Jan 2012 22:00:04 +0000 (22:00 +0000)
includes/diff/DifferenceEngine.php

index f645d3b..439e320 100644 (file)
@@ -502,7 +502,15 @@ class DifferenceEngine extends ContextSource {
                                // Handled by extension
                        } else {
                                // Normal page
-                               $wikiPage = WikiPage::factory( $this->mNewPage );
+                               if ( $this->getTitle()->equals( $this->mNewPage ) ) {
+                                       // If the Title stored in the context is the same as the one
+                                       // of the new revision, we can use its associated WikiPage
+                                       // object.
+                                       $wikiPage = $this->getWikiPage();
+                               } else {
+                                       // Otherwise we need to create our own WikiPage object
+                                       $wikiPage = WikiPage::factory( $this->mNewPage );
+                               }
 
                                $parserOptions = ParserOptions::newFromContext( $this->getContext() );
                                $parserOptions->enableLimitReport();