2006-10-13 06:13:13 +00:00
|
|
|
<?php
|
2010-02-26 13:18:56 +00:00
|
|
|
/**
|
2012-07-15 20:13:02 +00:00
|
|
|
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
|
2006-10-13 06:13:13 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-06-21 13:13:32 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-10-13 06:13:13 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-07 19:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
2006-10-13 06:13:13 +00:00
|
|
|
*/
|
|
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
2007-04-20 08:55:14 +00:00
|
|
|
/**
|
2007-05-20 23:31:44 +00:00
|
|
|
* This query action allows clients to retrieve a list of recently modified pages
|
|
|
|
|
* that are part of the logged-in user's watchlist.
|
2008-04-14 07:45:50 +00:00
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup API
|
2007-04-20 08:55:14 +00:00
|
|
|
*/
|
2006-10-13 06:13:13 +00:00
|
|
|
class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|
|
|
|
|
2017-09-10 22:13:26 +00:00
|
|
|
/** @var CommentStore */
|
2017-06-06 17:39:14 +00:00
|
|
|
private $commentStore;
|
|
|
|
|
|
2014-03-25 17:22:11 +00:00
|
|
|
public function __construct( ApiQuery $query, $moduleName ) {
|
2010-02-26 13:18:56 +00:00
|
|
|
parent::__construct( $query, $moduleName, 'wl' );
|
2006-10-13 06:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function execute() {
|
|
|
|
|
$this->run();
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
public function executeGenerator( $resultPageSet ) {
|
|
|
|
|
$this->run( $resultPageSet );
|
2006-10-13 06:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-11-14 13:31:56 +00:00
|
|
|
private $fld_ids = false, $fld_title = false, $fld_patrol = false,
|
|
|
|
|
$fld_flags = false, $fld_timestamp = false, $fld_user = false,
|
|
|
|
|
$fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
|
|
|
|
|
$fld_notificationtimestamp = false, $fld_userid = false,
|
2017-12-06 19:56:19 +00:00
|
|
|
$fld_loginfo = false, $fld_tags;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2011-02-19 00:30:18 +00:00
|
|
|
/**
|
2014-04-15 18:12:09 +00:00
|
|
|
* @param ApiPageSet $resultPageSet
|
2012-01-12 19:41:18 +00:00
|
|
|
* @return void
|
2011-02-19 00:30:18 +00:00
|
|
|
*/
|
2010-01-11 15:55:52 +00:00
|
|
|
private function run( $resultPageSet = null ) {
|
2016-09-05 19:55:19 +00:00
|
|
|
$this->selectNamedDB( 'watchlist', DB_REPLICA, 'watchlist' );
|
2007-05-15 02:16:48 +00:00
|
|
|
|
2008-12-17 16:34:01 +00:00
|
|
|
$params = $this->extractRequestParams();
|
2010-07-23 07:33:40 +00:00
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
$user = $this->getUser();
|
|
|
|
|
$wlowner = $this->getWatchlistUser( $params );
|
2009-07-24 01:22:06 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( !is_null( $params['prop'] ) && is_null( $resultPageSet ) ) {
|
|
|
|
|
$prop = array_flip( $params['prop'] );
|
2006-10-16 05:53:07 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->fld_ids = isset( $prop['ids'] );
|
|
|
|
|
$this->fld_title = isset( $prop['title'] );
|
|
|
|
|
$this->fld_flags = isset( $prop['flags'] );
|
|
|
|
|
$this->fld_user = isset( $prop['user'] );
|
2010-08-28 01:09:21 +00:00
|
|
|
$this->fld_userid = isset( $prop['userid'] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->fld_comment = isset( $prop['comment'] );
|
2013-04-26 12:18:06 +00:00
|
|
|
$this->fld_parsedcomment = isset( $prop['parsedcomment'] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->fld_timestamp = isset( $prop['timestamp'] );
|
|
|
|
|
$this->fld_sizes = isset( $prop['sizes'] );
|
|
|
|
|
$this->fld_patrol = isset( $prop['patrol'] );
|
2010-01-30 22:48:54 +00:00
|
|
|
$this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
|
2011-05-20 21:47:38 +00:00
|
|
|
$this->fld_loginfo = isset( $prop['loginfo'] );
|
2017-12-06 19:56:19 +00:00
|
|
|
$this->fld_tags = isset( $prop['tags'] );
|
2007-05-20 10:08:40 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( $this->fld_patrol ) {
|
2010-02-26 13:18:56 +00:00
|
|
|
if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2006-10-16 05:53:07 +00:00
|
|
|
}
|
2017-06-06 17:39:14 +00:00
|
|
|
|
|
|
|
|
if ( $this->fld_comment || $this->fld_parsedcomment ) {
|
2018-01-24 23:41:01 +00:00
|
|
|
$this->commentStore = CommentStore::getStore();
|
2017-06-06 17:39:14 +00:00
|
|
|
}
|
2006-10-16 05:53:07 +00:00
|
|
|
}
|
2010-02-26 13:18:56 +00:00
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
$options = [
|
|
|
|
|
'dir' => $params['dir'] === 'older'
|
|
|
|
|
? WatchedItemQueryService::DIR_OLDER
|
|
|
|
|
: WatchedItemQueryService::DIR_NEWER,
|
|
|
|
|
];
|
2006-10-16 05:53:07 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( is_null( $resultPageSet ) ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$options['includeFields'] = $this->getFieldsToInclude();
|
2006-10-14 16:02:42 +00:00
|
|
|
} else {
|
2016-04-19 09:34:31 +00:00
|
|
|
$options['usedInGenerator'] = true;
|
2006-10-14 16:02:42 +00:00
|
|
|
}
|
2006-10-13 06:13:13 +00:00
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $params['start'] ) {
|
|
|
|
|
$options['start'] = $params['start'];
|
|
|
|
|
}
|
|
|
|
|
if ( $params['end'] ) {
|
|
|
|
|
$options['end'] = $params['end'];
|
|
|
|
|
}
|
2013-12-24 20:26:47 +00:00
|
|
|
|
2016-10-11 20:17:22 +00:00
|
|
|
$startFrom = null;
|
2013-12-24 20:26:47 +00:00
|
|
|
if ( !is_null( $params['continue'] ) ) {
|
|
|
|
|
$cont = explode( '|', $params['continue'] );
|
|
|
|
|
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
2016-04-19 09:34:31 +00:00
|
|
|
$continueTimestamp = $cont[0];
|
2013-12-24 20:26:47 +00:00
|
|
|
$continueId = (int)$cont[1];
|
|
|
|
|
$this->dieContinueUsageIf( $continueId != $cont[1] );
|
2016-10-11 20:17:22 +00:00
|
|
|
$startFrom = [ $continueTimestamp, $continueId ];
|
2016-04-19 09:34:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $wlowner !== $user ) {
|
|
|
|
|
$options['watchlistOwner'] = $wlowner;
|
|
|
|
|
$options['watchlistOwnerToken'] = $params['token'];
|
2013-12-24 20:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( !is_null( $params['namespace'] ) ) {
|
|
|
|
|
$options['namespaceIds'] = $params['namespace'];
|
|
|
|
|
}
|
2011-08-08 16:20:17 +00:00
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $params['allrev'] ) {
|
|
|
|
|
$options['allRevisions'] = true;
|
2011-08-08 16:20:17 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( !is_null( $params['show'] ) ) {
|
|
|
|
|
$show = array_flip( $params['show'] );
|
2008-01-15 16:08:21 +00:00
|
|
|
|
|
|
|
|
/* Check for conflicting parameters. */
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $this->showParamsConflicting( $show ) ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->dieWithError( 'apierror-show' );
|
2008-01-15 16:08:21 +00:00
|
|
|
}
|
2010-02-26 13:18:56 +00:00
|
|
|
|
2010-07-23 07:17:56 +00:00
|
|
|
// Check permissions.
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
|
|
|
|
|
|| isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] )
|
|
|
|
|
) {
|
2011-10-26 23:27:01 +00:00
|
|
|
if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
|
2010-07-14 19:00:54 +00:00
|
|
|
}
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2008-01-15 16:08:21 +00:00
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
$options['filters'] = array_keys( $show );
|
2008-01-15 16:08:21 +00:00
|
|
|
}
|
2009-07-24 01:22:06 +00:00
|
|
|
|
2013-04-30 16:01:00 +00:00
|
|
|
if ( !is_null( $params['type'] ) ) {
|
2014-05-15 10:18:28 +00:00
|
|
|
try {
|
2016-12-20 19:40:03 +00:00
|
|
|
$rcTypes = RecentChange::parseToRCType( $params['type'] );
|
|
|
|
|
if ( $rcTypes ) {
|
|
|
|
|
$options['rcTypes'] = $rcTypes;
|
|
|
|
|
}
|
2015-01-09 23:44:47 +00:00
|
|
|
} catch ( Exception $e ) {
|
2014-05-15 10:18:28 +00:00
|
|
|
ApiBase::dieDebug( __METHOD__, $e->getMessage() );
|
|
|
|
|
}
|
2013-04-30 16:01:00 +00:00
|
|
|
}
|
|
|
|
|
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
|
2010-02-26 13:18:56 +00:00
|
|
|
if ( !is_null( $params['user'] ) ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$options['onlyByUser'] = $params['user'];
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
|
|
|
|
if ( !is_null( $params['excludeuser'] ) ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$options['notByUser'] = $params['excludeuser'];
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
|
|
|
|
|
2016-10-11 20:17:22 +00:00
|
|
|
$options['limit'] = $params['limit'];
|
|
|
|
|
|
|
|
|
|
Hooks::run( 'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions', [
|
|
|
|
|
$this, $params, &$options
|
|
|
|
|
] );
|
2006-10-13 06:13:13 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$ids = [];
|
2006-10-13 06:13:13 +00:00
|
|
|
$count = 0;
|
2016-04-19 09:34:31 +00:00
|
|
|
$watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService();
|
2016-10-11 20:17:22 +00:00
|
|
|
$items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom );
|
2006-10-20 07:10:18 +00:00
|
|
|
|
2017-08-11 13:53:17 +00:00
|
|
|
foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
/** @var WatchedItem $watchedItem */
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( is_null( $resultPageSet ) ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );
|
2016-02-17 09:09:32 +00:00
|
|
|
$fit = $this->getResult()->addValue( [ 'query', $this->getModuleName() ], null, $vals );
|
2010-02-26 13:18:56 +00:00
|
|
|
if ( !$fit ) {
|
2016-10-11 20:17:22 +00:00
|
|
|
$startFrom = [ $recentChangeInfo['rc_timestamp'], $recentChangeInfo['rc_id'] ];
|
* API: BREAKING CHANGE: (bug 11430) Return fewer results than the limit in some cases to prevent running out of memory
* This means queries could possibly return fewer results than the limit and still set a query-continue
* Add iicontinue, rvcontinue, cicontinue, incontinue, amfrom to faciliate query-continue for these modules
* Implemented by blocking additions to the ApiResult object if they would make it too large
** Important things like query-continue values and warnings are exempt from this check
** RSS feeds and exported XML are also exempted (size-checking them would be too messy)
** Result size is checked against $wgAPIMaxResultSize, which defaults to 8 MB
For those who really care, per-file details follow:
ApiResult.php:
* Introduced ApiResult::$mSize which keeps track of the result size.
* Introduced ApiResult::size() which calculates an array's size
(which is the sum of the strlen()s of its elements).
* ApiResult::addValue() now checks that the result size stays below
$wgAPIMaxResultSize. If the item won't fit, it won't be added and addValue()
will return false. Callers should check the return value and set a
query-continue if it's false.
* Closed the back door that is ApiResult::getData(): callers can't manipulate
the data array directly anymore so they can't bypass the result size limit.
* Added ApiResult::setIndexedTagName_internal() which will call
setIndexedTagName() on an array already in the result. This is needed for the
'new' order of adding results, which means addValue()ing one result at a time
until you hit the limit or run out, then calling this function to set the tag
name.
* Added ApiResult::disableSizeCheck() and enableSizeCheck() which disable and
enable size checking in addValue(). This is used for stuff like query-continue
elements and warnings which shouldn't count towards the result size.
* Added ApiResult::unsetValue() which removes an element from the result and
decreases $mSize.
ApiBase.php:
* Like ApiResult::getData(), ApiBase::getResultData() no longer returns a
reference.
* Use ApiResult::disableSizeCheck() in ApiBase::setWarning()
ApiQueryBase.php:
* Added ApiQueryBase::addPageSubItem(), which adds page subitems one item
at a time.
* addPageSubItem() and addPageSubItems() now return whether the subitem
fit in the result.
* Use ApiResult::disableSizeCheck() in setContinueEnumParameter()
ApiMain.php:
* Use ApiResult::disableSizeCheck() in ApiMain::substituteResultWithError()
* Use getParameter() rather than $mRequest to obtain requestid
DefaultSettings.php:
* Added $wgAPIMaxResultSize, with a default value of 8 MB
ApiQuery*.php:
* Added results one at a time, and set a query-continue if the result is full.
ApiQueryLangLinks.php and friends:
* Migrated from addPageSubItems() to addPageSubItem(). This eliminates the
need for $lastId.
ApiQueryAllLinks.php, ApiQueryWatchlist.php, ApiQueryAllimages.php, ApiQuerySearch.php:
* Renamed $data to something more appropriate ($pageids, $ids or $titles)
ApiQuerySiteinfo.php:
* Abuse siprop as a query-continue parameter and set it to all props that
couldn't be processed.
ApiQueryRandom.php:
* Doesn't do continuations, because the result is supposed to be random.
* Be smart enough to not run the second query if the results of the first
didn't fit.
ApiQueryImageInfo.php, ApiQueryRevisions.php, ApiQueryCategoryInfo.php, ApiQueryInfo.php:
* Added continue parameter which basically skips the first so many items
ApiQueryBacklinks.php:
* Throw the result in a big array first and addValue() that one element at a time if necessary
** This is necessary because the results aren't retrieved in order
* Introduced $this->pageMap to map namespace and title to page ID
* Rewritten extractRowInfo() and extractRedirRowInfo() a little
* Declared all private member variables explicitly
ApiQueryDeletedrevs.php:
* Use a pagemap just like in Backlinks
* Introduce fake page IDs and keep track of them so we know where to add what
** This doesn't change the output format, because the fake page IDs start at 0 and are consecutive
ApiQueryAllmessages.php:
* Add amfrom to facilitate query-continue
ApiQueryUsers.php:
* Rewrite: put the getOtherUsersInfo() code in execute()
2009-02-05 14:30:59 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2006-10-21 08:26:32 +00:00
|
|
|
} else {
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( $params['allrev'] ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$ids[] = intval( $recentChangeInfo['rc_this_oldid'] );
|
2007-07-14 19:04:31 +00:00
|
|
|
} else {
|
2016-04-19 09:34:31 +00:00
|
|
|
$ids[] = intval( $recentChangeInfo['rc_cur_id'] );
|
2006-10-16 00:08:03 +00:00
|
|
|
}
|
2006-10-13 06:13:13 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-10-21 08:26:32 +00:00
|
|
|
|
2016-10-11 20:17:22 +00:00
|
|
|
if ( $startFrom !== null ) {
|
|
|
|
|
$this->setContinueEnumParameter( 'continue', implode( '|', $startFrom ) );
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( is_null( $resultPageSet ) ) {
|
API: Overhaul ApiResult, make format=xml not throw, and add json formatversion
ApiResult was a mess: some methods could only be used with an array
reference instead of manipulating the stored data, methods that had both
array-ref and internal-data versions had names that didn't at all
correspond, some methods that worked on an array reference were
annoyingly non-static, and then the whole mess with setIndexedTagName.
ApiFormatXml is also entirely annoying to deal with, as it liked to
throw exceptions if certain metadata wasn't provided that no other
formatter required. Its legacy also means we have this silly convention
of using empty-string rather than boolean true, annoying restrictions on
keys (leading to things that should be hashes being arrays of key-value
object instead), '*' used as a key all over the place, and so on.
So, changes here:
* ApiResult is no longer an ApiBase or a ContextSource.
* Wherever sensible, ApiResult provides a static method working on an
arrayref and a non-static method working on internal data.
* Metadata is now always added to ApiResult's internal data structure.
Formatters are responsible for stripping it if necessary. "raw mode"
is deprecated.
* New metadata to replace the '*' key, solve the array() => '[]' vs '{}'
question, and so on.
* New class for formatting warnings and errors using i18n messages, and
support for multiple errors and a more machine-readable format for
warnings. For the moment, though, the actual output will not be changing
yet (see T47843 for future plans).
* New formatversion parameter for format=json and format=php, to select
between BC mode and the modern output.
* In BC mode, booleans will be converted to empty-string presence style;
modules currently returning booleans will need to use
ApiResult::META_BC_BOOLS to preserve their current output.
Actual changes to the API modules' output (e.g. actually returning
booleans for the new formatversion) beyond the use of
ApiResult::setContentValue() are left for a future change.
Bug: T76728
Bug: T57371
Bug: T33629
Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678f
2014-12-03 22:14:22 +00:00
|
|
|
$this->getResult()->addIndexedTagName(
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'query', $this->getModuleName() ],
|
2013-11-14 13:31:56 +00:00
|
|
|
'item'
|
|
|
|
|
);
|
2010-02-26 13:18:56 +00:00
|
|
|
} elseif ( $params['allrev'] ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$resultPageSet->populateFromRevisionIDs( $ids );
|
2006-10-14 16:02:42 +00:00
|
|
|
} else {
|
2010-01-11 15:55:52 +00:00
|
|
|
$resultPageSet->populateFromPageIDs( $ids );
|
2006-10-16 00:08:03 +00:00
|
|
|
}
|
2006-10-13 06:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
private function getFieldsToInclude() {
|
|
|
|
|
$includeFields = [];
|
|
|
|
|
if ( $this->fld_flags ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_FLAGS;
|
|
|
|
|
}
|
|
|
|
|
if ( $this->fld_user || $this->fld_userid ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_USER_ID;
|
|
|
|
|
}
|
|
|
|
|
if ( $this->fld_user ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_USER;
|
|
|
|
|
}
|
|
|
|
|
if ( $this->fld_comment || $this->fld_parsedcomment ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_COMMENT;
|
|
|
|
|
}
|
|
|
|
|
if ( $this->fld_patrol ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_PATROL_INFO;
|
2018-03-22 14:17:56 +00:00
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_AUTOPATROL_INFO;
|
2016-04-19 09:34:31 +00:00
|
|
|
}
|
|
|
|
|
if ( $this->fld_sizes ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_SIZES;
|
|
|
|
|
}
|
|
|
|
|
if ( $this->fld_loginfo ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_LOG_INFO;
|
|
|
|
|
}
|
2017-12-06 19:56:19 +00:00
|
|
|
if ( $this->fld_tags ) {
|
|
|
|
|
$includeFields[] = WatchedItemQueryService::INCLUDE_TAGS;
|
|
|
|
|
}
|
2016-04-19 09:34:31 +00:00
|
|
|
return $includeFields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function showParamsConflicting( array $show ) {
|
|
|
|
|
return ( isset( $show[WatchedItemQueryService::FILTER_MINOR] )
|
|
|
|
|
&& isset( $show[WatchedItemQueryService::FILTER_NOT_MINOR] ) )
|
|
|
|
|
|| ( isset( $show[WatchedItemQueryService::FILTER_BOT] )
|
|
|
|
|
&& isset( $show[WatchedItemQueryService::FILTER_NOT_BOT] ) )
|
|
|
|
|
|| ( isset( $show[WatchedItemQueryService::FILTER_ANON] )
|
|
|
|
|
&& isset( $show[WatchedItemQueryService::FILTER_NOT_ANON] ) )
|
|
|
|
|
|| ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
|
|
|
|
|
&& isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
|
2018-03-22 14:17:56 +00:00
|
|
|
|| ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
|
|
|
|
|
&& isset( $show[WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED] ) )
|
|
|
|
|
|| ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
|
|
|
|
|
&& isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
|
2016-04-19 09:34:31 +00:00
|
|
|
|| ( isset( $show[WatchedItemQueryService::FILTER_UNREAD] )
|
|
|
|
|
&& isset( $show[WatchedItemQueryService::FILTER_NOT_UNREAD] ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function extractOutputData( WatchedItem $watchedItem, array $recentChangeInfo ) {
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
/* Determine the title of the page that has been changed. */
|
2017-09-10 22:13:07 +00:00
|
|
|
$title = Title::newFromLinkTarget( $watchedItem->getLinkTarget() );
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
$user = $this->getUser();
|
|
|
|
|
|
|
|
|
|
/* Our output data. */
|
2016-02-17 09:09:32 +00:00
|
|
|
$vals = [];
|
2016-04-19 09:34:31 +00:00
|
|
|
$type = intval( $recentChangeInfo['rc_type'] );
|
2014-05-15 10:18:28 +00:00
|
|
|
$vals['type'] = RecentChange::parseFromRCType( $type );
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
$anyHidden = false;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
/* Create a new entry in the result for the title. */
|
|
|
|
|
if ( $this->fld_title || $this->fld_ids ) {
|
|
|
|
|
// These should already have been filtered out of the query, but just in case.
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $type === RC_LOG && ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$vals['actionhidden'] = true;
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
$anyHidden = true;
|
|
|
|
|
}
|
|
|
|
|
if ( $type !== RC_LOG ||
|
2016-04-19 09:34:31 +00:00
|
|
|
LogEventsList::userCanBitfield(
|
|
|
|
|
$recentChangeInfo['rc_deleted'],
|
|
|
|
|
LogPage::DELETED_ACTION,
|
|
|
|
|
$user
|
|
|
|
|
)
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
) {
|
|
|
|
|
if ( $this->fld_title ) {
|
|
|
|
|
ApiQueryBase::addTitleInfo( $vals, $title );
|
|
|
|
|
}
|
|
|
|
|
if ( $this->fld_ids ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['pageid'] = intval( $recentChangeInfo['rc_cur_id'] );
|
|
|
|
|
$vals['revid'] = intval( $recentChangeInfo['rc_this_oldid'] );
|
|
|
|
|
$vals['old_revid'] = intval( $recentChangeInfo['rc_last_oldid'] );
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2007-05-20 10:08:40 +00:00
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
/* Add user data and 'anon' flag, if user is anonymous. */
|
2010-08-28 01:09:21 +00:00
|
|
|
if ( $this->fld_user || $this->fld_userid ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_USER ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$vals['userhidden'] = true;
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
$anyHidden = true;
|
2010-08-28 01:09:21 +00:00
|
|
|
}
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( Revision::userCanBitfield(
|
|
|
|
|
$recentChangeInfo['rc_deleted'],
|
|
|
|
|
Revision::DELETED_USER,
|
|
|
|
|
$user
|
|
|
|
|
) ) {
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
if ( $this->fld_userid ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['userid'] = (int)$recentChangeInfo['rc_user'];
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
// for backwards compatibility
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['user'] = (int)$recentChangeInfo['rc_user'];
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
2010-08-28 01:09:21 +00:00
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
if ( $this->fld_user ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['user'] = $recentChangeInfo['rc_user_text'];
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
2013-02-16 18:30:57 +00:00
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( !$recentChangeInfo['rc_user'] ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$vals['anon'] = true;
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2007-05-20 10:08:40 +00:00
|
|
|
}
|
|
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
/* Add flags, such as new, minor, bot. */
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( $this->fld_flags ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['bot'] = (bool)$recentChangeInfo['rc_bot'];
|
|
|
|
|
$vals['new'] = $recentChangeInfo['rc_type'] == RC_NEW;
|
|
|
|
|
$vals['minor'] = (bool)$recentChangeInfo['rc_minor'];
|
2007-05-20 10:08:40 +00:00
|
|
|
}
|
|
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
/* Add sizes of each revision. (Only available on 1.10+) */
|
|
|
|
|
if ( $this->fld_sizes ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['oldlen'] = intval( $recentChangeInfo['rc_old_len'] );
|
|
|
|
|
$vals['newlen'] = intval( $recentChangeInfo['rc_new_len'] );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2007-05-20 10:08:40 +00:00
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
/* Add the timestamp. */
|
2010-02-26 13:18:56 +00:00
|
|
|
if ( $this->fld_timestamp ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $recentChangeInfo['rc_timestamp'] );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2007-05-20 10:08:40 +00:00
|
|
|
|
2010-02-26 13:18:56 +00:00
|
|
|
if ( $this->fld_notificationtimestamp ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['notificationtimestamp'] = ( $watchedItem->getNotificationTimestamp() == null )
|
2010-07-06 13:15:59 +00:00
|
|
|
? ''
|
2016-04-19 09:34:31 +00:00
|
|
|
: wfTimestamp( TS_ISO_8601, $watchedItem->getNotificationTimestamp() );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2007-07-08 12:31:28 +00:00
|
|
|
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
/* Add edit summary / log summary. */
|
|
|
|
|
if ( $this->fld_comment || $this->fld_parsedcomment ) {
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_COMMENT ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$vals['commenthidden'] = true;
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
$anyHidden = true;
|
|
|
|
|
}
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( Revision::userCanBitfield(
|
|
|
|
|
$recentChangeInfo['rc_deleted'],
|
|
|
|
|
Revision::DELETED_COMMENT,
|
|
|
|
|
$user
|
|
|
|
|
) ) {
|
2018-01-24 23:41:01 +00:00
|
|
|
$comment = $this->commentStore->getComment( 'rc_comment', $recentChangeInfo )->text;
|
2017-06-06 17:39:14 +00:00
|
|
|
if ( $this->fld_comment ) {
|
|
|
|
|
$vals['comment'] = $comment;
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
|
|
|
|
|
2017-06-06 17:39:14 +00:00
|
|
|
if ( $this->fld_parsedcomment ) {
|
|
|
|
|
$vals['parsedcomment'] = Linker::formatComment( $comment, $title );
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add the patrolled flag */
|
2015-01-16 19:00:07 +00:00
|
|
|
if ( $this->fld_patrol ) {
|
2018-03-22 14:17:56 +00:00
|
|
|
$vals['patrolled'] = $recentChangeInfo['rc_patrolled'] != 0;
|
2016-04-19 09:34:31 +00:00
|
|
|
$vals['unpatrolled'] = ChangesList::isUnpatrolled( (object)$recentChangeInfo, $user );
|
2018-03-22 14:17:56 +00:00
|
|
|
$vals['autopatrolled'] = $recentChangeInfo['rc_patrolled'] == 2;
|
2010-01-31 23:06:35 +00:00
|
|
|
}
|
2007-05-20 10:08:40 +00:00
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $this->fld_loginfo && $recentChangeInfo['rc_type'] == RC_LOG ) {
|
|
|
|
|
if ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$vals['actionhidden'] = true;
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
$anyHidden = true;
|
|
|
|
|
}
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( LogEventsList::userCanBitfield(
|
|
|
|
|
$recentChangeInfo['rc_deleted'],
|
|
|
|
|
LogPage::DELETED_ACTION,
|
|
|
|
|
$user
|
|
|
|
|
) ) {
|
|
|
|
|
$vals['logid'] = intval( $recentChangeInfo['rc_logid'] );
|
|
|
|
|
$vals['logtype'] = $recentChangeInfo['rc_log_type'];
|
|
|
|
|
$vals['logaction'] = $recentChangeInfo['rc_log_action'];
|
|
|
|
|
$vals['logparams'] = LogFormatter::newFromRow( $recentChangeInfo )->formatParametersForApi();
|
Improve API query RevDel handling
* ApiQueryDeletedrevs, ApiQueryFilearchive, ApiQueryRecentChanges, and
ApiQueryWatchlist will now return entires where fields have been
revision-deleted. "Hidden" indicators will be provided as appropriate.
* ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryRevisions,
ApiQueryContributions will now return field values in addition to the
"hidden" indicators when the requesting user has the necessary rights.
* Modules that return "hidden" indicators will now also return a
"suppressed" indicator.
* ApiQueryImageInfo will now return info for DELETED_FILE file revisions
if the requesting user has the 'deletedtext' right.
* ApiQueryLogEvents, when searching by user or title, will now return
entries where the user or action are revision-deleted if the
requesting user has the 'deletedhistory' right.
* ApiQueryContributions now uses the correct user rights rather than
'hideuser' to determine when to show contributions where the username
was revision-deleted.
* ApiQueryContributions will now indicate when the revision text is
hidden.
* Fix a bug in ApiQueryDeletedrevs found during testing where specifying
the "content" prop along with the "tags" prop or "drtag" parameter
would cause an SQL error.
* Fix various PHP warnings in ApiQueryFilearchive caused by the lack of
ArchivedFile::selectFields() fields.
* ApiQueryImageInfo::getInfo's $metadataOpts parameter has been renamed
$opts, and now may have an option to indicate the user to use for
RevDel visibility checks.
* ApiQueryWatchlist now properly uses the actual user's rights for
checking whether wlprop=patrol is allowed, rather than using the
wlowner's rights.
Bug: 27747
Bug: 27748
Bug: 28261
Bug: 34926
Bug: 48966
Change-Id: Idec2199976f460e1c73a26d0717e9fc4ab8042bb
2013-12-18 21:58:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-06 19:56:19 +00:00
|
|
|
if ( $this->fld_tags ) {
|
|
|
|
|
if ( $recentChangeInfo['rc_tags'] ) {
|
|
|
|
|
$tags = explode( ',', $recentChangeInfo['rc_tags'] );
|
|
|
|
|
ApiResult::setIndexedTagName( $tags, 'tag' );
|
|
|
|
|
$vals['tags'] = $tags;
|
|
|
|
|
} else {
|
|
|
|
|
$vals['tags'] = [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 09:34:31 +00:00
|
|
|
if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_RESTRICTED ) ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$vals['suppressed'] = true;
|
2011-05-20 21:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
2016-10-11 20:17:22 +00:00
|
|
|
Hooks::run( 'ApiQueryWatchlistExtractOutputData', [
|
|
|
|
|
$this, $watchedItem, $recentChangeInfo, &$vals
|
|
|
|
|
] );
|
|
|
|
|
|
2007-05-20 10:08:40 +00:00
|
|
|
return $vals;
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getAllowedParams() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
2006-10-13 06:13:13 +00:00
|
|
|
'allrev' => false,
|
2016-02-17 09:09:32 +00:00
|
|
|
'start' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'timestamp'
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'end' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'timestamp'
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'namespace' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_ISMULTI => true,
|
|
|
|
|
ApiBase::PARAM_TYPE => 'namespace'
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'user' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'user',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'excludeuser' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'user',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'dir' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_DFLT => 'older',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_TYPE => [
|
2006-10-13 06:13:13 +00:00
|
|
|
'newer',
|
|
|
|
|
'older'
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiHelp::PARAM_HELP_MSG => 'api-help-param-direction',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'limit' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_DFLT => 10,
|
|
|
|
|
ApiBase::PARAM_TYPE => 'limit',
|
|
|
|
|
ApiBase::PARAM_MIN => 1,
|
|
|
|
|
ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
|
|
|
|
|
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'prop' => [
|
2010-07-27 18:33:04 +00:00
|
|
|
ApiBase::PARAM_ISMULTI => true,
|
|
|
|
|
ApiBase::PARAM_DFLT => 'ids|title|flags',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
|
|
|
|
|
ApiBase::PARAM_TYPE => [
|
2007-05-21 04:34:48 +00:00
|
|
|
'ids',
|
|
|
|
|
'title',
|
2007-05-20 10:08:40 +00:00
|
|
|
'flags',
|
2006-10-16 05:53:07 +00:00
|
|
|
'user',
|
2010-08-28 01:09:21 +00:00
|
|
|
'userid',
|
2006-10-16 05:53:07 +00:00
|
|
|
'comment',
|
2010-01-31 23:06:35 +00:00
|
|
|
'parsedcomment',
|
2006-10-16 05:53:07 +00:00
|
|
|
'timestamp',
|
2007-07-08 12:31:28 +00:00
|
|
|
'patrol',
|
|
|
|
|
'sizes',
|
2011-05-20 21:47:38 +00:00
|
|
|
'notificationtimestamp',
|
|
|
|
|
'loginfo',
|
2017-12-06 19:56:19 +00:00
|
|
|
'tags',
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
'show' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_ISMULTI => true,
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_TYPE => [
|
2016-04-19 09:34:31 +00:00
|
|
|
WatchedItemQueryService::FILTER_MINOR,
|
|
|
|
|
WatchedItemQueryService::FILTER_NOT_MINOR,
|
|
|
|
|
WatchedItemQueryService::FILTER_BOT,
|
|
|
|
|
WatchedItemQueryService::FILTER_NOT_BOT,
|
|
|
|
|
WatchedItemQueryService::FILTER_ANON,
|
|
|
|
|
WatchedItemQueryService::FILTER_NOT_ANON,
|
|
|
|
|
WatchedItemQueryService::FILTER_PATROLLED,
|
|
|
|
|
WatchedItemQueryService::FILTER_NOT_PATROLLED,
|
2018-03-22 14:17:56 +00:00
|
|
|
WatchedItemQueryService::FILTER_AUTOPATROLLED,
|
|
|
|
|
WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED,
|
2016-04-19 09:34:31 +00:00
|
|
|
WatchedItemQueryService::FILTER_UNREAD,
|
|
|
|
|
WatchedItemQueryService::FILTER_NOT_UNREAD,
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
'type' => [
|
2015-08-24 17:40:06 +00:00
|
|
|
ApiBase::PARAM_DFLT => 'edit|new|log|categorize',
|
2013-04-30 16:01:00 +00:00
|
|
|
ApiBase::PARAM_ISMULTI => true,
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
|
2015-08-24 17:40:06 +00:00
|
|
|
ApiBase::PARAM_TYPE => RecentChange::getChangeTypes()
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'owner' => [
|
2010-02-26 13:18:56 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'user'
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'token' => [
|
2016-08-18 17:37:05 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'string',
|
|
|
|
|
ApiBase::PARAM_SENSITIVE => true,
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'continue' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
];
|
2006-10-13 06:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
2014-10-28 17:17:02 +00:00
|
|
|
protected function getExamplesMessages() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
2014-09-18 17:38:23 +00:00
|
|
|
'action=query&list=watchlist'
|
|
|
|
|
=> 'apihelp-query+watchlist-example-simple',
|
|
|
|
|
'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment'
|
|
|
|
|
=> 'apihelp-query+watchlist-example-props',
|
|
|
|
|
'action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment'
|
|
|
|
|
=> 'apihelp-query+watchlist-example-allrev',
|
|
|
|
|
'action=query&generator=watchlist&prop=info'
|
|
|
|
|
=> 'apihelp-query+watchlist-example-generator',
|
|
|
|
|
'action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user'
|
|
|
|
|
=> 'apihelp-query+watchlist-example-generator-rev',
|
|
|
|
|
'action=query&list=watchlist&wlowner=Example&wltoken=123ABC'
|
|
|
|
|
=> 'apihelp-query+watchlist-example-wlowner',
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2006-10-13 06:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
2011-07-17 17:02:06 +00:00
|
|
|
public function getHelpUrls() {
|
2017-04-04 22:52:57 +00:00
|
|
|
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist';
|
2011-07-17 17:02:06 +00:00
|
|
|
}
|
2009-06-19 08:03:52 +00:00
|
|
|
}
|