r46825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46824‎ | r46825 | r46826 >
Date:23:19, 4 February 2009
Author:catrope
Status:ok (Comments)
Tags:
Comment:
API: Re-enable ucprop=patrolled and rcshow=patrolled|!patrolled using the timestamp index for the join (thanks to Tim for pointing this out) and a STRAIGHT_JOIN for the inner join case
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -137,7 +137,8 @@
138138 // We're after the revision table, and the corresponding page
139139 // row for anything we retrieve. We may also need the
140140 // recentchanges row.
141 - $this->addTables(array('page', 'revision'));
 141+ // Tables have to be in this order for STRAIGHT_JOIN
 142+ $this->addTables(array('revision', 'page'));
142143 $this->addWhere('page_id=rev_page');
143144
144145 // Handle continue parameter
@@ -201,12 +202,20 @@
202203 if(!$wgUser->useRCPatrol() && !$wgUser->useNPPatrol())
203204 $this->dieUsage("You need the patrol right to request the patrolled flag", 'permissiondenied');
204205 $this->addTables('recentchanges');
 206+ // Use a redundant join condition on both
 207+ // timestamp and ID so we can use the timestamp
 208+ // index
205209 if(isset($show['patrolled']) || isset($show['!patrolled']))
 210+ {
 211+ $this->addOption('STRAIGHT_JOIN');
 212+ $this->addWhere('rc_timestamp=rev_timestamp');
206213 $this->addWhere('rc_this_oldid=rev_id');
 214+ }
207215 else
208216 $this->addJoinConds(array('recentchanges' => array(
209 - 'LEFT JOIN',
210 - 'rc_this_oldid=rev_id')));
 217+ 'LEFT JOIN', array(
 218+ 'rc_timestamp=rev_timestamp',
 219+ 'rc_this_oldid=rev_id'))));
211220 }
212221
213222 $this->addFieldsIf('rev_page', $this->fld_ids);
@@ -304,7 +313,7 @@
305314 'timestamp',
306315 'comment',
307316 'flags',
308 -// 'patrolled', # Temporarily disabled, see bug 17215
 317+ 'patrolled',
309318 )
310319 ),
311320 'show' => array (
@@ -312,8 +321,8 @@
313322 ApiBase :: PARAM_TYPE => array (
314323 'minor',
315324 '!minor',
316 -// 'patrolled', # Temporarily disabled, see bug 17215
317 -// '!patrolled',
 325+ 'patrolled',
 326+ '!patrolled',
318327 )
319328 ),
320329 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r47037API: Fix up r46825:...catrope14:07, 9 February 2009

Comments

#Comment by Aaron Schulz (talk | contribs)   04:47, 5 February 2009

Note that adding rev_user_text = rc_user_text will also allow for (user,time) index usage rather than just (time)

#Comment by Catrope (talk | contribs)   14:08, 9 February 2009

Done in r47037, along with a few fixes

Status & tagging log