r110724 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110723‎ | r110724 | r110725 >
Date:18:45, 5 February 2012
Author:ialex
Status:ok
Tags:
Comment:
* 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
Modified paths:
  • /trunk/phase3/includes/WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WikiPage.php
@@ -2133,7 +2133,7 @@
21342134 }
21352135
21362136 # Get the last editor
2137 - $current = Revision::newFromTitle( $this->mTitle );
 2137+ $current = $this->getRevision();
21382138 if ( is_null( $current ) ) {
21392139 # Something wrong... no page?
21402140 return array( array( 'notanarticle' ) );
@@ -2431,9 +2431,8 @@
24322432 public function getAutoDeleteReason( &$hasHistory ) {
24332433 global $wgContLang;
24342434
2435 - $dbw = wfGetDB( DB_MASTER );
24362435 // Get the last revision
2437 - $rev = Revision::newFromTitle( $this->getTitle() );
 2436+ $rev = $this->getRevision();
24382437
24392438 if ( is_null( $rev ) ) {
24402439 return false;
@@ -2454,6 +2453,8 @@
24552454 }
24562455 }
24572456
 2457+ $dbw = wfGetDB( DB_MASTER );
 2458+
24582459 // Find out if there was only one contributor
24592460 // Only scan the last 20 revisions
24602461 $res = $dbw->select( 'revision', 'rev_user_text',

Status & tagging log