Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | if (!$wgUser->isLoggedIn()) |
61 | 61 | $this->dieUsage('You must be logged-in to have a watchlist', 'notloggedin'); |
62 | 62 | |
63 | | - $allrev = $start = $end = $namespace = $dir = $limit = $prop = null; |
| 63 | + $allrev = $start = $end = $namespace = $dir = $limit = $prop = $show = null; |
64 | 64 | extract($this->extractRequestParams()); |
65 | 65 | |
66 | 66 | if (!is_null($prop) && is_null($resultPageSet)) { |
— | — | @@ -135,7 +135,28 @@ |
136 | 136 | $this->addWhereFld('wl_namespace', $namespace); |
137 | 137 | $this->addWhereIf('rc_this_oldid=page_latest', !$allrev); |
138 | 138 | |
139 | | - # This is a index optimization for mysql, as done in the Special:Watchlist page |
| 139 | + if (!is_null($show)) { |
| 140 | + $show = array_flip($show); |
| 141 | + |
| 142 | + /* Check for conflicting parameters. */ |
| 143 | + if ((isset ($show['minor']) && isset ($show['!minor'])) |
| 144 | + || (isset ($show['bot']) && isset ($show['!bot'])) |
| 145 | + || (isset ($show['anon']) && isset ($show['!anon']))) { |
| 146 | + |
| 147 | + $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show'); |
| 148 | + } |
| 149 | + |
| 150 | + /* Add additional conditions to query depending upon parameters. */ |
| 151 | + $this->addWhereIf('rc_minor = 0', isset ($show['!minor'])); |
| 152 | + $this->addWhereIf('rc_minor != 0', isset ($show['minor'])); |
| 153 | + $this->addWhereIf('rc_bot = 0', isset ($show['!bot'])); |
| 154 | + $this->addWhereIf('rc_bot != 0', isset ($show['bot'])); |
| 155 | + $this->addWhereIf('rc_user = 0', isset ($show['anon'])); |
| 156 | + $this->addWhereIf('rc_user != 0', isset ($show['!anon'])); |
| 157 | + } |
| 158 | + |
| 159 | + |
| 160 | + # This is an index optimization for mysql, as done in the Special:Watchlist page |
140 | 161 | $this->addWhereIf("rc_timestamp > ''", !isset ($start) && !isset ($end) && $wgDBtype == 'mysql'); |
141 | 162 | |
142 | 163 | $this->addOption('LIMIT', $limit +1); |
— | — | @@ -262,6 +283,17 @@ |
263 | 284 | 'patrol', |
264 | 285 | 'sizes', |
265 | 286 | ) |
| 287 | + ), |
| 288 | + 'show' => array ( |
| 289 | + ApiBase :: PARAM_ISMULTI => true, |
| 290 | + ApiBase :: PARAM_TYPE => array ( |
| 291 | + 'minor', |
| 292 | + '!minor', |
| 293 | + 'bot', |
| 294 | + '!bot', |
| 295 | + 'anon', |
| 296 | + '!anon' |
| 297 | + ) |
266 | 298 | ) |
267 | 299 | ); |
268 | 300 | } |
— | — | @@ -274,7 +306,11 @@ |
275 | 307 | 'namespace' => 'Filter changes to only the given namespace(s).', |
276 | 308 | 'dir' => 'In which direction to enumerate pages.', |
277 | 309 | 'limit' => 'How many total pages to return per request.', |
278 | | - 'prop' => 'Which additional items to get (non-generator mode only).' |
| 310 | + 'prop' => 'Which additional items to get (non-generator mode only).', |
| 311 | + 'show' => array ( |
| 312 | + 'Show only items that meet this criteria.', |
| 313 | + 'For example, to see only minor edits done by logged-in users, set show=minor|!anon' |
| 314 | + ) |
279 | 315 | ); |
280 | 316 | } |
281 | 317 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -435,6 +435,7 @@ |
436 | 436 | * Add list of sections to action=parse output |
437 | 437 | * Added action=logout |
438 | 438 | * Added cascade flag to prop=info&inprop=protections |
| 439 | +* Added wlshow parameter to list=watchlist, similar to rcshow (list=recentchanges) |
439 | 440 | |
440 | 441 | === Languages updated in 1.12 === |
441 | 442 | |