Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | */ |
116 | 116 | $db = $this->getDB(); |
117 | 117 | $this->addTables( 'recentchanges' ); |
118 | | - $index = 'rc_timestamp'; // May change |
| 118 | + $index['recentchanges'] = 'rc_timestamp'; // May change |
119 | 119 | $this->addWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] ); |
120 | 120 | $this->addWhereFld( 'rc_namespace', $params['namespace'] ); |
121 | 121 | $this->addWhereFld( 'rc_deleted', 0 ); |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | if ( !is_null( $params['user'] ) ) |
163 | 163 | { |
164 | 164 | $this->addWhereFld( 'rc_user_text', $params['user'] ); |
165 | | - $index = 'rc_user_text'; |
| 165 | + $index['recentchanges'] = 'rc_user_text'; |
166 | 166 | } |
167 | 167 | |
168 | 168 | if ( !is_null( $params['excludeuser'] ) ) |
— | — | @@ -227,10 +227,13 @@ |
228 | 228 | $this->addTables( 'change_tag' ); |
229 | 229 | $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rc_id=ct_rc_id' ) ) ) ); |
230 | 230 | $this->addWhereFld( 'ct_tag' , $params['tag'] ); |
| 231 | + global $wgOldChangeTagsIndex; |
| 232 | + $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; |
231 | 233 | } |
| 234 | + |
232 | 235 | $this->token = $params['token']; |
233 | 236 | $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
234 | | - $this->addOption( 'USE INDEX', array( 'recentchanges' => $index ) ); |
| 237 | + $this->addOption( 'USE INDEX', $index ); |
235 | 238 | |
236 | 239 | $count = 0; |
237 | 240 | /* Perform the actual query. */ |
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | 'page' => array( 'LEFT JOIN', |
71 | 71 | array( 'log_namespace=page_namespace', |
72 | 72 | 'log_title=page_title' ) ) ) ); |
73 | | - $index = 'times'; // default, may change |
| 73 | + $index['logging'] = 'times'; // default, may change |
74 | 74 | |
75 | 75 | $this->addFields( array ( |
76 | 76 | 'log_type', |
— | — | @@ -97,11 +97,13 @@ |
98 | 98 | $this->addTables( 'change_tag' ); |
99 | 99 | $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'log_id=ct_log_id' ) ) ) ); |
100 | 100 | $this->addWhereFld( 'ct_tag', $params['tag'] ); |
| 101 | + global $wgOldChangeTagsIndex; |
| 102 | + $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; |
101 | 103 | } |
102 | 104 | |
103 | 105 | if ( !is_null( $params['type'] ) ) { |
104 | 106 | $this->addWhereFld( 'log_type', $params['type'] ); |
105 | | - $index = 'type_time'; |
| 107 | + $index['logging'] = 'type_time'; |
106 | 108 | } |
107 | 109 | |
108 | 110 | $this->addWhereRange( 'log_timestamp', $params['dir'], $params['start'], $params['end'] ); |
— | — | @@ -115,7 +117,7 @@ |
116 | 118 | if ( !$userid ) |
117 | 119 | $this->dieUsage( "User name $user not found", 'param_user' ); |
118 | 120 | $this->addWhereFld( 'log_user', $userid ); |
119 | | - $index = 'user_time'; |
| 121 | + $index['logging'] = 'user_time'; |
120 | 122 | } |
121 | 123 | |
122 | 124 | $title = $params['title']; |
— | — | @@ -127,10 +129,10 @@ |
128 | 130 | $this->addWhereFld( 'log_title', $titleObj->getDBkey() ); |
129 | 131 | |
130 | 132 | // Use the title index in preference to the user index if there is a conflict |
131 | | - $index = is_null( $user ) ? 'page_time' : array( 'page_time', 'user_time' ); |
| 133 | + $index['logging'] = is_null( $user ) ? 'page_time' : array( 'page_time', 'user_time' ); |
132 | 134 | } |
133 | 135 | |
134 | | - $this->addOption( 'USE INDEX', array( 'logging' => $index ) ); |
| 136 | + $this->addOption( 'USE INDEX', $index ); |
135 | 137 | |
136 | 138 | // Paranoia: avoid brute force searches (bug 17342) |
137 | 139 | if ( !is_null( $title ) ) { |
Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -157,6 +157,8 @@ |
158 | 158 | $this->addTables( 'change_tag' ); |
159 | 159 | $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) ); |
160 | 160 | $this->addWhereFld( 'ct_tag' , $params['tag'] ); |
| 161 | + global $wgOldChangeTagsIndex; |
| 162 | + $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; |
161 | 163 | } |
162 | 164 | |
163 | 165 | if ( isset( $prop['content'] ) || !is_null( $this->difftotext ) ) { |
— | — | @@ -295,6 +297,7 @@ |
296 | 298 | ApiBase :: dieDebug( __METHOD__, 'param validation?' ); |
297 | 299 | |
298 | 300 | $this->addOption( 'LIMIT', $limit + 1 ); |
| 301 | + $this->addOption( 'USE INDEX', $index ); |
299 | 302 | |
300 | 303 | $data = array (); |
301 | 304 | $count = 0; |
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php |
— | — | @@ -238,7 +238,6 @@ |
239 | 239 | } |
240 | 240 | |
241 | 241 | $this->addTables( $tables ); |
242 | | - $this->addOption( 'USE INDEX', $index ); |
243 | 242 | $this->addFieldsIf( 'rev_page', $this->fld_ids ); |
244 | 243 | $this->addFieldsIf( 'rev_id', $this->fld_ids || $this->fld_flags ); |
245 | 244 | $this->addFieldsIf( 'page_latest', $this->fld_flags ); |
— | — | @@ -260,7 +259,11 @@ |
261 | 260 | $this->addTables( 'change_tag' ); |
262 | 261 | $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) ); |
263 | 262 | $this->addWhereFld( 'ct_tag', $this->params['tag'] ); |
| 263 | + global $wgOldChangeTagsIndex; |
| 264 | + $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; |
264 | 265 | } |
| 266 | + |
| 267 | + $this->addOption( 'USE INDEX', $index ); |
265 | 268 | } |
266 | 269 | |
267 | 270 | /** |
— | — | @@ -390,6 +393,7 @@ |
391 | 394 | '!patrolled', |
392 | 395 | ) |
393 | 396 | ), |
| 397 | + 'tag' => null, |
394 | 398 | ); |
395 | 399 | } |
396 | 400 | |
— | — | @@ -406,6 +410,7 @@ |
407 | 411 | 'prop' => 'Include additional pieces of information', |
408 | 412 | 'show' => array( 'Show only items that meet this criteria, e.g. non minor edits only: show=!minor', |
409 | 413 | 'NOTE: if show=patrolled or show=!patrolled is set, revisions older than $wgRCMaxAge won\'t be shown', ), |
| 414 | + 'tag' => 'Only list revisions tagged with this tag', |
410 | 415 | ); |
411 | 416 | } |
412 | 417 | |