Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | */ |
97 | 97 | $db = $this->getDB(); |
98 | 98 | $this->addTables('recentchanges'); |
99 | | - $this->addOption('USE INDEX', array('recentchanges' => 'rc_timestamp')); |
| 99 | + $index = 'rc_timestamp'; // May change |
100 | 100 | $this->addWhereRange('rc_timestamp', $params['dir'], $params['start'], $params['end']); |
101 | 101 | $this->addWhereFld('rc_namespace', $params['namespace']); |
102 | 102 | $this->addWhereFld('rc_deleted', 0); |
— | — | @@ -134,8 +134,21 @@ |
135 | 135 | // Don't throw log entries out the window here |
136 | 136 | $this->addWhereIf('page_is_redirect = 0 OR page_is_redirect IS NULL', isset ($show['!redirect'])); |
137 | 137 | } |
| 138 | + |
| 139 | + if(!is_null($params['user']) && !is_null($param['excludeuser'])) |
| 140 | + $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser'); |
| 141 | + if(!is_null($params['user'])) |
| 142 | + { |
| 143 | + $this->addWhereFld('rc_user_text', $params['user']); |
| 144 | + $index = 'rc_user_text'; |
| 145 | + } |
| 146 | + if(!is_null($params['excludeuser'])) |
| 147 | + // We don't use the rc_user_text index here because |
| 148 | + // * it would require us to sort by rc_user_text before rc_timestamp |
| 149 | + // * the != condition doesn't throw out too many rows anyway |
| 150 | + $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser'])); |
138 | 151 | |
139 | | - /* Add the fields we're concerned with to out query. */ |
| 152 | + /* Add the fields we're concerned with to our query. */ |
140 | 153 | $this->addFields(array ( |
141 | 154 | 'rc_timestamp', |
142 | 155 | 'rc_namespace', |
— | — | @@ -192,6 +205,7 @@ |
193 | 206 | } |
194 | 207 | $this->token = $params['token']; |
195 | 208 | $this->addOption('LIMIT', $params['limit'] +1); |
| 209 | + $this->addOption('USE INDEX', array('recentchanges' => $index)); |
196 | 210 | |
197 | 211 | $count = 0; |
198 | 212 | /* Perform the actual query. */ |
— | — | @@ -374,6 +388,12 @@ |
375 | 389 | ApiBase :: PARAM_ISMULTI => true, |
376 | 390 | ApiBase :: PARAM_TYPE => 'namespace' |
377 | 391 | ), |
| 392 | + 'user' => array( |
| 393 | + ApiBase :: PARAM_TYPE => 'user' |
| 394 | + ), |
| 395 | + 'excludeuser' => array( |
| 396 | + ApiBase :: PARAM_TYPE => 'user' |
| 397 | + ), |
378 | 398 | 'prop' => array ( |
379 | 399 | ApiBase :: PARAM_ISMULTI => true, |
380 | 400 | ApiBase :: PARAM_DFLT => 'title|timestamp|ids', |
— | — | @@ -433,6 +453,8 @@ |
434 | 454 | 'end' => 'The timestamp to end enumerating.', |
435 | 455 | 'dir' => 'In which direction to enumerate.', |
436 | 456 | 'namespace' => 'Filter log entries to only this namespace(s)', |
| 457 | + 'user' => 'Only list changes by this user', |
| 458 | + 'excludeuser' => 'Don\'t list changes by this user', |
437 | 459 | 'prop' => 'Include additional pieces of information', |
438 | 460 | 'token' => 'Which tokens to obtain for each change', |
439 | 461 | 'show' => array ( |
— | — | @@ -457,4 +479,4 @@ |
458 | 480 | public function getVersion() { |
459 | 481 | return __CLASS__ . ': $Id$'; |
460 | 482 | } |
461 | | -} |
\ No newline at end of file |
| 483 | +} |
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -162,6 +162,13 @@ |
163 | 163 | $this->addWhereIf('rc_patrolled = 0', isset($show['!patrolled'])); |
164 | 164 | $this->addWhereIf('rc_patrolled != 0', isset($show['patrolled'])); |
165 | 165 | } |
| 166 | + |
| 167 | + if(!is_null($params['user']) && !is_null($params['excludeuser'])) |
| 168 | + $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser'); |
| 169 | + if(!is_null($params['user'])) |
| 170 | + $this->addWhereFld('rc_user_text', $params['user']); |
| 171 | + if(!is_null($params['excludeuser'])) |
| 172 | + $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser'])); |
166 | 173 | |
167 | 174 | |
168 | 175 | # This is an index optimization for mysql, as done in the Special:Watchlist page |
— | — | @@ -268,6 +275,12 @@ |
269 | 276 | ApiBase :: PARAM_ISMULTI => true, |
270 | 277 | ApiBase :: PARAM_TYPE => 'namespace' |
271 | 278 | ), |
| 279 | + 'user' => array( |
| 280 | + ApiBase :: PARAM_TYPE => 'user', |
| 281 | + ), |
| 282 | + 'excludeuser' => array( |
| 283 | + ApiBase :: PARAM_TYPE => 'user', |
| 284 | + ), |
272 | 285 | 'dir' => array ( |
273 | 286 | ApiBase :: PARAM_DFLT => 'older', |
274 | 287 | ApiBase :: PARAM_TYPE => array ( |
— | — | @@ -318,6 +331,8 @@ |
319 | 332 | 'start' => 'The timestamp to start enumerating from.', |
320 | 333 | 'end' => 'The timestamp to end enumerating.', |
321 | 334 | 'namespace' => 'Filter changes to only the given namespace(s).', |
| 335 | + 'user' => 'Only list changes by this user', |
| 336 | + 'excludeuser' => 'Don\'t list changes by this user', |
322 | 337 | 'dir' => 'In which direction to enumerate pages.', |
323 | 338 | 'limit' => 'How many total results to return per request.', |
324 | 339 | 'prop' => 'Which additional items to get (non-generator mode only).', |
— | — | @@ -345,4 +360,4 @@ |
346 | 361 | public function getVersion() { |
347 | 362 | return __CLASS__ . ': $Id$'; |
348 | 363 | } |
349 | | -} |
\ No newline at end of file |
| 364 | +} |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -223,6 +223,8 @@ |
224 | 224 | * Made deleting file description pages without files possible |
225 | 225 | * (bug 18773) Add content flag to siprop=namespaces output |
226 | 226 | * (bug 18785) Add siprop=languages to meta=siteinfo |
| 227 | +* (bug 14200) Added user and excludeuser parameters to list=watchlist and |
| 228 | + list=recentchanges |
227 | 229 | |
228 | 230 | === Languages updated in 1.16 === |
229 | 231 | |