r109004 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109003‎ | r109004 | r109005 >
Date:22:00, 15 January 2012
Author:ialex
Status:ok
Tags:core 
Comment:
Use the context's WikiPage object if the title of the new revision is the same as context's title; avoids a duplicated database query to load the WikiPage
Modified paths:
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -502,7 +502,15 @@
503503 // Handled by extension
504504 } else {
505505 // Normal page
506 - $wikiPage = WikiPage::factory( $this->mNewPage );
 506+ if ( $this->getTitle()->equals( $this->mNewPage ) ) {
 507+ // If the Title stored in the context is the same as the one
 508+ // of the new revision, we can use its associated WikiPage
 509+ // object.
 510+ $wikiPage = $this->getWikiPage();
 511+ } else {
 512+ // Otherwise we need to create our own WikiPage object
 513+ $wikiPage = WikiPage::factory( $this->mNewPage );
 514+ }
507515
508516 $parserOptions = ParserOptions::newFromContext( $this->getContext() );
509517 $parserOptions->enableLimitReport();

Status & tagging log