r35221 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35220‎ | r35221 | r35222 >
Date:09:00, 23 May 2008
Author:tstarling
Status:old
Tags:
Comment:
Fixed sloppy usage of Database::selectField() in getPreviousRevisionID() and getNextRevisionID()
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -2932,8 +2932,13 @@
29332933 public function getPreviousRevisionID( $revision, $flags=0 ) {
29342934 $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
29352935 return $db->selectField( 'revision', 'rev_id',
2936 - 'rev_page=' . intval( $this->getArticleId($flags) ) .
2937 - ' AND rev_id<' . intval( $revision ) . ' ORDER BY rev_id DESC' );
 2936+ array(
 2937+ 'rev_page' => $this->getArticleId($flags),
 2938+ 'rev_id < ' . intval( $revision )
 2939+ ),
 2940+ __METHOD__,
 2941+ array( 'ORDER BY' => 'rev_id DESC' )
 2942+ );
29382943 }
29392944
29402945 /**
@@ -2946,8 +2951,13 @@
29472952 public function getNextRevisionID( $revision, $flags=0 ) {
29482953 $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
29492954 return $db->selectField( 'revision', 'rev_id',
2950 - 'rev_page=' . intval( $this->getArticleId($flags) ) .
2951 - ' AND rev_id>' . intval( $revision ) . ' ORDER BY rev_id' );
 2955+ array(
 2956+ 'rev_page' => $this->getArticleId($flags),
 2957+ 'rev_id > ' . intval( $revision )
 2958+ ),
 2959+ __METHOD__,
 2960+ array( 'ORDER BY' => 'rev_id' )
 2961+ );
29522962 }
29532963
29542964 /**

Status & tagging log