* Use $this->getRevision() to get the latest revision instead of loading it each...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 5 Feb 2012 18:45:07 +0000 (18:45 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 5 Feb 2012 18:45:07 +0000 (18:45 +0000)
* Moved wfGetDB( DB_MASTER ) a bit after so that it is only called when needed

includes/WikiPage.php

index 5966299..45d3ebf 100644 (file)
@@ -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',