Index: trunk/phase3/includes/api/ApiQueryUserContributions.php |
— | — | @@ -137,7 +137,8 @@ |
138 | 138 | // We're after the revision table, and the corresponding page |
139 | 139 | // row for anything we retrieve. We may also need the |
140 | 140 | // 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')); |
142 | 143 | $this->addWhere('page_id=rev_page'); |
143 | 144 | |
144 | 145 | // Handle continue parameter |
— | — | @@ -201,12 +202,20 @@ |
202 | 203 | if(!$wgUser->useRCPatrol() && !$wgUser->useNPPatrol()) |
203 | 204 | $this->dieUsage("You need the patrol right to request the patrolled flag", 'permissiondenied'); |
204 | 205 | $this->addTables('recentchanges'); |
| 206 | + // Use a redundant join condition on both |
| 207 | + // timestamp and ID so we can use the timestamp |
| 208 | + // index |
205 | 209 | if(isset($show['patrolled']) || isset($show['!patrolled'])) |
| 210 | + { |
| 211 | + $this->addOption('STRAIGHT_JOIN'); |
| 212 | + $this->addWhere('rc_timestamp=rev_timestamp'); |
206 | 213 | $this->addWhere('rc_this_oldid=rev_id'); |
| 214 | + } |
207 | 215 | else |
208 | 216 | $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')))); |
211 | 220 | } |
212 | 221 | |
213 | 222 | $this->addFieldsIf('rev_page', $this->fld_ids); |
— | — | @@ -304,7 +313,7 @@ |
305 | 314 | 'timestamp', |
306 | 315 | 'comment', |
307 | 316 | 'flags', |
308 | | -// 'patrolled', # Temporarily disabled, see bug 17215 |
| 317 | + 'patrolled', |
309 | 318 | ) |
310 | 319 | ), |
311 | 320 | 'show' => array ( |
— | — | @@ -312,8 +321,8 @@ |
313 | 322 | ApiBase :: PARAM_TYPE => array ( |
314 | 323 | 'minor', |
315 | 324 | '!minor', |
316 | | -// 'patrolled', # Temporarily disabled, see bug 17215 |
317 | | -// '!patrolled', |
| 325 | + 'patrolled', |
| 326 | + '!patrolled', |
318 | 327 | ) |
319 | 328 | ), |
320 | 329 | ); |