From: Alexandre Emsenhuber Date: Sun, 15 Jan 2012 22:00:04 +0000 (+0000) Subject: Use the context's WikiPage object if the title of the new revision is the same as... X-Git-Tag: 1.31.0-rc.0~25253 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=4ef1cc76ecc2887323d34bc6b717bd04c6670f1f;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index f645d3b538..439e3204ec 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -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();