Fixed spacing in db/debug/diff/externalstore/objectcache folder
[mediawiki.git] / includes / api / ApiQueryRecentChanges.php
blob8aceab22bd233f05d99210fcb727a88f74ebf9c7
1 <?php
2 /**
5 * Created on Oct 19, 2006
7 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
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.
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.
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
24 * @file
27 /**
28 * A query action to enumerate the recent changes that were done to the wiki.
29 * Various filters are supported.
31 * @ingroup API
33 class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
35 public function __construct( $query, $moduleName ) {
36 parent::__construct( $query, $moduleName, 'rc' );
39 private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
40 $fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
41 $fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false,
42 $fld_tags = false, $token = array();
44 private $tokenFunctions;
46 /**
47 * Get an array mapping token names to their handler functions.
48 * The prototype for a token function is func($pageid, $title, $rc)
49 * it should return a token or false (permission denied)
50 * @return array array(tokenname => function)
52 protected function getTokenFunctions() {
53 // Don't call the hooks twice
54 if ( isset( $this->tokenFunctions ) ) {
55 return $this->tokenFunctions;
58 // If we're in JSON callback mode, no tokens can be obtained
59 if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
60 return array();
63 $this->tokenFunctions = array(
64 'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' )
66 wfRunHooks( 'APIQueryRecentChangesTokens', array( &$this->tokenFunctions ) );
67 return $this->tokenFunctions;
70 /**
71 * @param $pageid
72 * @param $title
73 * @param $rc RecentChange (optional)
74 * @return bool|String
76 public static function getPatrolToken( $pageid, $title, $rc = null ) {
77 global $wgUser;
79 $validTokenUser = false;
81 if ( $rc ) {
82 if ( ( $wgUser->useRCPatrol() && $rc->getAttribute( 'rc_type' ) == RC_EDIT ) ||
83 ( $wgUser->useNPPatrol() && $rc->getAttribute( 'rc_type' ) == RC_NEW ) )
85 $validTokenUser = true;
87 } else {
88 if ( $wgUser->useRCPatrol() || $wgUser->useNPPatrol() ) {
89 $validTokenUser = true;
93 if ( $validTokenUser ) {
94 // The patrol token is always the same, let's exploit that
95 static $cachedPatrolToken = null;
96 if ( is_null( $cachedPatrolToken ) ) {
97 $cachedPatrolToken = $wgUser->getEditToken( 'patrol' );
99 return $cachedPatrolToken;
100 } else {
101 return false;
107 * Sets internal state to include the desired properties in the output.
108 * @param array $prop associative array of properties, only keys are used here
110 public function initProperties( $prop ) {
111 $this->fld_comment = isset( $prop['comment'] );
112 $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
113 $this->fld_user = isset( $prop['user'] );
114 $this->fld_userid = isset( $prop['userid'] );
115 $this->fld_flags = isset( $prop['flags'] );
116 $this->fld_timestamp = isset( $prop['timestamp'] );
117 $this->fld_title = isset( $prop['title'] );
118 $this->fld_ids = isset( $prop['ids'] );
119 $this->fld_sizes = isset( $prop['sizes'] );
120 $this->fld_redirect = isset( $prop['redirect'] );
121 $this->fld_patrolled = isset( $prop['patrolled'] );
122 $this->fld_loginfo = isset( $prop['loginfo'] );
123 $this->fld_tags = isset( $prop['tags'] );
126 public function execute() {
127 $this->run();
130 public function executeGenerator( $resultPageSet ) {
131 $this->run( $resultPageSet );
135 * Generates and outputs the result of this query based upon the provided parameters.
137 * @param $resultPageSet ApiPageSet
139 public function run( $resultPageSet = null ) {
140 $user = $this->getUser();
141 /* Get the parameters of the request. */
142 $params = $this->extractRequestParams();
144 /* Build our basic query. Namely, something along the lines of:
145 * SELECT * FROM recentchanges WHERE rc_timestamp > $start
146 * AND rc_timestamp < $end AND rc_namespace = $namespace
147 * AND rc_deleted = 0
149 $this->addTables( 'recentchanges' );
150 $index = array( 'recentchanges' => 'rc_timestamp' ); // May change
151 $this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
153 if ( !is_null( $params['continue'] ) ) {
154 $cont = explode( '|', $params['continue'] );
155 if ( count( $cont ) != 2 ) {
156 $this->dieUsage( 'Invalid continue param. You should pass the ' .
157 'original value returned by the previous query', '_badcontinue' );
160 $timestamp = $this->getDB()->addQuotes( wfTimestamp( TS_MW, $cont[0] ) );
161 $id = intval( $cont[1] );
162 $op = $params['dir'] === 'older' ? '<' : '>';
164 $this->addWhere(
165 "rc_timestamp $op $timestamp OR " .
166 "(rc_timestamp = $timestamp AND " .
167 "rc_id $op= $id)"
171 $order = $params['dir'] === 'older' ? 'DESC' : 'ASC';
172 $this->addOption( 'ORDER BY', array(
173 "rc_timestamp $order",
174 "rc_id $order",
175 ) );
177 $this->addWhereFld( 'rc_namespace', $params['namespace'] );
178 $this->addWhereFld( 'rc_deleted', 0 );
180 if ( !is_null( $params['type'] ) ) {
181 $this->addWhereFld( 'rc_type', $this->parseRCType( $params['type'] ) );
184 if ( !is_null( $params['show'] ) ) {
185 $show = array_flip( $params['show'] );
187 /* Check for conflicting parameters. */
188 if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
189 || ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
190 || ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
191 || ( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
192 || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
194 $this->dieUsageMsg( 'show' );
197 // Check permissions
198 if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
199 if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
200 $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
204 /* Add additional conditions to query depending upon parameters. */
205 $this->addWhereIf( 'rc_minor = 0', isset( $show['!minor'] ) );
206 $this->addWhereIf( 'rc_minor != 0', isset( $show['minor'] ) );
207 $this->addWhereIf( 'rc_bot = 0', isset( $show['!bot'] ) );
208 $this->addWhereIf( 'rc_bot != 0', isset( $show['bot'] ) );
209 $this->addWhereIf( 'rc_user = 0', isset( $show['anon'] ) );
210 $this->addWhereIf( 'rc_user != 0', isset( $show['!anon'] ) );
211 $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
212 $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
213 $this->addWhereIf( 'page_is_redirect = 1', isset( $show['redirect'] ) );
215 // Don't throw log entries out the window here
216 $this->addWhereIf( 'page_is_redirect = 0 OR page_is_redirect IS NULL', isset( $show['!redirect'] ) );
219 if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
220 $this->dieUsage( 'user and excludeuser cannot be used together', 'user-excludeuser' );
223 if ( !is_null( $params['user'] ) ) {
224 $this->addWhereFld( 'rc_user_text', $params['user'] );
225 $index['recentchanges'] = 'rc_user_text';
228 if ( !is_null( $params['excludeuser'] ) ) {
229 // We don't use the rc_user_text index here because
230 // * it would require us to sort by rc_user_text before rc_timestamp
231 // * the != condition doesn't throw out too many rows anyway
232 $this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) );
235 /* Add the fields we're concerned with to our query. */
236 $this->addFields( array(
237 'rc_timestamp',
238 'rc_namespace',
239 'rc_title',
240 'rc_cur_id',
241 'rc_type',
242 'rc_deleted'
243 ) );
245 $showRedirects = false;
246 /* Determine what properties we need to display. */
247 if ( !is_null( $params['prop'] ) ) {
248 $prop = array_flip( $params['prop'] );
250 /* Set up internal members based upon params. */
251 $this->initProperties( $prop );
253 if ( $this->fld_patrolled && !$user->useRCPatrol() && !$user->useNPPatrol() ) {
254 $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
257 $this->addFields( 'rc_id' );
258 /* Add fields to our query if they are specified as a needed parameter. */
259 $this->addFieldsIf( array( 'rc_this_oldid', 'rc_last_oldid' ), $this->fld_ids );
260 $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
261 $this->addFieldsIf( 'rc_user', $this->fld_user );
262 $this->addFieldsIf( 'rc_user_text', $this->fld_user || $this->fld_userid );
263 $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ), $this->fld_flags );
264 $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
265 $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
266 $this->addFieldsIf( array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), $this->fld_loginfo );
267 $showRedirects = $this->fld_redirect || isset( $show['redirect'] ) || isset( $show['!redirect'] );
270 if ( $this->fld_tags ) {
271 $this->addTables( 'tag_summary' );
272 $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rc_id=ts_rc_id' ) ) ) );
273 $this->addFields( 'ts_tags' );
276 if ( $params['toponly'] || $showRedirects ) {
277 $this->addTables( 'page' );
278 $this->addJoinConds( array( 'page' => array( 'LEFT JOIN', array( 'rc_namespace=page_namespace', 'rc_title=page_title' ) ) ) );
279 $this->addFields( 'page_is_redirect' );
281 if ( $params['toponly'] ) {
282 $this->addWhere( 'rc_this_oldid = page_latest' );
286 if ( !is_null( $params['tag'] ) ) {
287 $this->addTables( 'change_tag' );
288 $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rc_id=ct_rc_id' ) ) ) );
289 $this->addWhereFld( 'ct_tag', $params['tag'] );
290 global $wgOldChangeTagsIndex;
291 $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id';
294 $this->token = $params['token'];
295 $this->addOption( 'LIMIT', $params['limit'] + 1 );
296 $this->addOption( 'USE INDEX', $index );
298 $count = 0;
299 /* Perform the actual query. */
300 $res = $this->select( __METHOD__ );
302 $titles = array();
304 $result = $this->getResult();
306 /* Iterate through the rows, adding data extracted from them to our query result. */
307 foreach ( $res as $row ) {
308 if ( ++ $count > $params['limit'] ) {
309 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
310 $this->setContinueEnumParameter( 'continue', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id );
311 break;
314 if ( is_null( $resultPageSet ) ) {
315 /* Extract the data from a single row. */
316 $vals = $this->extractRowInfo( $row );
318 /* Add that row's data to our final output. */
319 if ( !$vals ) {
320 continue;
322 $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
323 if ( !$fit ) {
324 $this->setContinueEnumParameter( 'continue', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id );
325 break;
327 } else {
328 $titles[] = Title::makeTitle( $row->rc_namespace, $row->rc_title );
332 if ( is_null( $resultPageSet ) ) {
333 /* Format the result */
334 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'rc' );
335 } else {
336 $resultPageSet->populateFromTitles( $titles );
341 * Extracts from a single sql row the data needed to describe one recent change.
343 * @param mixed $row The row from which to extract the data.
344 * @return array An array mapping strings (descriptors) to their respective string values.
345 * @access public
347 public function extractRowInfo( $row ) {
348 /* Determine the title of the page that has been changed. */
349 $title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
351 /* Our output data. */
352 $vals = array();
354 $type = intval( $row->rc_type );
356 /* Determine what kind of change this was. */
357 switch ( $type ) {
358 case RC_EDIT:
359 $vals['type'] = 'edit';
360 break;
361 case RC_NEW:
362 $vals['type'] = 'new';
363 break;
364 case RC_MOVE:
365 $vals['type'] = 'move';
366 break;
367 case RC_LOG:
368 $vals['type'] = 'log';
369 break;
370 case RC_EXTERNAL:
371 $vals['type'] = 'external';
372 break;
373 case RC_MOVE_OVER_REDIRECT:
374 $vals['type'] = 'move over redirect';
375 break;
376 default:
377 $vals['type'] = $type;
380 /* Create a new entry in the result for the title. */
381 if ( $this->fld_title ) {
382 ApiQueryBase::addTitleInfo( $vals, $title );
385 /* Add ids, such as rcid, pageid, revid, and oldid to the change's info. */
386 if ( $this->fld_ids ) {
387 $vals['rcid'] = intval( $row->rc_id );
388 $vals['pageid'] = intval( $row->rc_cur_id );
389 $vals['revid'] = intval( $row->rc_this_oldid );
390 $vals['old_revid'] = intval( $row->rc_last_oldid );
393 /* Add user data and 'anon' flag, if use is anonymous. */
394 if ( $this->fld_user || $this->fld_userid ) {
396 if ( $this->fld_user ) {
397 $vals['user'] = $row->rc_user_text;
400 if ( $this->fld_userid ) {
401 $vals['userid'] = $row->rc_user;
404 if ( !$row->rc_user ) {
405 $vals['anon'] = '';
409 /* Add flags, such as new, minor, bot. */
410 if ( $this->fld_flags ) {
411 if ( $row->rc_bot ) {
412 $vals['bot'] = '';
414 if ( $row->rc_type == RC_NEW ) {
415 $vals['new'] = '';
417 if ( $row->rc_minor ) {
418 $vals['minor'] = '';
422 /* Add sizes of each revision. (Only available on 1.10+) */
423 if ( $this->fld_sizes ) {
424 $vals['oldlen'] = intval( $row->rc_old_len );
425 $vals['newlen'] = intval( $row->rc_new_len );
428 /* Add the timestamp. */
429 if ( $this->fld_timestamp ) {
430 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->rc_timestamp );
433 /* Add edit summary / log summary. */
434 if ( $this->fld_comment && isset( $row->rc_comment ) ) {
435 $vals['comment'] = $row->rc_comment;
438 if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
439 $vals['parsedcomment'] = Linker::formatComment( $row->rc_comment, $title );
442 if ( $this->fld_redirect ) {
443 if ( $row->page_is_redirect ) {
444 $vals['redirect'] = '';
448 /* Add the patrolled flag */
449 if ( $this->fld_patrolled && $row->rc_patrolled == 1 ) {
450 $vals['patrolled'] = '';
453 if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
454 $vals['logid'] = intval( $row->rc_logid );
455 $vals['logtype'] = $row->rc_log_type;
456 $vals['logaction'] = $row->rc_log_action;
457 $logEntry = DatabaseLogEntry::newFromRow( (array)$row );
458 ApiQueryLogEvents::addLogParams(
459 $this->getResult(),
460 $vals,
461 $logEntry->getParameters(),
462 $logEntry->getType(),
463 $logEntry->getSubtype(),
464 $logEntry->getTimestamp()
468 if ( $this->fld_tags ) {
469 if ( $row->ts_tags ) {
470 $tags = explode( ',', $row->ts_tags );
471 $this->getResult()->setIndexedTagName( $tags, 'tag' );
472 $vals['tags'] = $tags;
473 } else {
474 $vals['tags'] = array();
478 if ( !is_null( $this->token ) ) {
479 $tokenFunctions = $this->getTokenFunctions();
480 foreach ( $this->token as $t ) {
481 $val = call_user_func( $tokenFunctions[$t], $row->rc_cur_id,
482 $title, RecentChange::newFromRow( $row ) );
483 if ( $val === false ) {
484 $this->setWarning( "Action '$t' is not allowed for the current user" );
485 } else {
486 $vals[$t . 'token'] = $val;
491 return $vals;
494 private function parseRCType( $type ) {
495 if ( is_array( $type ) ) {
496 $retval = array();
497 foreach ( $type as $t ) {
498 $retval[] = $this->parseRCType( $t );
500 return $retval;
502 switch( $type ) {
503 case 'edit':
504 return RC_EDIT;
505 case 'new':
506 return RC_NEW;
507 case 'log':
508 return RC_LOG;
509 case 'external':
510 return RC_EXTERNAL;
514 public function getCacheMode( $params ) {
515 if ( isset( $params['show'] ) ) {
516 foreach ( $params['show'] as $show ) {
517 if ( $show === 'patrolled' || $show === '!patrolled' ) {
518 return 'private';
522 if ( isset( $params['token'] ) ) {
523 return 'private';
525 if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
526 // formatComment() calls wfMessage() among other things
527 return 'anon-public-user-private';
529 return 'public';
532 public function getAllowedParams() {
533 return array(
534 'start' => array(
535 ApiBase::PARAM_TYPE => 'timestamp'
537 'end' => array(
538 ApiBase::PARAM_TYPE => 'timestamp'
540 'dir' => array(
541 ApiBase::PARAM_DFLT => 'older',
542 ApiBase::PARAM_TYPE => array(
543 'newer',
544 'older'
547 'namespace' => array(
548 ApiBase::PARAM_ISMULTI => true,
549 ApiBase::PARAM_TYPE => 'namespace'
551 'user' => array(
552 ApiBase::PARAM_TYPE => 'user'
554 'excludeuser' => array(
555 ApiBase::PARAM_TYPE => 'user'
557 'tag' => null,
558 'prop' => array(
559 ApiBase::PARAM_ISMULTI => true,
560 ApiBase::PARAM_DFLT => 'title|timestamp|ids',
561 ApiBase::PARAM_TYPE => array(
562 'user',
563 'userid',
564 'comment',
565 'parsedcomment',
566 'flags',
567 'timestamp',
568 'title',
569 'ids',
570 'sizes',
571 'redirect',
572 'patrolled',
573 'loginfo',
574 'tags'
577 'token' => array(
578 ApiBase::PARAM_TYPE => array_keys( $this->getTokenFunctions() ),
579 ApiBase::PARAM_ISMULTI => true
581 'show' => array(
582 ApiBase::PARAM_ISMULTI => true,
583 ApiBase::PARAM_TYPE => array(
584 'minor',
585 '!minor',
586 'bot',
587 '!bot',
588 'anon',
589 '!anon',
590 'redirect',
591 '!redirect',
592 'patrolled',
593 '!patrolled'
596 'limit' => array(
597 ApiBase::PARAM_DFLT => 10,
598 ApiBase::PARAM_TYPE => 'limit',
599 ApiBase::PARAM_MIN => 1,
600 ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
601 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
603 'type' => array(
604 ApiBase::PARAM_ISMULTI => true,
605 ApiBase::PARAM_TYPE => array(
606 'edit',
607 'external',
608 'new',
609 'log'
612 'toponly' => false,
613 'continue' => null,
617 public function getParamDescription() {
618 $p = $this->getModulePrefix();
619 return array(
620 'start' => 'The timestamp to start enumerating from',
621 'end' => 'The timestamp to end enumerating',
622 'dir' => $this->getDirectionDescription( $p ),
623 'namespace' => 'Filter log entries to only this namespace(s)',
624 'user' => 'Only list changes by this user',
625 'excludeuser' => 'Don\'t list changes by this user',
626 'prop' => array(
627 'Include additional pieces of information',
628 ' user - Adds the user responsible for the edit and tags if they are an IP',
629 ' userid - Adds the user id responsible for the edit',
630 ' comment - Adds the comment for the edit',
631 ' parsedcomment - Adds the parsed comment for the edit',
632 ' flags - Adds flags for the edit',
633 ' timestamp - Adds timestamp of the edit',
634 ' title - Adds the page title of the edit',
635 ' ids - Adds the page ID, recent changes ID and the new and old revision ID',
636 ' sizes - Adds the new and old page length in bytes',
637 ' redirect - Tags edit if page is a redirect',
638 ' patrolled - Tags edits that have been patrolled',
639 ' loginfo - Adds log information (logid, logtype, etc) to log entries',
640 ' tags - Lists tags for the entry',
642 'token' => 'Which tokens to obtain for each change',
643 'show' => array(
644 'Show only items that meet this criteria.',
645 "For example, to see only minor edits done by logged-in users, set {$p}show=minor|!anon"
647 'type' => 'Which types of changes to show',
648 'limit' => 'How many total changes to return',
649 'tag' => 'Only list changes tagged with this tag',
650 'toponly' => 'Only list changes which are the latest revision',
651 'continue' => 'When more results are available, use this to continue',
655 public function getResultProperties() {
656 global $wgLogTypes;
657 $props = array(
658 '' => array(
659 'type' => array(
660 ApiBase::PROP_TYPE => array(
661 'edit',
662 'new',
663 'move',
664 'log',
665 'move over redirect'
669 'title' => array(
670 'ns' => 'namespace',
671 'title' => 'string',
672 'new_ns' => array(
673 ApiBase::PROP_TYPE => 'namespace',
674 ApiBase::PROP_NULLABLE => true
676 'new_title' => array(
677 ApiBase::PROP_TYPE => 'string',
678 ApiBase::PROP_NULLABLE => true
681 'ids' => array(
682 'rcid' => 'integer',
683 'pageid' => 'integer',
684 'revid' => 'integer',
685 'old_revid' => 'integer'
687 'user' => array(
688 'user' => 'string',
689 'anon' => 'boolean'
691 'userid' => array(
692 'userid' => 'integer',
693 'anon' => 'boolean'
695 'flags' => array(
696 'bot' => 'boolean',
697 'new' => 'boolean',
698 'minor' => 'boolean'
700 'sizes' => array(
701 'oldlen' => 'integer',
702 'newlen' => 'integer'
704 'timestamp' => array(
705 'timestamp' => 'timestamp'
707 'comment' => array(
708 'comment' => array(
709 ApiBase::PROP_TYPE => 'string',
710 ApiBase::PROP_NULLABLE => true
713 'parsedcomment' => array(
714 'parsedcomment' => array(
715 ApiBase::PROP_TYPE => 'string',
716 ApiBase::PROP_NULLABLE => true
719 'redirect' => array(
720 'redirect' => 'boolean'
722 'patrolled' => array(
723 'patrolled' => 'boolean'
725 'loginfo' => array(
726 'logid' => array(
727 ApiBase::PROP_TYPE => 'integer',
728 ApiBase::PROP_NULLABLE => true
730 'logtype' => array(
731 ApiBase::PROP_TYPE => $wgLogTypes,
732 ApiBase::PROP_NULLABLE => true
734 'logaction' => array(
735 ApiBase::PROP_TYPE => 'string',
736 ApiBase::PROP_NULLABLE => true
741 self::addTokenProperties( $props, $this->getTokenFunctions() );
743 return $props;
746 public function getDescription() {
747 return 'Enumerate recent changes';
750 public function getPossibleErrors() {
751 return array_merge( parent::getPossibleErrors(), array(
752 array( 'show' ),
753 array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
754 array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
755 ) );
758 public function getExamples() {
759 return array(
760 'api.php?action=query&list=recentchanges'
764 public function getHelpUrls() {
765 return 'https://www.mediawiki.org/wiki/API:Recentchanges';