r39761 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39760‎ | r39761 | r39762 >
Date:12:25, 21 August 2008
Author:aaron
Status:old
Tags:
Comment:
respect for_update
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php
@@ -51,8 +51,10 @@
5252 */
5353 public static function newFromTitle( $title, $revId, $flags = 0 ) {
5454 $columns = self::selectFields();
 55+ $options = array();
5556 if( $flags & FR_TEXT ) {
5657 $columns += self::selectTextFields();
 58+ $options[] = 'FOR UPDATE';
5759 }
5860 $db = $flags & FR_FOR_UPDATE ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
5961 $pageId = $title->getArticleID( $flags & FR_FOR_UPDATE ? GAID_FOR_UPDATE : 0 );
@@ -68,7 +70,8 @@
6971 'rev_id = fr_rev_id',
7072 'rev_page = fr_page_id',
7173 'rev_deleted & '.Revision::DELETED_TEXT => 0 ),
72 - __METHOD__ );
 74+ __METHOD__,
 75+ $options );
7376 # Sorted from highest to lowest, so just take the first one if any
7477 if( $row ) {
7578 return new FlaggedRevision( $title, $row );
@@ -84,8 +87,10 @@
8588 */
8689 public static function newFromStable( $title, $flags=0 ) {
8790 $columns = self::selectFields();
 91+ $options = array();
8892 if( $flags & FR_TEXT ) {
8993 $columns += self::selectTextFields();
 94+ $options[] = 'FOR UPDATE';
9095 }
9196 $row = null;
9297 # Short-circuit query
@@ -104,6 +109,7 @@
105110 if( !$row )
106111 return null;
107112 } else {
 113+ $options['ORDER BY'] = 'fr_rev_id DESC';
108114 # Get visiblity settings...
109115 $config = FlaggedRevs::getPageVisibilitySettings( $title, $flags & FR_FOR_UPDATE );
110116 $dbw = wfGetDB( DB_MASTER );
@@ -117,7 +123,7 @@
118124 'rev_page = fr_page_id',
119125 'rev_deleted & '.Revision::DELETED_TEXT => 0),
120126 __METHOD__,
121 - array( 'ORDER BY' => 'fr_rev_id DESC') );
 127+ $options );
122128 # Looks like a plausible revision
123129 $row = $prow ? $prow : null;
124130 }
@@ -136,7 +142,7 @@
137143 'rev_page = fr_page_id',
138144 'rev_deleted & '.Revision::DELETED_TEXT => 0),
139145 __METHOD__,
140 - array( 'ORDER BY' => 'fr_rev_id DESC') );
 146+ $options );
141147 $row = $qrow ? $qrow : $row;
142148 }
143149 # Do we have one? If not, try the latest reviewed revision...
@@ -148,7 +154,7 @@
149155 'rev_page = fr_page_id',
150156 'rev_deleted & '.Revision::DELETED_TEXT => 0),
151157 __METHOD__,
152 - array( 'ORDER BY' => 'fr_rev_id DESC' ) );
 158+ $options );
153159 if( !$row )
154160 return null;
155161 }

Status & tagging log