Go to the documentation of this file.
36 parent::__construct(
$query, $moduleName,
'wl' );
44 $this->
run( $resultPageSet );
57 private function run( $resultPageSet =
null ) {
65 if ( !is_null(
$params[
'prop'] ) && is_null( $resultPageSet ) ) {
66 $prop = array_flip(
$params[
'prop'] );
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'] );
81 if ( $this->fld_patrol ) {
82 if ( !
$user->useRCPatrol() && !
$user->useNPPatrol() ) {
83 $this->
dieUsage(
'patrol property is not available',
'patrol' );
97 if ( is_null( $resultPageSet ) ) {
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 );
112 array(
'rc_logid',
'rc_log_type',
'rc_log_action',
'rc_params' ),
115 } elseif (
$params[
'allrev'] ) {
126 $userId = $wlowner->getId();
129 'wl_user' => $userId,
130 'wl_namespace=rc_namespace',
135 $db = $this->
getDB();
142 if ( !is_null(
$params[
'continue'] ) ) {
143 $cont = explode(
'|',
$params[
'continue'] );
145 $op = (
$params[
'dir'] ===
'newer' ?
'>' :
'<' );
146 $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
147 $continueId = (int)$cont[1];
149 $this->
addWhere(
"rc_timestamp $op $continueTimestamp OR " .
150 "(rc_timestamp = $continueTimestamp AND " .
151 "rc_id $op= $continueId)"
160 $this->
addWhere(
'rc_this_oldid=page_latest OR rc_type=' .
RC_LOG );
163 if ( !is_null(
$params[
'show'] ) ) {
164 $show = array_flip(
$params[
'show'] );
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'] ) )
176 if ( isset( $show[
'patrolled'] ) || isset( $show[
'!patrolled'] ) ) {
177 if ( !
$user->useRCPatrol() && !
$user->useNPPatrol() ) {
179 'You need the patrol right to request the patrolled flag',
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'] ) );
196 if ( !is_null(
$params[
'type'] ) ) {
200 if ( !is_null(
$params[
'user'] ) && !is_null(
$params[
'excludeuser'] ) ) {
201 $this->
dieUsage(
'user and excludeuser cannot be used together',
'user-excludeuser' );
203 if ( !is_null(
$params[
'user'] ) ) {
206 if ( !is_null(
$params[
'excludeuser'] ) ) {
207 $this->
addWhere(
'rc_user_text != ' . $db->addQuotes(
$params[
'excludeuser'] ) );
213 !isset(
$params[
'start'] ) && !isset(
$params[
'end'] ) && $db->getType() ==
'mysql'
217 if ( !is_null(
$params[
'user'] ) || !is_null(
$params[
'excludeuser'] ) ) {
218 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
220 } elseif ( !
$user->isAllowed(
'suppressrevision' ) ) {
226 $this->
addWhere( $this->
getDB()->bitAnd(
'rc_deleted', $bitmask ) .
" != $bitmask" );
232 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
234 } elseif ( !
$user->isAllowed(
'suppressrevision' ) ) {
242 $this->
getDB()->bitAnd(
'rc_deleted', $bitmask ) .
" != $bitmask",
252 foreach (
$res as $row ) {
260 if ( is_null( $resultPageSet ) ) {
269 $ids[] = intval( $row->rc_this_oldid );
271 $ids[] = intval( $row->rc_cur_id );
276 if ( is_null( $resultPageSet ) ) {
277 $this->
getResult()->setIndexedTagName_internal(
281 } elseif (
$params[
'allrev'] ) {
282 $resultPageSet->populateFromRevisionIDs( $ids );
284 $resultPageSet->populateFromPageIDs( $ids );
296 $type = intval( $row->rc_type );
301 $vals[
'type'] =
'edit';
304 $vals[
'type'] =
'new';
307 $vals[
'type'] =
'move';
310 $vals[
'type'] =
'log';
313 $vals[
'type'] =
'external';
316 $vals[
'type'] =
'move over redirect';
319 $vals[
'type'] =
$type;
325 if ( $this->fld_title || $this->fld_ids ) {
328 $vals[
'actionhidden'] =
'';
334 if ( $this->fld_title ) {
337 if ( $this->fld_ids ) {
338 $vals[
'pageid'] = intval( $row->rc_cur_id );
339 $vals[
'revid'] = intval( $row->rc_this_oldid );
340 $vals[
'old_revid'] = intval( $row->rc_last_oldid );
346 if ( $this->fld_user || $this->fld_userid ) {
348 $vals[
'userhidden'] =
'';
352 if ( $this->fld_userid ) {
353 $vals[
'userid'] = $row->rc_user;
355 $vals[
'user'] = $row->rc_user;
358 if ( $this->fld_user ) {
359 $vals[
'user'] = $row->rc_user_text;
362 if ( !$row->rc_user ) {
369 if ( $this->fld_flags ) {
370 if ( $row->rc_bot ) {
373 if ( $row->rc_type ==
RC_NEW ) {
376 if ( $row->rc_minor ) {
382 if ( $this->fld_sizes ) {
383 $vals[
'oldlen'] = intval( $row->rc_old_len );
384 $vals[
'newlen'] = intval( $row->rc_new_len );
388 if ( $this->fld_timestamp ) {
392 if ( $this->fld_notificationtimestamp ) {
393 $vals[
'notificationtimestamp'] = ( $row->wl_notificationtimestamp == null )
399 if ( $this->fld_comment || $this->fld_parsedcomment ) {
401 $vals[
'commenthidden'] =
'';
405 if ( $this->fld_comment && isset( $row->rc_comment ) ) {
406 $vals[
'comment'] = $row->rc_comment;
409 if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
416 if ( $this->fld_patrol && $row->rc_patrolled == 1 ) {
417 $vals[
'patrolled'] =
'';
421 $vals[
'unpatrolled'] =
'';
424 if ( $this->fld_loginfo && $row->rc_type ==
RC_LOG ) {
426 $vals[
'actionhidden'] =
'';
430 $vals[
'logid'] = intval( $row->rc_logid );
431 $vals[
'logtype'] = $row->rc_log_type;
432 $vals[
'logaction'] = $row->rc_log_action;
437 $logEntry->getParameters(),
438 $logEntry->getType(),
439 $logEntry->getSubtype(),
440 $logEntry->getTimestamp()
446 $vals[
'suppressed'] =
'';
458 if ( is_array(
$type ) ) {
490 'namespace' =>
array(
497 'excludeuser' =>
array(
528 'notificationtimestamp',
568 'allrev' =>
'Include multiple revisions of the same page within given timeframe',
569 'start' =>
'The timestamp to start enumerating from',
570 'end' =>
'The timestamp to end enumerating',
571 'namespace' =>
'Filter changes to only the given namespace(s)',
572 'user' =>
'Only list changes by this user',
573 'excludeuser' =>
'Don\'t list changes by this user',
575 'limit' =>
'How many total results to return per request',
577 'Which additional items to get (non-generator mode only).',
578 ' ids - Adds revision ids and page ids',
579 ' title - Adds title of the page',
580 ' flags - Adds flags for the edit',
581 ' user - Adds the user who made the edit',
582 ' userid - Adds user id of whom made the edit',
583 ' comment - Adds comment of the edit',
584 ' parsedcomment - Adds parsed comment of the edit',
585 ' timestamp - Adds timestamp of the edit',
586 ' patrol - Tags edits that are patrolled',
587 ' sizes - Adds the old and new lengths of the page',
588 ' notificationtimestamp - Adds timestamp of when the user was last notified about the edit',
589 ' loginfo - Adds log information where appropriate',
592 'Show only items that meet this criteria.',
593 "For example, to see only minor edits done by logged-in users, set {$p}show=minor|!anon"
596 'Which types of changes to show',
597 ' edit - Regular page edits',
598 ' external - External changes',
599 ' new - Page creations',
600 ' log - Log entries',
602 'owner' =>
'The name of the user whose watchlist you\'d like to access',
603 'token' =>
'Give a security token (settable in preferences) to ' .
604 'allow access to another user\'s watchlist',
605 'continue' =>
'When more results are available, use this to continue',
625 'pageid' =>
'integer',
626 'revid' =>
'integer',
627 'old_revid' =>
'integer'
638 'userid' =>
'integer',
643 'minor' =>
'boolean',
647 'patrolled' =>
'boolean'
649 'timestamp' =>
array(
650 'timestamp' =>
'timestamp'
653 'oldlen' =>
'integer',
654 'newlen' =>
'integer'
656 'notificationtimestamp' =>
array(
657 'notificationtimestamp' =>
array(
668 'parsedcomment' =>
array(
669 'parsedcomment' =>
array(
683 'logaction' =>
array(
692 return "Get all recent changes to pages in the logged in user's watchlist.";
696 return array_merge( parent::getPossibleErrors(),
array(
697 array(
'code' =>
'bad_wlowner',
'info' =>
'Specified user does not exist' ),
699 'code' =>
'bad_wltoken',
700 'info' =>
'Incorrect watchlist token provided -- ' .
701 'please set a correct token in Special:Preferences'
703 array(
'code' =>
'notloggedin',
'info' =>
'You must be logged-in to have a watchlist' ),
704 array(
'code' =>
'patrol',
'info' =>
'patrol property is not available' ),
707 'code' =>
'permissiondenied',
708 'info' =>
'You need the patrol right to request the patrolled flag'
710 array(
'code' =>
'user-excludeuser',
'info' =>
'user and excludeuser cannot be used together' ),
716 'api.php?action=query&list=watchlist',
717 'api.php?action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment',
718 'api.php?action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment',
719 'api.php?action=query&generator=watchlist&prop=info',
720 'api.php?action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user',
721 'api.php?action=query&list=watchlist&wlowner=Bob_Smith&wltoken=123ABC'
726 return 'https://www.mediawiki.org/wiki/API:Watchlist';
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
addFields( $value)
Add a set of fields to select to the internal array.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy=false)
getParamDescription()
Returns an array of parameter descriptions.
getExamples()
Returns usage examples for this module.
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
dieUsageMsg( $error)
Output the error message related to a certain array.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const RC_MOVE_OVER_REDIRECT
getResult()
Get the result object.
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
getDirectionDescription( $p='', $extraDirText='')
Gets the personalised direction parameter description.
$fld_notificationtimestamp
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
static formatComment( $comment, $title=null, $local=false)
This function is called by all recent changes variants, by the page history, and by the user contribu...
getUser()
Get the User object.
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
setContinueEnumParameter( $paramName, $paramValue)
Overrides base in case of generator & smart continue to notify ApiQueryMain instead of adding them to...
static newFromRow( $row)
Constructs new LogEntry from database result row.
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
getDB()
Get the Query database connection (read-only)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
executeGenerator( $resultPageSet)
Execute this module as a generator.
when a variable name is used in a it is silently declared as a new masking the global
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
addWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, and an ORDER BY clause to sort in the right direction.
__construct( $query, $moduleName)
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
presenting them properly to the user as errors is done by the caller $title
getWatchlistUser( $params)
Gets the user for whom to get the watchlist.
dieContinueUsageIf( $condition)
Die with the $prefix.
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
getDescription()
Returns the description string for this module.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
This query action allows clients to retrieve a list of recently modified pages that are part of the l...
selectNamedDB( $name, $db, $groups)
Selects the query database connection with the given name.
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getModuleName()
Get the name of the module being executed by this instance.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
static isUnpatrolled( $rc, User $user)
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
run( $resultPageSet=null)
parseRCType( $type)
Copied from ApiQueryRecentChanges.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
addWhereIf( $value, $condition)
Same as addWhere(), but add the WHERE clauses only if a condition is met.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.