wiki.techinc.nl/includes/api/ApiQueryWatchlist.php

549 lines
17 KiB
PHP
Raw Normal View History

<?php
/**
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
use MediaWiki\MediaWikiServices;
use MediaWiki\ParamValidator\TypeDef\UserDef;
use MediaWiki\Revision\RevisionRecord;
/**
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.
*
* @ingroup API
*/
class ApiQueryWatchlist extends ApiQueryGeneratorBase {
/** @var CommentStore */
private $commentStore;
public function __construct( ApiQuery $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'wl' );
}
public function execute() {
$this->run();
}
public function executeGenerator( $resultPageSet ) {
$this->run( $resultPageSet );
}
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,
$fld_loginfo = false, $fld_tags;
2011-02-19 00:30:18 +00:00
/**
* @param ApiPageSet|null $resultPageSet
* @return void
2011-02-19 00:30:18 +00:00
*/
private function run( $resultPageSet = null ) {
$this->selectNamedDB( 'watchlist', DB_REPLICA, 'watchlist' );
$params = $this->extractRequestParams();
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 );
if ( $params['prop'] !== null && $resultPageSet === null ) {
$prop = array_flip( $params['prop'] );
$this->fld_ids = isset( $prop['ids'] );
$this->fld_title = isset( $prop['title'] );
$this->fld_flags = isset( $prop['flags'] );
$this->fld_user = isset( $prop['user'] );
$this->fld_userid = isset( $prop['userid'] );
$this->fld_comment = isset( $prop['comment'] );
$this->fld_parsedcomment = isset( $prop['parsedcomment'] );
$this->fld_timestamp = isset( $prop['timestamp'] );
$this->fld_sizes = isset( $prop['sizes'] );
$this->fld_patrol = isset( $prop['patrol'] );
$this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
$this->fld_loginfo = isset( $prop['loginfo'] );
$this->fld_tags = isset( $prop['tags'] );
if ( $this->fld_patrol && !$user->useRCPatrol() && !$user->useNPPatrol() ) {
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' );
}
if ( $this->fld_comment || $this->fld_parsedcomment ) {
$this->commentStore = CommentStore::getStore();
}
}
$options = [
'dir' => $params['dir'] === 'older'
? WatchedItemQueryService::DIR_OLDER
: WatchedItemQueryService::DIR_NEWER,
];
if ( $resultPageSet === null ) {
$options['includeFields'] = $this->getFieldsToInclude();
} else {
$options['usedInGenerator'] = true;
}
if ( $params['start'] ) {
$options['start'] = $params['start'];
}
if ( $params['end'] ) {
$options['end'] = $params['end'];
}
$startFrom = null;
if ( $params['continue'] !== null ) {
$cont = explode( '|', $params['continue'] );
$this->dieContinueUsageIf( count( $cont ) != 2 );
$continueTimestamp = $cont[0];
$continueId = (int)$cont[1];
$this->dieContinueUsageIf( $continueId != $cont[1] );
$startFrom = [ $continueTimestamp, $continueId ];
}
if ( $wlowner !== $user ) {
$options['watchlistOwner'] = $wlowner;
$options['watchlistOwnerToken'] = $params['token'];
}
if ( $params['namespace'] !== null ) {
$options['namespaceIds'] = $params['namespace'];
}
if ( $params['allrev'] ) {
$options['allRevisions'] = true;
}
if ( $params['show'] !== null ) {
$show = array_flip( $params['show'] );
/* Check for conflicting parameters. */
if ( $this->showParamsConflicting( $show ) ) {
$this->dieWithError( 'apierror-show' );
}
// Check permissions.
if ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
|| isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] )
) {
if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
}
}
$options['filters'] = array_keys( $show );
}
if ( $params['type'] !== null ) {
try {
$rcTypes = RecentChange::parseToRCType( $params['type'] );
if ( $rcTypes ) {
$options['rcTypes'] = $rcTypes;
}
} catch ( Exception $e ) {
ApiBase::dieDebug( __METHOD__, $e->getMessage() );
}
}
$this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
if ( $params['user'] !== null ) {
$options['onlyByUser'] = $params['user'];
}
if ( $params['excludeuser'] !== null ) {
$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
}
$options['limit'] = $params['limit'];
Hooks::run() call site migration Migrate all callers of Hooks::run() to use the new HookContainer/HookRunner system. General principles: * Use DI if it is already used. We're not changing the way state is managed in this patch. * HookContainer is always injected, not HookRunner. HookContainer is a service, it's a more generic interface, it is the only thing that provides isRegistered() which is needed in some cases, and a HookRunner can be efficiently constructed from it (confirmed by benchmark). Because HookContainer is needed for object construction, it is also needed by all factories. * "Ask your friendly local base class". Big hierarchies like SpecialPage and ApiBase have getHookContainer() and getHookRunner() methods in the base class, and classes that extend that base class are not expected to know or care where the base class gets its HookContainer from. * ProtectedHookAccessorTrait provides protected getHookContainer() and getHookRunner() methods, getting them from the global service container. The point of this is to ease migration to DI by ensuring that call sites ask their local friendly base class rather than getting a HookRunner from the service container directly. * Private $this->hookRunner. In some smaller classes where accessor methods did not seem warranted, there is a private HookRunner property which is accessed directly. Very rarely (two cases), there is a protected property, for consistency with code that conventionally assumes protected=private, but in cases where the class might actually be overridden, a protected accessor is preferred over a protected property. * The last resort: Hooks::runner(). Mostly for static, file-scope and global code. In a few cases it was used for objects with broken construction schemes, out of horror or laziness. Constructors with new required arguments: * AuthManager * BadFileLookup * BlockManager * ClassicInterwikiLookup * ContentHandlerFactory * ContentSecurityPolicy * DefaultOptionsManager * DerivedPageDataUpdater * FullSearchResultWidget * HtmlCacheUpdater * LanguageFactory * LanguageNameUtils * LinkRenderer * LinkRendererFactory * LocalisationCache * MagicWordFactory * MessageCache * NamespaceInfo * PageEditStash * PageHandlerFactory * PageUpdater * ParserFactory * PermissionManager * RevisionStore * RevisionStoreFactory * SearchEngineConfig * SearchEngineFactory * SearchFormWidget * SearchNearMatcher * SessionBackend * SpecialPageFactory * UserNameUtils * UserOptionsManager * WatchedItemQueryService * WatchedItemStore Constructors with new optional arguments: * DefaultPreferencesFactory * Language * LinkHolderArray * MovePage * Parser * ParserCache * PasswordReset * Router setHookContainer() now required after construction: * AuthenticationProvider * ResourceLoaderModule * SearchEngine Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
$this->getHookRunner()->onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions(
$this, $params, $options );
$ids = [];
$services = MediaWikiServices::getInstance();
$watchedItemQuery = $services->getWatchedItemQueryService();
$items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom );
// Get gender information
if ( $items !== [] && $resultPageSet === null && $this->fld_title &&
$services->getContentLanguage()->needsGenderDistinction()
) {
$nsInfo = $services->getNamespaceInfo();
$usernames = [];
foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
/** @var WatchedItem $watchedItem */
$linkTarget = $watchedItem->getLinkTarget();
if ( $nsInfo->hasGenderDistinction( $linkTarget->getNamespace() ) ) {
$usernames[] = $linkTarget->getText();
}
}
if ( $usernames !== [] ) {
$services->getGenderCache()->doQuery( $usernames, __METHOD__ );
}
}
foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
/** @var WatchedItem $watchedItem */
if ( $resultPageSet === null ) {
$vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );
$fit = $this->getResult()->addValue( [ 'query', $this->getModuleName() ], null, $vals );
if ( !$fit ) {
$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;
}
} elseif ( $params['allrev'] ) {
$ids[] = (int)$recentChangeInfo['rc_this_oldid'];
} else {
$ids[] = (int)$recentChangeInfo['rc_cur_id'];
}
}
if ( $startFrom !== null ) {
$this->setContinueEnumParameter( 'continue', implode( '|', $startFrom ) );
}
if ( $resultPageSet === null ) {
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(
[ 'query', $this->getModuleName() ],
'item'
);
} elseif ( $params['allrev'] ) {
$resultPageSet->populateFromRevisionIDs( $ids );
} else {
$resultPageSet->populateFromPageIDs( $ids );
}
}
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;
$includeFields[] = WatchedItemQueryService::INCLUDE_AUTOPATROL_INFO;
}
if ( $this->fld_sizes ) {
$includeFields[] = WatchedItemQueryService::INCLUDE_SIZES;
}
if ( $this->fld_loginfo ) {
$includeFields[] = WatchedItemQueryService::INCLUDE_LOG_INFO;
}
if ( $this->fld_tags ) {
$includeFields[] = WatchedItemQueryService::INCLUDE_TAGS;
}
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] ) )
|| ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
&& isset( $show[WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED] ) )
|| ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
&& isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
|| ( 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. */
$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. */
$vals = [];
$type = (int)$recentChangeInfo['rc_type'];
$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;
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.
if ( $type === RC_LOG && ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) ) {
$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 ||
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 ) {
$vals['pageid'] = (int)$recentChangeInfo['rc_cur_id'];
$vals['revid'] = (int)$recentChangeInfo['rc_this_oldid'];
$vals['old_revid'] = (int)$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
}
}
}
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. */
if ( $this->fld_user || $this->fld_userid ) {
if ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_USER ) {
$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;
}
if ( RevisionRecord::userCanBitfield(
$recentChangeInfo['rc_deleted'],
RevisionRecord::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 ) {
$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
$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
}
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 ) {
$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
}
if ( !$recentChangeInfo['rc_user'] ) {
$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
}
}
}
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. */
if ( $this->fld_flags ) {
$vals['bot'] = (bool)$recentChangeInfo['rc_bot'];
$vals['new'] = $recentChangeInfo['rc_type'] == RC_NEW;
$vals['minor'] = (bool)$recentChangeInfo['rc_minor'];
}
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 ) {
$vals['oldlen'] = (int)$recentChangeInfo['rc_old_len'];
$vals['newlen'] = (int)$recentChangeInfo['rc_new_len'];
}
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. */
if ( $this->fld_timestamp ) {
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $recentChangeInfo['rc_timestamp'] );
}
if ( $this->fld_notificationtimestamp ) {
$vals['notificationtimestamp'] = ( $watchedItem->getNotificationTimestamp() == null )
2010-07-06 13:15:59 +00:00
? ''
: wfTimestamp( TS_ISO_8601, $watchedItem->getNotificationTimestamp() );
}
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 ) {
if ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_COMMENT ) {
$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;
}
if ( RevisionRecord::userCanBitfield(
$recentChangeInfo['rc_deleted'],
RevisionRecord::DELETED_COMMENT,
$user
) ) {
$comment = $this->commentStore->getComment( 'rc_comment', $recentChangeInfo )->text;
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
}
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 */
if ( $this->fld_patrol ) {
$vals['patrolled'] = $recentChangeInfo['rc_patrolled'] != RecentChange::PRC_UNPATROLLED;
$vals['unpatrolled'] = ChangesList::isUnpatrolled( (object)$recentChangeInfo, $user );
$vals['autopatrolled'] = $recentChangeInfo['rc_patrolled'] == RecentChange::PRC_AUTOPATROLLED;
}
if ( $this->fld_loginfo && $recentChangeInfo['rc_type'] == RC_LOG ) {
if ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) {
$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 ( LogEventsList::userCanBitfield(
$recentChangeInfo['rc_deleted'],
LogPage::DELETED_ACTION,
$user
) ) {
$vals['logid'] = (int)$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
}
}
if ( $this->fld_tags ) {
if ( $recentChangeInfo['rc_tags'] ) {
$tags = explode( ',', $recentChangeInfo['rc_tags'] );
ApiResult::setIndexedTagName( $tags, 'tag' );
$vals['tags'] = $tags;
} else {
$vals['tags'] = [];
}
}
if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_RESTRICTED ) ) {
$vals['suppressed'] = true;
}
Hooks::run() call site migration Migrate all callers of Hooks::run() to use the new HookContainer/HookRunner system. General principles: * Use DI if it is already used. We're not changing the way state is managed in this patch. * HookContainer is always injected, not HookRunner. HookContainer is a service, it's a more generic interface, it is the only thing that provides isRegistered() which is needed in some cases, and a HookRunner can be efficiently constructed from it (confirmed by benchmark). Because HookContainer is needed for object construction, it is also needed by all factories. * "Ask your friendly local base class". Big hierarchies like SpecialPage and ApiBase have getHookContainer() and getHookRunner() methods in the base class, and classes that extend that base class are not expected to know or care where the base class gets its HookContainer from. * ProtectedHookAccessorTrait provides protected getHookContainer() and getHookRunner() methods, getting them from the global service container. The point of this is to ease migration to DI by ensuring that call sites ask their local friendly base class rather than getting a HookRunner from the service container directly. * Private $this->hookRunner. In some smaller classes where accessor methods did not seem warranted, there is a private HookRunner property which is accessed directly. Very rarely (two cases), there is a protected property, for consistency with code that conventionally assumes protected=private, but in cases where the class might actually be overridden, a protected accessor is preferred over a protected property. * The last resort: Hooks::runner(). Mostly for static, file-scope and global code. In a few cases it was used for objects with broken construction schemes, out of horror or laziness. Constructors with new required arguments: * AuthManager * BadFileLookup * BlockManager * ClassicInterwikiLookup * ContentHandlerFactory * ContentSecurityPolicy * DefaultOptionsManager * DerivedPageDataUpdater * FullSearchResultWidget * HtmlCacheUpdater * LanguageFactory * LanguageNameUtils * LinkRenderer * LinkRendererFactory * LocalisationCache * MagicWordFactory * MessageCache * NamespaceInfo * PageEditStash * PageHandlerFactory * PageUpdater * ParserFactory * PermissionManager * RevisionStore * RevisionStoreFactory * SearchEngineConfig * SearchEngineFactory * SearchFormWidget * SearchNearMatcher * SessionBackend * SpecialPageFactory * UserNameUtils * UserOptionsManager * WatchedItemQueryService * WatchedItemStore Constructors with new optional arguments: * DefaultPreferencesFactory * Language * LinkHolderArray * MovePage * Parser * ParserCache * PasswordReset * Router setHookContainer() now required after construction: * AuthenticationProvider * ResourceLoaderModule * SearchEngine Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
$this->getHookRunner()->onApiQueryWatchlistExtractOutputData(
$this, $watchedItem, $recentChangeInfo, $vals );
return $vals;
}
public function getAllowedParams() {
return [
'allrev' => false,
'start' => [
ApiBase::PARAM_TYPE => 'timestamp'
],
'end' => [
ApiBase::PARAM_TYPE => 'timestamp'
],
'namespace' => [
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => 'namespace'
],
'user' => [
ApiBase::PARAM_TYPE => 'user',
UserDef::PARAM_ALLOWED_USER_TYPES => [ 'name', 'ip', 'id', 'interwiki' ],
],
'excludeuser' => [
ApiBase::PARAM_TYPE => 'user',
UserDef::PARAM_ALLOWED_USER_TYPES => [ 'name', 'ip', 'id', 'interwiki' ],
],
'dir' => [
ApiBase::PARAM_DFLT => 'older',
ApiBase::PARAM_TYPE => [
'newer',
'older'
],
ApiHelp::PARAM_HELP_MSG => 'api-help-param-direction',
],
'limit' => [
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
],
'prop' => [
2010-07-27 18:33:04 +00:00
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_DFLT => 'ids|title|flags',
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
ApiBase::PARAM_TYPE => [
'ids',
'title',
'flags',
'user',
'userid',
'comment',
'parsedcomment',
'timestamp',
'patrol',
'sizes',
'notificationtimestamp',
'loginfo',
'tags',
]
],
'show' => [
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => [
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,
WatchedItemQueryService::FILTER_AUTOPATROLLED,
WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED,
WatchedItemQueryService::FILTER_UNREAD,
WatchedItemQueryService::FILTER_NOT_UNREAD,
]
],
'type' => [
Enable users to watch category membership changes #2 This is part of a chain that reverts: e412ff5ecc900991cce4f99b7a069f625a5694b3. NOTE: - The feature is disabled by default - User settings default to hiding changes - T109707 Touching a file on wikisource adds and removes it from a category... Even when page has no changes.... WTF? See linked issue, marked as stalled with a possible way forward for this patch. @see https://gerrit.wikimedia.org/r/#/c/235467/ Changes since version 1: - T109604 - Page names in comment are no longer url encoded / have _'s - T109638 & T110338 - Reserved username now used when we can't determine a username for the change (we could perhaps set the user and id to be blank in the RC table, but who knows what this might do) - T109688 - History links are now disabled in RC.... (could be fine for the introduction and worked on more in the future) - Categorization changes are now always patrolled - Touching on T109672 in this change emails will never be sent regarding categorization changes. (this can of course be changed in a followup) - Added $wgRCWatchCategoryMembership defaulting to true for enabling / disabling the feature - T109700 - for cases when no revision was retrieved for a category change set the bot flag to true. This means all changes caused by parser functions & Lua will be marked as bot, as will changes that cant find their revision due to slave lag.. Bug: T9148 Bug: T109604 Bug: T109638 Bug: T109688 Bug: T109700 Bug: T110338 Bug: T110340 Change-Id: I51c2c1254de862f24a26ef9dbbf027c6c83e9063
2015-08-24 17:40:06 +00:00
ApiBase::PARAM_DFLT => 'edit|new|log|categorize',
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
Enable users to watch category membership changes #2 This is part of a chain that reverts: e412ff5ecc900991cce4f99b7a069f625a5694b3. NOTE: - The feature is disabled by default - User settings default to hiding changes - T109707 Touching a file on wikisource adds and removes it from a category... Even when page has no changes.... WTF? See linked issue, marked as stalled with a possible way forward for this patch. @see https://gerrit.wikimedia.org/r/#/c/235467/ Changes since version 1: - T109604 - Page names in comment are no longer url encoded / have _'s - T109638 & T110338 - Reserved username now used when we can't determine a username for the change (we could perhaps set the user and id to be blank in the RC table, but who knows what this might do) - T109688 - History links are now disabled in RC.... (could be fine for the introduction and worked on more in the future) - Categorization changes are now always patrolled - Touching on T109672 in this change emails will never be sent regarding categorization changes. (this can of course be changed in a followup) - Added $wgRCWatchCategoryMembership defaulting to true for enabling / disabling the feature - T109700 - for cases when no revision was retrieved for a category change set the bot flag to true. This means all changes caused by parser functions & Lua will be marked as bot, as will changes that cant find their revision due to slave lag.. Bug: T9148 Bug: T109604 Bug: T109638 Bug: T109688 Bug: T109700 Bug: T110338 Bug: T110340 Change-Id: I51c2c1254de862f24a26ef9dbbf027c6c83e9063
2015-08-24 17:40:06 +00:00
ApiBase::PARAM_TYPE => RecentChange::getChangeTypes()
],
'owner' => [
ApiBase::PARAM_TYPE => 'user',
UserDef::PARAM_ALLOWED_USER_TYPES => [ 'name' ],
],
'token' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_SENSITIVE => true,
],
'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
],
];
}
protected function getExamplesMessages() {
return [
'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',
];
}
public function getHelpUrls() {
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist';
}
}