From 7f53e6250848b1525a29ed44d7551b40afdd2274 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 5 Feb 2012 18:45:07 +0000 Subject: [PATCH] * Use $this->getRevision() to get the latest revision instead of loading it each time from the database * Moved wfGetDB( DB_MASTER ) a bit after so that it is only called when needed --- includes/WikiPage.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 5966299a09..45d3ebf6e9 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2133,7 +2133,7 @@ class WikiPage extends Page { } # Get the last editor - $current = Revision::newFromTitle( $this->mTitle ); + $current = $this->getRevision(); if ( is_null( $current ) ) { # Something wrong... no page? return array( array( 'notanarticle' ) ); @@ -2431,9 +2431,8 @@ class WikiPage extends Page { public function getAutoDeleteReason( &$hasHistory ) { global $wgContLang; - $dbw = wfGetDB( DB_MASTER ); // Get the last revision - $rev = Revision::newFromTitle( $this->getTitle() ); + $rev = $this->getRevision(); if ( is_null( $rev ) ) { return false; @@ -2454,6 +2453,8 @@ class WikiPage extends Page { } } + $dbw = wfGetDB( DB_MASTER ); + // Find out if there was only one contributor // Only scan the last 20 revisions $res = $dbw->select( 'revision', 'rev_user_text', -- 2.20.1