Merge "Collation: Remove deprecated findLowerBound()"
[lhc/web/wiklou.git] / includes / api / ApiQueryWatchlist.php
1 <?php
2 /**
3 *
4 *
5 * Created on Sep 25, 2006
6 *
7 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 *
24 * @file
25 */
26
27 /**
28 * This query action allows clients to retrieve a list of recently modified pages
29 * that are part of the logged-in user's watchlist.
30 *
31 * @ingroup API
32 */
33 class ApiQueryWatchlist extends ApiQueryGeneratorBase {
34
35 public function __construct( ApiQuery $query, $moduleName ) {
36 parent::__construct( $query, $moduleName, 'wl' );
37 }
38
39 public function execute() {
40 $this->run();
41 }
42
43 public function executeGenerator( $resultPageSet ) {
44 $this->run( $resultPageSet );
45 }
46
47 private $fld_ids = false, $fld_title = false, $fld_patrol = false,
48 $fld_flags = false, $fld_timestamp = false, $fld_user = false,
49 $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
50 $fld_notificationtimestamp = false, $fld_userid = false,
51 $fld_loginfo = false;
52
53 /**
54 * @param ApiPageSet $resultPageSet
55 * @return void
56 */
57 private function run( $resultPageSet = null ) {
58 $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' );
59
60 $params = $this->extractRequestParams();
61
62 $user = $this->getUser();
63 $wlowner = $this->getWatchlistUser( $params );
64
65 if ( !is_null( $params['prop'] ) && is_null( $resultPageSet ) ) {
66 $prop = array_flip( $params['prop'] );
67
68 $this->fld_ids = isset( $prop['ids'] );
69 $this->fld_title = isset( $prop['title'] );
70 $this->fld_flags = isset( $prop['flags'] );
71 $this->fld_user = isset( $prop['user'] );
72 $this->fld_userid = isset( $prop['userid'] );
73 $this->fld_comment = isset( $prop['comment'] );
74 $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
75 $this->fld_timestamp = isset( $prop['timestamp'] );
76 $this->fld_sizes = isset( $prop['sizes'] );
77 $this->fld_patrol = isset( $prop['patrol'] );
78 $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
79 $this->fld_loginfo = isset( $prop['loginfo'] );
80
81 if ( $this->fld_patrol ) {
82 if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
83 $this->dieUsage( 'patrol property is not available', 'patrol' );
84 }
85 }
86 }
87
88 $this->addFields( array(
89 'rc_id',
90 'rc_namespace',
91 'rc_title',
92 'rc_timestamp',
93 'rc_type',
94 'rc_deleted',
95 ) );
96
97 if ( is_null( $resultPageSet ) ) {
98 $this->addFields( array(
99 'rc_cur_id',
100 'rc_this_oldid',
101 'rc_last_oldid',
102 ) );
103
104 $this->addFieldsIf( array( 'rc_type', 'rc_minor', 'rc_bot' ), $this->fld_flags );
105 $this->addFieldsIf( 'rc_user', $this->fld_user || $this->fld_userid );
106 $this->addFieldsIf( 'rc_user_text', $this->fld_user );
107 $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
108 $this->addFieldsIf( 'rc_patrolled', $this->fld_patrol );
109 $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
110 $this->addFieldsIf( 'wl_notificationtimestamp', $this->fld_notificationtimestamp );
111 $this->addFieldsIf(
112 array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ),
113 $this->fld_loginfo
114 );
115 } elseif ( $params['allrev'] ) {
116 $this->addFields( 'rc_this_oldid' );
117 } else {
118 $this->addFields( 'rc_cur_id' );
119 }
120
121 $this->addTables( array(
122 'recentchanges',
123 'watchlist',
124 ) );
125
126 $userId = $wlowner->getId();
127 $this->addJoinConds( array( 'watchlist' => array( 'INNER JOIN',
128 array(
129 'wl_user' => $userId,
130 'wl_namespace=rc_namespace',
131 'wl_title=rc_title'
132 )
133 ) ) );
134
135 $db = $this->getDB();
136
137 $this->addTimestampWhereRange( 'rc_timestamp', $params['dir'],
138 $params['start'], $params['end'] );
139 // Include in ORDER BY for uniqueness
140 $this->addWhereRange( 'rc_id', $params['dir'], null, null );
141
142 if ( !is_null( $params['continue'] ) ) {
143 $cont = explode( '|', $params['continue'] );
144 $this->dieContinueUsageIf( count( $cont ) != 2 );
145 $op = ( $params['dir'] === 'newer' ? '>' : '<' );
146 $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
147 $continueId = (int)$cont[1];
148 $this->dieContinueUsageIf( $continueId != $cont[1] );
149 $this->addWhere( "rc_timestamp $op $continueTimestamp OR " .
150 "(rc_timestamp = $continueTimestamp AND " .
151 "rc_id $op= $continueId)"
152 );
153 }
154
155 $this->addWhereFld( 'wl_namespace', $params['namespace'] );
156
157 if ( !$params['allrev'] ) {
158 $this->addTables( 'page' );
159 $this->addJoinConds( array( 'page' => array( 'LEFT JOIN', 'rc_cur_id=page_id' ) ) );
160 $this->addWhere( 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG );
161 }
162
163 if ( !is_null( $params['show'] ) ) {
164 $show = array_flip( $params['show'] );
165
166 /* Check for conflicting parameters. */
167 if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
168 || ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
169 || ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
170 || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
171 ) {
172 $this->dieUsageMsg( 'show' );
173 }
174
175 // Check permissions.
176 if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
177 if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
178 $this->dieUsage(
179 'You need the patrol right to request the patrolled flag',
180 'permissiondenied'
181 );
182 }
183 }
184
185 /* Add additional conditions to query depending upon parameters. */
186 $this->addWhereIf( 'rc_minor = 0', isset( $show['!minor'] ) );
187 $this->addWhereIf( 'rc_minor != 0', isset( $show['minor'] ) );
188 $this->addWhereIf( 'rc_bot = 0', isset( $show['!bot'] ) );
189 $this->addWhereIf( 'rc_bot != 0', isset( $show['bot'] ) );
190 $this->addWhereIf( 'rc_user = 0', isset( $show['anon'] ) );
191 $this->addWhereIf( 'rc_user != 0', isset( $show['!anon'] ) );
192 $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
193 $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
194 }
195
196 if ( !is_null( $params['type'] ) ) {
197 try {
198 $this->addWhereFld( 'rc_type', RecentChange::parseToRCType( $params['type'] ) );
199 } catch ( MWException $e ) {
200 ApiBase::dieDebug( __METHOD__, $e->getMessage() );
201 }
202 }
203
204 if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
205 $this->dieUsage( 'user and excludeuser cannot be used together', 'user-excludeuser' );
206 }
207 if ( !is_null( $params['user'] ) ) {
208 $this->addWhereFld( 'rc_user_text', $params['user'] );
209 }
210 if ( !is_null( $params['excludeuser'] ) ) {
211 $this->addWhere( 'rc_user_text != ' . $db->addQuotes( $params['excludeuser'] ) );
212 }
213
214 // This is an index optimization for mysql, as done in the Special:Watchlist page
215 $this->addWhereIf(
216 "rc_timestamp > ''",
217 !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql'
218 );
219
220 // Paranoia: avoid brute force searches (bug 17342)
221 if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
222 if ( !$user->isAllowed( 'deletedhistory' ) ) {
223 $bitmask = Revision::DELETED_USER;
224 } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
225 $bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
226 } else {
227 $bitmask = 0;
228 }
229 if ( $bitmask ) {
230 $this->addWhere( $this->getDB()->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask" );
231 }
232 }
233
234 // LogPage::DELETED_ACTION hides the affected page, too. So hide those
235 // entirely from the watchlist, or someone could guess the title.
236 if ( !$user->isAllowed( 'deletedhistory' ) ) {
237 $bitmask = LogPage::DELETED_ACTION;
238 } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
239 $bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
240 } else {
241 $bitmask = 0;
242 }
243 if ( $bitmask ) {
244 $this->addWhere( $this->getDB()->makeList( array(
245 'rc_type != ' . RC_LOG,
246 $this->getDB()->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
247 ), LIST_OR ) );
248 }
249
250 $this->addOption( 'LIMIT', $params['limit'] + 1 );
251
252 $ids = array();
253 $count = 0;
254 $res = $this->select( __METHOD__ );
255
256 foreach ( $res as $row ) {
257 if ( ++$count > $params['limit'] ) {
258 // We've reached the one extra which shows that there are
259 // additional pages to be had. Stop here...
260 $this->setContinueEnumParameter( 'continue', "$row->rc_timestamp|$row->rc_id" );
261 break;
262 }
263
264 if ( is_null( $resultPageSet ) ) {
265 $vals = $this->extractRowInfo( $row );
266 $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ), null, $vals );
267 if ( !$fit ) {
268 $this->setContinueEnumParameter( 'continue', "$row->rc_timestamp|$row->rc_id" );
269 break;
270 }
271 } else {
272 if ( $params['allrev'] ) {
273 $ids[] = intval( $row->rc_this_oldid );
274 } else {
275 $ids[] = intval( $row->rc_cur_id );
276 }
277 }
278 }
279
280 if ( is_null( $resultPageSet ) ) {
281 $this->getResult()->setIndexedTagName_internal(
282 array( 'query', $this->getModuleName() ),
283 'item'
284 );
285 } elseif ( $params['allrev'] ) {
286 $resultPageSet->populateFromRevisionIDs( $ids );
287 } else {
288 $resultPageSet->populateFromPageIDs( $ids );
289 }
290 }
291
292 private function extractRowInfo( $row ) {
293 /* Determine the title of the page that has been changed. */
294 $title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
295 $user = $this->getUser();
296
297 /* Our output data. */
298 $vals = array();
299 $type = intval( $row->rc_type );
300 $vals['type'] = RecentChange::parseFromRCType( $type );
301 $anyHidden = false;
302
303 /* Create a new entry in the result for the title. */
304 if ( $this->fld_title || $this->fld_ids ) {
305 // These should already have been filtered out of the query, but just in case.
306 if ( $type === RC_LOG && ( $row->rc_deleted & LogPage::DELETED_ACTION ) ) {
307 $vals['actionhidden'] = '';
308 $anyHidden = true;
309 }
310 if ( $type !== RC_LOG ||
311 LogEventsList::userCanBitfield( $row->rc_deleted, LogPage::DELETED_ACTION, $user )
312 ) {
313 if ( $this->fld_title ) {
314 ApiQueryBase::addTitleInfo( $vals, $title );
315 }
316 if ( $this->fld_ids ) {
317 $vals['pageid'] = intval( $row->rc_cur_id );
318 $vals['revid'] = intval( $row->rc_this_oldid );
319 $vals['old_revid'] = intval( $row->rc_last_oldid );
320 }
321 }
322 }
323
324 /* Add user data and 'anon' flag, if user is anonymous. */
325 if ( $this->fld_user || $this->fld_userid ) {
326 if ( $row->rc_deleted & Revision::DELETED_USER ) {
327 $vals['userhidden'] = '';
328 $anyHidden = true;
329 }
330 if ( Revision::userCanBitfield( $row->rc_deleted, Revision::DELETED_USER, $user ) ) {
331 if ( $this->fld_userid ) {
332 $vals['userid'] = $row->rc_user;
333 // for backwards compatibility
334 $vals['user'] = $row->rc_user;
335 }
336
337 if ( $this->fld_user ) {
338 $vals['user'] = $row->rc_user_text;
339 }
340
341 if ( !$row->rc_user ) {
342 $vals['anon'] = '';
343 }
344 }
345 }
346
347 /* Add flags, such as new, minor, bot. */
348 if ( $this->fld_flags ) {
349 if ( $row->rc_bot ) {
350 $vals['bot'] = '';
351 }
352 if ( $row->rc_type == RC_NEW ) {
353 $vals['new'] = '';
354 }
355 if ( $row->rc_minor ) {
356 $vals['minor'] = '';
357 }
358 }
359
360 /* Add sizes of each revision. (Only available on 1.10+) */
361 if ( $this->fld_sizes ) {
362 $vals['oldlen'] = intval( $row->rc_old_len );
363 $vals['newlen'] = intval( $row->rc_new_len );
364 }
365
366 /* Add the timestamp. */
367 if ( $this->fld_timestamp ) {
368 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->rc_timestamp );
369 }
370
371 if ( $this->fld_notificationtimestamp ) {
372 $vals['notificationtimestamp'] = ( $row->wl_notificationtimestamp == null )
373 ? ''
374 : wfTimestamp( TS_ISO_8601, $row->wl_notificationtimestamp );
375 }
376
377 /* Add edit summary / log summary. */
378 if ( $this->fld_comment || $this->fld_parsedcomment ) {
379 if ( $row->rc_deleted & Revision::DELETED_COMMENT ) {
380 $vals['commenthidden'] = '';
381 $anyHidden = true;
382 }
383 if ( Revision::userCanBitfield( $row->rc_deleted, Revision::DELETED_COMMENT, $user ) ) {
384 if ( $this->fld_comment && isset( $row->rc_comment ) ) {
385 $vals['comment'] = $row->rc_comment;
386 }
387
388 if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
389 $vals['parsedcomment'] = Linker::formatComment( $row->rc_comment, $title );
390 }
391 }
392 }
393
394 /* Add the patrolled flag */
395 if ( $this->fld_patrol && $row->rc_patrolled == 1 ) {
396 $vals['patrolled'] = '';
397 }
398
399 if ( $this->fld_patrol && ChangesList::isUnpatrolled( $row, $user ) ) {
400 $vals['unpatrolled'] = '';
401 }
402
403 if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
404 if ( $row->rc_deleted & LogPage::DELETED_ACTION ) {
405 $vals['actionhidden'] = '';
406 $anyHidden = true;
407 }
408 if ( LogEventsList::userCanBitfield( $row->rc_deleted, LogPage::DELETED_ACTION, $user ) ) {
409 $vals['logid'] = intval( $row->rc_logid );
410 $vals['logtype'] = $row->rc_log_type;
411 $vals['logaction'] = $row->rc_log_action;
412 $logEntry = DatabaseLogEntry::newFromRow( (array)$row );
413 ApiQueryLogEvents::addLogParams(
414 $this->getResult(),
415 $vals,
416 $logEntry->getParameters(),
417 $logEntry->getType(),
418 $logEntry->getSubtype(),
419 $logEntry->getTimestamp()
420 );
421 }
422 }
423
424 if ( $anyHidden && ( $row->rc_deleted & Revision::DELETED_RESTRICTED ) ) {
425 $vals['suppressed'] = '';
426 }
427
428 return $vals;
429 }
430
431 public function getAllowedParams() {
432 return array(
433 'allrev' => false,
434 'start' => array(
435 ApiBase::PARAM_TYPE => 'timestamp'
436 ),
437 'end' => array(
438 ApiBase::PARAM_TYPE => 'timestamp'
439 ),
440 'namespace' => array(
441 ApiBase::PARAM_ISMULTI => true,
442 ApiBase::PARAM_TYPE => 'namespace'
443 ),
444 'user' => array(
445 ApiBase::PARAM_TYPE => 'user',
446 ),
447 'excludeuser' => array(
448 ApiBase::PARAM_TYPE => 'user',
449 ),
450 'dir' => array(
451 ApiBase::PARAM_DFLT => 'older',
452 ApiBase::PARAM_TYPE => array(
453 'newer',
454 'older'
455 )
456 ),
457 'limit' => array(
458 ApiBase::PARAM_DFLT => 10,
459 ApiBase::PARAM_TYPE => 'limit',
460 ApiBase::PARAM_MIN => 1,
461 ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
462 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
463 ),
464 'prop' => array(
465 ApiBase::PARAM_ISMULTI => true,
466 ApiBase::PARAM_DFLT => 'ids|title|flags',
467 ApiBase::PARAM_TYPE => array(
468 'ids',
469 'title',
470 'flags',
471 'user',
472 'userid',
473 'comment',
474 'parsedcomment',
475 'timestamp',
476 'patrol',
477 'sizes',
478 'notificationtimestamp',
479 'loginfo',
480 )
481 ),
482 'show' => array(
483 ApiBase::PARAM_ISMULTI => true,
484 ApiBase::PARAM_TYPE => array(
485 'minor',
486 '!minor',
487 'bot',
488 '!bot',
489 'anon',
490 '!anon',
491 'patrolled',
492 '!patrolled',
493 )
494 ),
495 'type' => array(
496 ApiBase::PARAM_ISMULTI => true,
497 ApiBase::PARAM_TYPE => array(
498 'edit',
499 'external',
500 'new',
501 'log',
502 )
503 ),
504 'owner' => array(
505 ApiBase::PARAM_TYPE => 'user'
506 ),
507 'token' => array(
508 ApiBase::PARAM_TYPE => 'string'
509 ),
510 'continue' => null,
511 );
512 }
513
514 public function getParamDescription() {
515 $p = $this->getModulePrefix();
516
517 return array(
518 'allrev' => 'Include multiple revisions of the same page within given timeframe',
519 'start' => 'The timestamp to start enumerating from',
520 'end' => 'The timestamp to end enumerating',
521 'namespace' => 'Filter changes to only the given namespace(s)',
522 'user' => 'Only list changes by this user',
523 'excludeuser' => 'Don\'t list changes by this user',
524 'dir' => $this->getDirectionDescription( $p ),
525 'limit' => 'How many total results to return per request',
526 'prop' => array(
527 'Which additional items to get (non-generator mode only).',
528 ' ids - Adds revision ids and page ids',
529 ' title - Adds title of the page',
530 ' flags - Adds flags for the edit',
531 ' user - Adds the user who made the edit',
532 ' userid - Adds user id of whom made the edit',
533 ' comment - Adds comment of the edit',
534 ' parsedcomment - Adds parsed comment of the edit',
535 ' timestamp - Adds timestamp of the edit',
536 ' patrol - Tags edits that are patrolled',
537 ' sizes - Adds the old and new lengths of the page',
538 ' notificationtimestamp - Adds timestamp of when the user was last notified about the edit',
539 ' loginfo - Adds log information where appropriate',
540 ),
541 'show' => array(
542 'Show only items that meet this criteria.',
543 "For example, to see only minor edits done by logged-in users, set {$p}show=minor|!anon"
544 ),
545 'type' => array(
546 'Which types of changes to show',
547 ' edit - Regular page edits',
548 ' external - External changes',
549 ' new - Page creations',
550 ' log - Log entries',
551 ),
552 'owner' => 'The name of the user whose watchlist you\'d like to access',
553 'token' => 'Give a security token (settable in preferences) to ' .
554 'allow access to another user\'s watchlist',
555 'continue' => 'When more results are available, use this to continue',
556 );
557 }
558
559 public function getResultProperties() {
560 global $wgLogTypes;
561
562 return array(
563 '' => array(
564 'type' => array(
565 ApiBase::PROP_TYPE => array(
566 'edit',
567 'new',
568 'move',
569 'log',
570 'move over redirect'
571 )
572 )
573 ),
574 'ids' => array(
575 'pageid' => 'integer',
576 'revid' => 'integer',
577 'old_revid' => 'integer'
578 ),
579 'title' => array(
580 'ns' => 'namespace',
581 'title' => 'string'
582 ),
583 'user' => array(
584 'user' => 'string',
585 'anon' => 'boolean'
586 ),
587 'userid' => array(
588 'userid' => 'integer',
589 'anon' => 'boolean'
590 ),
591 'flags' => array(
592 'new' => 'boolean',
593 'minor' => 'boolean',
594 'bot' => 'boolean'
595 ),
596 'patrol' => array(
597 'patrolled' => 'boolean'
598 ),
599 'timestamp' => array(
600 'timestamp' => 'timestamp'
601 ),
602 'sizes' => array(
603 'oldlen' => 'integer',
604 'newlen' => 'integer'
605 ),
606 'notificationtimestamp' => array(
607 'notificationtimestamp' => array(
608 ApiBase::PROP_TYPE => 'timestamp',
609 ApiBase::PROP_NULLABLE => true
610 )
611 ),
612 'comment' => array(
613 'comment' => array(
614 ApiBase::PROP_TYPE => 'string',
615 ApiBase::PROP_NULLABLE => true
616 )
617 ),
618 'parsedcomment' => array(
619 'parsedcomment' => array(
620 ApiBase::PROP_TYPE => 'string',
621 ApiBase::PROP_NULLABLE => true
622 )
623 ),
624 'loginfo' => array(
625 'logid' => array(
626 ApiBase::PROP_TYPE => 'integer',
627 ApiBase::PROP_NULLABLE => true
628 ),
629 'logtype' => array(
630 ApiBase::PROP_TYPE => $wgLogTypes,
631 ApiBase::PROP_NULLABLE => true
632 ),
633 'logaction' => array(
634 ApiBase::PROP_TYPE => 'string',
635 ApiBase::PROP_NULLABLE => true
636 )
637 )
638 );
639 }
640
641 public function getDescription() {
642 return "Get all recent changes to pages in the logged in user's watchlist.";
643 }
644
645 public function getPossibleErrors() {
646 return array_merge( parent::getPossibleErrors(), array(
647 array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
648 array(
649 'code' => 'bad_wltoken',
650 'info' => 'Incorrect watchlist token provided -- ' .
651 'please set a correct token in Special:Preferences'
652 ),
653 array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
654 array( 'code' => 'patrol', 'info' => 'patrol property is not available' ),
655 array( 'show' ),
656 array(
657 'code' => 'permissiondenied',
658 'info' => 'You need the patrol right to request the patrolled flag'
659 ),
660 array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
661 ) );
662 }
663
664 public function getExamples() {
665 return array(
666 'api.php?action=query&list=watchlist',
667 'api.php?action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment',
668 'api.php?action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment',
669 'api.php?action=query&generator=watchlist&prop=info',
670 'api.php?action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user',
671 'api.php?action=query&list=watchlist&wlowner=Bob_Smith&wltoken=123ABC'
672 );
673 }
674
675 public function getHelpUrls() {
676 return 'https://www.mediawiki.org/wiki/API:Watchlist';
677 }
678 }