2006-09-26 05:43:02 +00:00
|
|
|
<?php
|
2010-02-24 14:45:19 +00:00
|
|
|
/**
|
2012-07-15 20:13:02 +00:00
|
|
|
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
|
2006-09-26 05:43:02 +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-09-26 05:43:02 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-07 19:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
2006-09-26 05:43:02 +00:00
|
|
|
*/
|
|
|
|
|
|
2018-02-16 18:23:45 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
2018-09-20 17:29:04 +00:00
|
|
|
use MediaWiki\Revision\RevisionRecord;
|
2018-09-04 19:17:29 +00:00
|
|
|
use MediaWiki\Storage\NameTableAccessException;
|
2018-02-16 18:23:45 +00:00
|
|
|
|
2007-04-20 08:55:14 +00:00
|
|
|
/**
|
2013-11-14 13:58:14 +00:00
|
|
|
* A query action to enumerate revisions of a given page, or show top revisions
|
|
|
|
|
* of multiple pages. Various pieces of information may be shown - flags,
|
|
|
|
|
* comments, and the actual wiki markup of the rev. In the enumeration mode,
|
|
|
|
|
* ranges of revisions may be requested and filtered.
|
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
|
|
|
*/
|
2014-09-29 17:47:08 +00:00
|
|
|
class ApiQueryRevisions extends ApiQueryRevisionsBase {
|
2006-09-26 05:43:02 +00:00
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
private $token = null;
|
2010-10-20 20:16:46 +00:00
|
|
|
|
2014-03-25 17:22:11 +00:00
|
|
|
public function __construct( ApiQuery $query, $moduleName ) {
|
2010-02-24 14:45:19 +00:00
|
|
|
parent::__construct( $query, $moduleName, 'rv' );
|
2006-09-26 05:43:02 +00:00
|
|
|
}
|
|
|
|
|
|
2010-10-20 18:50:33 +00:00
|
|
|
private $tokenFunctions;
|
|
|
|
|
|
2014-08-08 16:56:07 +00:00
|
|
|
/** @deprecated since 1.24 */
|
2008-07-04 12:07:02 +00:00
|
|
|
protected function getTokenFunctions() {
|
|
|
|
|
// tokenname => function
|
|
|
|
|
// function prototype is func($pageid, $title, $rev)
|
|
|
|
|
// should return token or false
|
|
|
|
|
|
|
|
|
|
// Don't call the hooks twice
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( isset( $this->tokenFunctions ) ) {
|
2008-07-04 12:07:02 +00:00
|
|
|
return $this->tokenFunctions;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2008-07-05 11:18:50 +00:00
|
|
|
|
2014-12-17 11:09:04 +00:00
|
|
|
// If we're in a mode that breaks the same-origin policy, no tokens can
|
|
|
|
|
// be obtained
|
|
|
|
|
if ( $this->lacksSameOriginSecurity() ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [];
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2008-07-05 11:18:50 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->tokenFunctions = [
|
2018-01-13 00:02:09 +00:00
|
|
|
'rollback' => [ self::class, 'getRollbackToken' ]
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
|
|
|
|
Hooks::run( 'APIQueryRevisionsTokens', [ &$this->tokenFunctions ] );
|
2013-11-14 13:00:02 +00:00
|
|
|
|
2008-07-04 12:07:02 +00:00
|
|
|
return $this->tokenFunctions;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-19 00:30:18 +00:00
|
|
|
/**
|
2014-08-08 16:56:07 +00:00
|
|
|
* @deprecated since 1.24
|
2014-04-15 18:12:09 +00:00
|
|
|
* @param int $pageid
|
|
|
|
|
* @param Title $title
|
|
|
|
|
* @param Revision $rev
|
|
|
|
|
* @return bool|string
|
2011-02-19 00:30:18 +00:00
|
|
|
*/
|
2010-02-24 14:45:19 +00:00
|
|
|
public static function getRollbackToken( $pageid, $title, $rev ) {
|
2008-07-04 12:07:02 +00:00
|
|
|
global $wgUser;
|
2019-08-16 18:13:56 +00:00
|
|
|
if ( !MediaWikiServices::getInstance()->getPermissionManager()
|
|
|
|
|
->userHasRight( $wgUser, 'rollback' ) ) {
|
2008-07-04 12:07:02 +00:00
|
|
|
return false;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2013-11-14 13:00:02 +00:00
|
|
|
|
2016-05-30 16:15:09 +00:00
|
|
|
return $wgUser->getEditToken( 'rollback' );
|
2008-07-04 12:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
protected function run( ApiPageSet $resultPageSet = null ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$params = $this->extractRequestParams( false );
|
2018-02-16 18:23:45 +00:00
|
|
|
$revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
|
2006-09-26 05:43:02 +00:00
|
|
|
|
2006-10-01 02:02:13 +00:00
|
|
|
// If any of those parameters are used, work in 'enumeration' mode.
|
2006-09-30 08:06:27 +00:00
|
|
|
// Enum mode can only be used when exactly one page is provided.
|
2008-04-14 07:45:50 +00:00
|
|
|
// Enumerating revisions on multiple pages make it extremely
|
|
|
|
|
// difficult to manage continuations and require additional SQL indexes
|
2015-02-03 16:53:27 +00:00
|
|
|
$enumRevMode = ( $params['user'] !== null || $params['excludeuser'] !== null ||
|
|
|
|
|
$params['limit'] !== null || $params['startid'] !== null ||
|
|
|
|
|
$params['endid'] !== null || $params['dir'] === 'newer' ||
|
|
|
|
|
$params['start'] !== null || $params['end'] !== null );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2006-10-01 20:17:16 +00:00
|
|
|
$pageSet = $this->getPageSet();
|
|
|
|
|
$pageCount = $pageSet->getGoodTitleCount();
|
|
|
|
|
$revCount = $pageSet->getRevisionCount();
|
2006-09-29 07:29:13 +00:00
|
|
|
|
2006-10-01 02:02:13 +00:00
|
|
|
// Optimization -- nothing to do
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $revCount === 0 && $pageCount === 0 ) {
|
2014-09-29 17:47:08 +00:00
|
|
|
// Nothing to do
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ( $revCount > 0 && count( $pageSet->getLiveRevisionIDs() ) === 0 ) {
|
|
|
|
|
// We're in revisions mode but all given revisions are deleted
|
2006-10-01 02:02:13 +00:00
|
|
|
return;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2006-10-01 02:02:13 +00:00
|
|
|
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $revCount > 0 && $enumRevMode ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->dieWithError(
|
2019-05-22 19:07:43 +00:00
|
|
|
[ 'apierror-revisions-norevids', $this->getModulePrefix() ], 'invalidparammix'
|
2013-11-14 13:58:14 +00:00
|
|
|
);
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2006-09-30 08:06:27 +00:00
|
|
|
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $pageCount > 1 && $enumRevMode ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->dieWithError(
|
|
|
|
|
[ 'apierror-revisions-singlepage', $this->getModulePrefix() ], 'invalidparammix'
|
2013-11-14 13:58:14 +00:00
|
|
|
);
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2006-09-27 05:13:48 +00:00
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
// In non-enum mode, rvlimit can't be directly used. Use the maximum
|
|
|
|
|
// allowed value.
|
|
|
|
|
if ( !$enumRevMode ) {
|
|
|
|
|
$this->setParsedLimit = false;
|
|
|
|
|
$params['limit'] = 'max';
|
2009-02-28 13:25:21 +00:00
|
|
|
}
|
|
|
|
|
|
2009-06-13 06:31:38 +00:00
|
|
|
$db = $this->getDB();
|
2010-10-23 16:41:20 +00:00
|
|
|
|
2018-09-19 20:25:45 +00:00
|
|
|
$idField = 'rev_id';
|
|
|
|
|
$tsField = 'rev_timestamp';
|
|
|
|
|
$pageField = 'rev_page';
|
2019-07-23 17:40:52 +00:00
|
|
|
if ( $params['user'] !== null ) {
|
2018-09-19 20:25:45 +00:00
|
|
|
// We're going to want to use the page_actor_timestamp index (on revision_actor_temp)
|
|
|
|
|
// so use that table's denormalized fields.
|
|
|
|
|
$idField = 'revactor_rev';
|
|
|
|
|
$tsField = 'revactor_timestamp';
|
|
|
|
|
$pageField = 'revactor_page';
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
if ( $resultPageSet === null ) {
|
|
|
|
|
$this->parseParameters( $params );
|
|
|
|
|
$this->token = $params['token'];
|
2019-10-10 18:32:39 +00:00
|
|
|
$opts = [ 'page' ];
|
2017-10-06 17:03:55 +00:00
|
|
|
if ( $this->fld_user ) {
|
|
|
|
|
$opts[] = 'user';
|
|
|
|
|
}
|
2018-02-16 18:23:45 +00:00
|
|
|
$revQuery = $revisionStore->getQueryInfo( $opts );
|
2018-09-19 20:25:45 +00:00
|
|
|
|
|
|
|
|
if ( $idField !== 'rev_id' ) {
|
|
|
|
|
$aliasFields = [ 'rev_id' => $idField, 'rev_timestamp' => $tsField, 'rev_page' => $pageField ];
|
|
|
|
|
$revQuery['fields'] = array_merge(
|
|
|
|
|
$aliasFields,
|
|
|
|
|
array_diff( $revQuery['fields'], array_keys( $aliasFields ) )
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-06 17:03:55 +00:00
|
|
|
$this->addTables( $revQuery['tables'] );
|
|
|
|
|
$this->addFields( $revQuery['fields'] );
|
|
|
|
|
$this->addJoinConds( $revQuery['joins'] );
|
2014-09-29 17:47:08 +00:00
|
|
|
} else {
|
|
|
|
|
$this->limit = $this->getParameter( 'limit' ) ?: 10;
|
2017-10-06 17:03:55 +00:00
|
|
|
// Always join 'page' so orphaned revisions are filtered out
|
|
|
|
|
$this->addTables( [ 'revision', 'page' ] );
|
|
|
|
|
$this->addJoinConds(
|
2019-03-06 17:17:27 +00:00
|
|
|
[ 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ] ]
|
2017-10-06 17:03:55 +00:00
|
|
|
);
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addFields( [
|
|
|
|
|
'rev_id' => $idField, 'rev_timestamp' => $tsField, 'rev_page' => $pageField
|
|
|
|
|
] );
|
2007-05-21 06:32:32 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
if ( $this->fld_tags ) {
|
2018-11-27 17:12:06 +00:00
|
|
|
$this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'revision' ) ] );
|
2009-11-01 10:42:41 +00:00
|
|
|
}
|
2010-02-24 14:45:19 +00:00
|
|
|
|
2015-02-03 16:53:27 +00:00
|
|
|
if ( $params['tag'] !== null ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addTables( 'change_tag' );
|
2013-11-14 13:58:14 +00:00
|
|
|
$this->addJoinConds(
|
2019-03-06 17:17:27 +00:00
|
|
|
[ 'change_tag' => [ 'JOIN', [ 'rev_id=ct_rev_id' ] ] ]
|
2013-11-14 13:58:14 +00:00
|
|
|
);
|
2018-11-14 22:04:29 +00:00
|
|
|
$changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
|
|
|
|
|
try {
|
|
|
|
|
$this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) );
|
|
|
|
|
} catch ( NameTableAccessException $exception ) {
|
|
|
|
|
// Return nothing.
|
|
|
|
|
$this->addWhere( '1=0' );
|
2018-09-04 19:17:29 +00:00
|
|
|
}
|
2009-11-01 10:42:41 +00:00
|
|
|
}
|
2007-07-14 19:04:31 +00:00
|
|
|
|
2017-10-06 17:03:55 +00:00
|
|
|
if ( $resultPageSet === null && $this->fetchContent ) {
|
2007-07-14 19:04:31 +00:00
|
|
|
// For each page we will request, the user must have read rights for that page
|
2016-10-19 16:54:25 +00:00
|
|
|
$status = Status::newGood();
|
2019-05-18 16:58:24 +00:00
|
|
|
$user = $this->getUser();
|
|
|
|
|
|
2017-09-04 18:05:26 +00:00
|
|
|
/** @var Title $title */
|
2010-01-11 15:55:52 +00:00
|
|
|
foreach ( $pageSet->getGoodTitles() as $title ) {
|
2019-05-18 16:58:24 +00:00
|
|
|
if ( !$this->getPermissionManager()->userCan( 'read', $user, $title ) ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$status->fatal( ApiMessage::create(
|
|
|
|
|
[ 'apierror-cannotviewtitle', wfEscapeWikiText( $title->getPrefixedText() ) ],
|
|
|
|
|
'accessdenied'
|
|
|
|
|
) );
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2007-07-14 19:04:31 +00:00
|
|
|
}
|
2016-10-19 16:54:25 +00:00
|
|
|
if ( !$status->isGood() ) {
|
|
|
|
|
$this->dieStatus( $status );
|
|
|
|
|
}
|
2012-05-16 14:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( $enumRevMode ) {
|
2015-02-03 16:53:27 +00:00
|
|
|
// Indexes targeted:
|
|
|
|
|
// page_timestamp if we don't have rvuser
|
2018-09-19 20:25:45 +00:00
|
|
|
// page_actor_timestamp (on revision_actor_temp) if we have rvuser in READ_NEW mode
|
2015-02-03 16:53:27 +00:00
|
|
|
// page_user_timestamp if we have a logged-in rvuser
|
|
|
|
|
// page_timestamp or usertext_timestamp if we have an IP rvuser
|
|
|
|
|
|
2007-11-27 16:41:13 +00:00
|
|
|
// This is mostly to prevent parameter errors (and optimize SQL?)
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->requireMaxOneParameter( $params, 'startid', 'start' );
|
|
|
|
|
$this->requireMaxOneParameter( $params, 'endid', 'end' );
|
|
|
|
|
$this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2015-02-03 16:53:27 +00:00
|
|
|
if ( $params['continue'] !== null ) {
|
|
|
|
|
$cont = explode( '|', $params['continue'] );
|
|
|
|
|
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
|
|
|
|
$op = ( $params['dir'] === 'newer' ? '>' : '<' );
|
|
|
|
|
$continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
|
|
|
|
|
$continueId = (int)$cont[1];
|
|
|
|
|
$this->dieContinueUsageIf( $continueId != $cont[1] );
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addWhere( "$tsField $op $continueTimestamp OR " .
|
|
|
|
|
"($tsField = $continueTimestamp AND " .
|
|
|
|
|
"$idField $op= $continueId)"
|
2015-02-03 16:53:27 +00:00
|
|
|
);
|
2012-08-20 14:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
2017-04-21 15:00:14 +00:00
|
|
|
// Convert startid/endid to timestamps (T163532)
|
2017-05-11 22:18:44 +00:00
|
|
|
$revids = [];
|
|
|
|
|
if ( $params['startid'] !== null ) {
|
|
|
|
|
$revids[] = (int)$params['startid'];
|
|
|
|
|
}
|
|
|
|
|
if ( $params['endid'] !== null ) {
|
|
|
|
|
$revids[] = (int)$params['endid'];
|
|
|
|
|
}
|
|
|
|
|
if ( $revids ) {
|
2017-04-21 15:00:14 +00:00
|
|
|
$db = $this->getDB();
|
|
|
|
|
$sql = $db->unionQueries( [
|
|
|
|
|
$db->selectSQLText(
|
|
|
|
|
'revision',
|
|
|
|
|
[ 'id' => 'rev_id', 'ts' => 'rev_timestamp' ],
|
2017-05-11 22:18:44 +00:00
|
|
|
[ 'rev_id' => $revids ],
|
2017-04-21 15:00:14 +00:00
|
|
|
__METHOD__
|
|
|
|
|
),
|
|
|
|
|
$db->selectSQLText(
|
|
|
|
|
'archive',
|
|
|
|
|
[ 'id' => 'ar_rev_id', 'ts' => 'ar_timestamp' ],
|
2017-05-11 22:18:44 +00:00
|
|
|
[ 'ar_rev_id' => $revids ],
|
2017-04-21 15:00:14 +00:00
|
|
|
__METHOD__
|
|
|
|
|
),
|
2019-03-28 17:58:42 +00:00
|
|
|
], $db::UNION_DISTINCT );
|
2017-04-21 15:00:14 +00:00
|
|
|
$res = $db->query( $sql, __METHOD__ );
|
|
|
|
|
foreach ( $res as $row ) {
|
|
|
|
|
if ( (int)$row->id === (int)$params['startid'] ) {
|
|
|
|
|
$params['start'] = $row->ts;
|
|
|
|
|
}
|
|
|
|
|
if ( (int)$row->id === (int)$params['endid'] ) {
|
|
|
|
|
$params['end'] = $row->ts;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( $params['startid'] !== null && $params['start'] === null ) {
|
|
|
|
|
$p = $this->encodeParamName( 'startid' );
|
|
|
|
|
$this->dieWithError( [ 'apierror-revisions-badid', $p ], "badid_$p" );
|
|
|
|
|
}
|
|
|
|
|
if ( $params['endid'] !== null && $params['end'] === null ) {
|
|
|
|
|
$p = $this->encodeParamName( 'endid' );
|
|
|
|
|
$this->dieWithError( [ 'apierror-revisions-badid', $p ], "badid_$p" );
|
|
|
|
|
}
|
2017-05-08 18:18:03 +00:00
|
|
|
|
|
|
|
|
if ( $params['start'] !== null ) {
|
|
|
|
|
$op = ( $params['dir'] === 'newer' ? '>' : '<' );
|
|
|
|
|
$ts = $db->addQuotes( $db->timestampOrNull( $params['start'] ) );
|
|
|
|
|
if ( $params['startid'] !== null ) {
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addWhere( "$tsField $op $ts OR "
|
2019-02-25 00:38:33 +00:00
|
|
|
. "$tsField = $ts AND $idField $op= " . (int)$params['startid'] );
|
2017-05-08 18:18:03 +00:00
|
|
|
} else {
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addWhere( "$tsField $op= $ts" );
|
2017-05-08 18:18:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( $params['end'] !== null ) {
|
|
|
|
|
$op = ( $params['dir'] === 'newer' ? '<' : '>' ); // Yes, opposite of the above
|
|
|
|
|
$ts = $db->addQuotes( $db->timestampOrNull( $params['end'] ) );
|
|
|
|
|
if ( $params['endid'] !== null ) {
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addWhere( "$tsField $op $ts OR "
|
2019-02-25 00:38:33 +00:00
|
|
|
. "$tsField = $ts AND $idField $op= " . (int)$params['endid'] );
|
2017-05-08 18:18:03 +00:00
|
|
|
} else {
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addWhere( "$tsField $op= $ts" );
|
2017-05-08 18:18:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addTimestampWhereRange( $tsField, $params['dir'],
|
2017-05-08 18:18:03 +00:00
|
|
|
$params['start'], $params['end'] );
|
2017-04-21 15:00:14 +00:00
|
|
|
}
|
|
|
|
|
|
2017-05-08 18:18:03 +00:00
|
|
|
$sort = ( $params['dir'] === 'newer' ? '' : 'DESC' );
|
|
|
|
|
$this->addOption( 'ORDER BY', [ "rev_timestamp $sort", "rev_id $sort" ] );
|
2015-02-03 16:53:27 +00:00
|
|
|
|
2006-09-30 08:06:27 +00:00
|
|
|
// There is only one ID, use it
|
2010-01-11 15:55:52 +00:00
|
|
|
$ids = array_keys( $pageSet->getGoodTitles() );
|
2018-09-19 20:25:45 +00:00
|
|
|
$this->addWhereFld( $pageField, reset( $ids ) );
|
2010-01-11 15:55:52 +00:00
|
|
|
|
2015-02-03 16:53:27 +00:00
|
|
|
if ( $params['user'] !== null ) {
|
2017-09-12 17:12:29 +00:00
|
|
|
$actorQuery = ActorMigration::newMigration()
|
|
|
|
|
->getWhere( $db, 'rev_user', User::newFromName( $params['user'], false ) );
|
|
|
|
|
$this->addTables( $actorQuery['tables'] );
|
|
|
|
|
$this->addJoinConds( $actorQuery['joins'] );
|
|
|
|
|
$this->addWhere( $actorQuery['conds'] );
|
2015-02-03 16:53:27 +00:00
|
|
|
} elseif ( $params['excludeuser'] !== null ) {
|
2017-09-12 17:12:29 +00:00
|
|
|
$actorQuery = ActorMigration::newMigration()
|
|
|
|
|
->getWhere( $db, 'rev_user', User::newFromName( $params['excludeuser'], false ) );
|
|
|
|
|
$this->addTables( $actorQuery['tables'] );
|
|
|
|
|
$this->addJoinConds( $actorQuery['joins'] );
|
|
|
|
|
$this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' );
|
2007-05-19 04:13:48 +00:00
|
|
|
}
|
2015-02-03 16:53:27 +00:00
|
|
|
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
|
2017-02-20 22:28:10 +00:00
|
|
|
// Paranoia: avoid brute force searches (T19342)
|
2019-08-16 18:13:56 +00:00
|
|
|
if ( !$this->getPermissionManager()->userHasRight( $this->getUser(), 'deletedhistory' ) ) {
|
2018-02-16 18:23:45 +00:00
|
|
|
$bitmask = RevisionRecord::DELETED_USER;
|
2019-08-21 22:42:08 +00:00
|
|
|
} elseif ( !$this->getPermissionManager()
|
|
|
|
|
->userHasAnyRight( $this->getUser(), 'suppressrevision', 'viewsuppressed' )
|
|
|
|
|
) {
|
2018-02-16 18:23:45 +00:00
|
|
|
$bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
|
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
|
|
|
} else {
|
|
|
|
|
$bitmask = 0;
|
|
|
|
|
}
|
|
|
|
|
if ( $bitmask ) {
|
|
|
|
|
$this->addWhere( $db->bitAnd( 'rev_deleted', $bitmask ) . " != $bitmask" );
|
|
|
|
|
}
|
2009-02-05 11:44:10 +00:00
|
|
|
}
|
2010-02-24 14:45:19 +00:00
|
|
|
} elseif ( $revCount > 0 ) {
|
2015-02-03 16:53:27 +00:00
|
|
|
// Always targets the PRIMARY index
|
|
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
$revs = $pageSet->getLiveRevisionIDs();
|
2007-05-19 01:46:13 +00:00
|
|
|
|
|
|
|
|
// Get all revision IDs
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhereFld( 'rev_id', array_keys( $revs ) );
|
2007-05-19 01:46:13 +00:00
|
|
|
|
2015-02-03 16:53:27 +00:00
|
|
|
if ( $params['continue'] !== null ) {
|
2019-02-25 00:38:33 +00:00
|
|
|
$this->addWhere( 'rev_id >= ' . (int)$params['continue'] );
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addOption( 'ORDER BY', 'rev_id' );
|
2010-02-24 14:45:19 +00:00
|
|
|
} elseif ( $pageCount > 0 ) {
|
2015-02-03 16:53:27 +00:00
|
|
|
// Always targets the rev_page_id index
|
|
|
|
|
|
2008-10-24 13:05:44 +00:00
|
|
|
$titles = $pageSet->getGoodTitles();
|
2010-02-24 14:45:19 +00:00
|
|
|
|
2006-10-01 20:17:16 +00:00
|
|
|
// When working in multi-page non-enumeration mode,
|
|
|
|
|
// limit to the latest revision only
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhere( 'page_latest=rev_id' );
|
2010-02-24 14:45:19 +00:00
|
|
|
|
2006-10-01 20:17:16 +00:00
|
|
|
// Get all page IDs
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhereFld( 'page_id', array_keys( $titles ) );
|
2009-03-20 20:21:38 +00:00
|
|
|
// Every time someone relies on equality propagation, god kills a kitten :)
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhereFld( 'rev_page', array_keys( $titles ) );
|
2010-02-24 14:45:19 +00:00
|
|
|
|
2015-02-03 16:53:27 +00:00
|
|
|
if ( $params['continue'] !== null ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$cont = explode( '|', $params['continue'] );
|
2013-01-15 02:19:16 +00:00
|
|
|
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
2019-02-25 00:38:33 +00:00
|
|
|
$pageid = (int)$cont[0];
|
|
|
|
|
$revid = (int)$cont[1];
|
2010-02-24 14:45:19 +00:00
|
|
|
$this->addWhere(
|
2012-05-16 17:22:36 +00:00
|
|
|
"rev_page > $pageid OR " .
|
|
|
|
|
"(rev_page = $pageid AND " .
|
|
|
|
|
"rev_id >= $revid)"
|
2010-02-24 14:45:19 +00:00
|
|
|
);
|
2009-02-10 12:32:22 +00:00
|
|
|
}
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addOption( 'ORDER BY', [
|
2012-05-05 13:29:08 +00:00
|
|
|
'rev_page',
|
|
|
|
|
'rev_id'
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
2010-02-24 14:45:19 +00:00
|
|
|
} else {
|
|
|
|
|
ApiBase::dieDebug( __METHOD__, 'param validation?' );
|
|
|
|
|
}
|
2006-09-30 08:06:27 +00:00
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
$this->addOption( 'LIMIT', $this->limit + 1 );
|
2006-09-27 05:13:48 +00:00
|
|
|
|
2019-05-23 16:58:19 +00:00
|
|
|
// T224017: `rev_timestamp` is never the correct index to use for this module, but
|
|
|
|
|
// MariaDB (10.1.37-39) sometimes insists on trying to use it anyway. Tell it not to.
|
|
|
|
|
$this->addOption( 'IGNORE INDEX', [ 'revision' => 'rev_timestamp' ] );
|
|
|
|
|
|
2006-09-27 05:13:48 +00:00
|
|
|
$count = 0;
|
2016-02-17 09:09:32 +00:00
|
|
|
$generated = [];
|
2016-09-14 18:22:35 +00:00
|
|
|
$hookData = [];
|
|
|
|
|
$res = $this->select( __METHOD__, [], $hookData );
|
2006-10-25 03:54:56 +00:00
|
|
|
|
2010-06-20 18:48:34 +00:00
|
|
|
foreach ( $res as $row ) {
|
2014-09-29 17:47:08 +00:00
|
|
|
if ( ++$count > $this->limit ) {
|
2013-11-14 13:58:14 +00:00
|
|
|
// We've reached the one extra which shows that there are
|
|
|
|
|
// additional pages to be had. Stop here...
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $enumRevMode ) {
|
2015-02-03 16:53:27 +00:00
|
|
|
$this->setContinueEnumParameter( 'continue',
|
2019-02-25 00:38:33 +00:00
|
|
|
$row->rev_timestamp . '|' . (int)$row->rev_id );
|
2010-02-24 14:45:19 +00:00
|
|
|
} elseif ( $revCount > 0 ) {
|
2019-02-25 00:38:33 +00:00
|
|
|
$this->setContinueEnumParameter( 'continue', (int)$row->rev_id );
|
2010-02-24 14:45:19 +00:00
|
|
|
} else {
|
2019-02-25 00:38:33 +00:00
|
|
|
$this->setContinueEnumParameter( 'continue', (int)$row->rev_page .
|
|
|
|
|
'|' . (int)$row->rev_id );
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
* 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-01 02:02:13 +00:00
|
|
|
}
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
if ( $resultPageSet !== null ) {
|
|
|
|
|
$generated[] = $row->rev_id;
|
2009-11-01 10:42:41 +00:00
|
|
|
} else {
|
2019-10-10 18:32:39 +00:00
|
|
|
$revision = $revisionStore->newRevisionFromRow( $row, 0, Title::newFromRow( $row ) );
|
2014-09-29 17:47:08 +00:00
|
|
|
$rev = $this->extractRevisionInfo( $revision, $row );
|
|
|
|
|
|
|
|
|
|
if ( $this->token !== null ) {
|
2018-02-16 18:23:45 +00:00
|
|
|
$title = Title::newFromLinkTarget( $revision->getPageAsLinkTarget() );
|
|
|
|
|
$revisionCompat = new Revision( $revision );
|
2014-09-29 17:47:08 +00:00
|
|
|
$tokenFunctions = $this->getTokenFunctions();
|
|
|
|
|
foreach ( $this->token as $t ) {
|
2018-02-16 18:23:45 +00:00
|
|
|
$val = call_user_func( $tokenFunctions[$t], $title->getArticleID(), $title, $revisionCompat );
|
2014-09-29 17:47:08 +00:00
|
|
|
if ( $val === false ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->addWarning( [ 'apiwarn-tokennotallowed', $t ] );
|
2014-09-29 17:47:08 +00:00
|
|
|
} else {
|
|
|
|
|
$rev[$t . 'token'] = $val;
|
|
|
|
|
}
|
2012-06-13 09:58:05 +00:00
|
|
|
}
|
2008-11-21 13:55:27 +00:00
|
|
|
}
|
2012-06-13 09:58:05 +00:00
|
|
|
|
2016-09-14 18:22:35 +00:00
|
|
|
$fit = $this->processRow( $row, $rev, $hookData ) &&
|
|
|
|
|
$this->addPageSubItem( $row->rev_page, $rev, 'rev' );
|
2014-09-29 17:47:08 +00:00
|
|
|
if ( !$fit ) {
|
|
|
|
|
if ( $enumRevMode ) {
|
2015-02-03 16:53:27 +00:00
|
|
|
$this->setContinueEnumParameter( 'continue',
|
2019-02-25 00:38:33 +00:00
|
|
|
$row->rev_timestamp . '|' . (int)$row->rev_id );
|
2014-09-29 17:47:08 +00:00
|
|
|
} elseif ( $revCount > 0 ) {
|
2019-02-25 00:38:33 +00:00
|
|
|
$this->setContinueEnumParameter( 'continue', (int)$row->rev_id );
|
2014-09-29 17:47:08 +00:00
|
|
|
} else {
|
2019-02-25 00:38:33 +00:00
|
|
|
$this->setContinueEnumParameter( 'continue', (int)$row->rev_page .
|
|
|
|
|
'|' . (int)$row->rev_id );
|
2012-06-13 09:58:05 +00:00
|
|
|
}
|
2014-09-29 17:47:08 +00:00
|
|
|
break;
|
2009-12-09 18:34:32 +00:00
|
|
|
}
|
2009-02-28 13:25:21 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-11-14 13:00:02 +00:00
|
|
|
|
2014-09-29 17:47:08 +00:00
|
|
|
if ( $resultPageSet !== null ) {
|
|
|
|
|
$resultPageSet->populateFromRevisionIDs( $generated );
|
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
|
|
|
}
|
2007-05-20 08:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
2010-07-23 07:17:56 +00:00
|
|
|
public function getCacheMode( $params ) {
|
|
|
|
|
if ( isset( $params['token'] ) ) {
|
|
|
|
|
return 'private';
|
|
|
|
|
}
|
2014-09-29 17:47:08 +00:00
|
|
|
return parent::getCacheMode( $params );
|
2010-07-23 07:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getAllowedParams() {
|
2016-02-17 09:09:32 +00:00
|
|
|
$ret = parent::getAllowedParams() + [
|
|
|
|
|
'startid' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'integer',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'endid' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'integer',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'start' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'timestamp',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'end' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'timestamp',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'dir' => [
|
2010-02-24 14:45:19 +00:00
|
|
|
ApiBase::PARAM_DFLT => 'older',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_TYPE => [
|
2006-09-26 05:43:02 +00:00
|
|
|
'newer',
|
|
|
|
|
'older'
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2014-09-29 17:47:08 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'user' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'user',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'excludeuser' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_TYPE => 'user',
|
2016-02-17 09:09:32 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
|
|
|
|
|
],
|
2009-11-02 08:29:26 +00:00
|
|
|
'tag' => null,
|
2016-02-17 09:09:32 +00:00
|
|
|
'token' => [
|
2014-08-08 16:56:07 +00:00
|
|
|
ApiBase::PARAM_DEPRECATED => true,
|
2010-02-24 14:45:19 +00:00
|
|
|
ApiBase::PARAM_TYPE => array_keys( $this->getTokenFunctions() ),
|
|
|
|
|
ApiBase::PARAM_ISMULTI => 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
|
|
|
],
|
|
|
|
|
];
|
2014-09-29 17:47:08 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$ret['limit'][ApiBase::PARAM_HELP_MSG_INFO] = [ [ 'singlepageonly' ] ];
|
2014-09-29 17:47:08 +00:00
|
|
|
|
|
|
|
|
return $ret;
|
2006-09-26 05:43:02 +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&prop=revisions&titles=API|Main%20Page&' .
|
2018-08-27 17:17:55 +00:00
|
|
|
'rvslots=*&rvprop=timestamp|user|comment|content'
|
2014-09-18 17:38:23 +00:00
|
|
|
=> 'apihelp-query+revisions-example-content',
|
|
|
|
|
'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
|
|
|
|
|
'rvprop=timestamp|user|comment'
|
|
|
|
|
=> 'apihelp-query+revisions-example-last5',
|
|
|
|
|
'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
|
|
|
|
|
'rvprop=timestamp|user|comment&rvdir=newer'
|
|
|
|
|
=> 'apihelp-query+revisions-example-first5',
|
|
|
|
|
'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
|
|
|
|
|
'rvprop=timestamp|user|comment&rvdir=newer&rvstart=2006-05-01T00:00:00Z'
|
|
|
|
|
=> 'apihelp-query+revisions-example-first5-after',
|
|
|
|
|
'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
|
|
|
|
|
'rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1'
|
|
|
|
|
=> 'apihelp-query+revisions-example-first5-not-localhost',
|
|
|
|
|
'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
|
|
|
|
|
'rvprop=timestamp|user|comment&rvuser=MediaWiki%20default'
|
|
|
|
|
=> 'apihelp-query+revisions-example-first5-user',
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2006-09-26 05:43:02 +00:00
|
|
|
}
|
2006-10-01 21:20:55 +00:00
|
|
|
|
2011-07-17 16:51:11 +00:00
|
|
|
public function getHelpUrls() {
|
2017-04-04 22:52:57 +00:00
|
|
|
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Revisions';
|
2011-07-17 16:51:11 +00:00
|
|
|
}
|
2006-09-26 05:43:02 +00:00
|
|
|
}
|