MediaWiki  1.34.0
ApiQueryRevisions.php
Go to the documentation of this file.
1 <?php
26 
36 
37  private $token = null;
38 
39  public function __construct( ApiQuery $query, $moduleName ) {
40  parent::__construct( $query, $moduleName, 'rv' );
41  }
42 
43  private $tokenFunctions;
44 
46  protected function getTokenFunctions() {
47  // tokenname => function
48  // function prototype is func($pageid, $title, $rev)
49  // should return token or false
50 
51  // Don't call the hooks twice
52  if ( isset( $this->tokenFunctions ) ) {
53  return $this->tokenFunctions;
54  }
55 
56  // If we're in a mode that breaks the same-origin policy, no tokens can
57  // be obtained
58  if ( $this->lacksSameOriginSecurity() ) {
59  return [];
60  }
61 
62  $this->tokenFunctions = [
63  'rollback' => [ self::class, 'getRollbackToken' ]
64  ];
65  Hooks::run( 'APIQueryRevisionsTokens', [ &$this->tokenFunctions ] );
66 
67  return $this->tokenFunctions;
68  }
69 
77  public static function getRollbackToken( $pageid, $title, $rev ) {
78  global $wgUser;
79  if ( !MediaWikiServices::getInstance()->getPermissionManager()
80  ->userHasRight( $wgUser, 'rollback' ) ) {
81  return false;
82  }
83 
84  return $wgUser->getEditToken( 'rollback' );
85  }
86 
87  protected function run( ApiPageSet $resultPageSet = null ) {
88  $params = $this->extractRequestParams( false );
89  $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
90 
91  // If any of those parameters are used, work in 'enumeration' mode.
92  // Enum mode can only be used when exactly one page is provided.
93  // Enumerating revisions on multiple pages make it extremely
94  // difficult to manage continuations and require additional SQL indexes
95  $enumRevMode = ( $params['user'] !== null || $params['excludeuser'] !== null ||
96  $params['limit'] !== null || $params['startid'] !== null ||
97  $params['endid'] !== null || $params['dir'] === 'newer' ||
98  $params['start'] !== null || $params['end'] !== null );
99 
100  $pageSet = $this->getPageSet();
101  $pageCount = $pageSet->getGoodTitleCount();
102  $revCount = $pageSet->getRevisionCount();
103 
104  // Optimization -- nothing to do
105  if ( $revCount === 0 && $pageCount === 0 ) {
106  // Nothing to do
107  return;
108  }
109  if ( $revCount > 0 && count( $pageSet->getLiveRevisionIDs() ) === 0 ) {
110  // We're in revisions mode but all given revisions are deleted
111  return;
112  }
113 
114  if ( $revCount > 0 && $enumRevMode ) {
115  $this->dieWithError(
116  [ 'apierror-revisions-norevids', $this->getModulePrefix() ], 'invalidparammix'
117  );
118  }
119 
120  if ( $pageCount > 1 && $enumRevMode ) {
121  $this->dieWithError(
122  [ 'apierror-revisions-singlepage', $this->getModulePrefix() ], 'invalidparammix'
123  );
124  }
125 
126  // In non-enum mode, rvlimit can't be directly used. Use the maximum
127  // allowed value.
128  if ( !$enumRevMode ) {
129  $this->setParsedLimit = false;
130  $params['limit'] = 'max';
131  }
132 
133  $db = $this->getDB();
134 
135  $idField = 'rev_id';
136  $tsField = 'rev_timestamp';
137  $pageField = 'rev_page';
138  if ( $params['user'] !== null ) {
139  // We're going to want to use the page_actor_timestamp index (on revision_actor_temp)
140  // so use that table's denormalized fields.
141  $idField = 'revactor_rev';
142  $tsField = 'revactor_timestamp';
143  $pageField = 'revactor_page';
144  }
145 
146  if ( $resultPageSet === null ) {
147  $this->parseParameters( $params );
148  $this->token = $params['token'];
149  $opts = [];
150  if ( $this->token !== null || $pageCount > 0 ) {
151  $opts[] = 'page';
152  }
153  if ( $this->fld_user ) {
154  $opts[] = 'user';
155  }
156  $revQuery = $revisionStore->getQueryInfo( $opts );
157 
158  if ( $idField !== 'rev_id' ) {
159  $aliasFields = [ 'rev_id' => $idField, 'rev_timestamp' => $tsField, 'rev_page' => $pageField ];
160  $revQuery['fields'] = array_merge(
161  $aliasFields,
162  array_diff( $revQuery['fields'], array_keys( $aliasFields ) )
163  );
164  }
165 
166  $this->addTables( $revQuery['tables'] );
167  $this->addFields( $revQuery['fields'] );
168  $this->addJoinConds( $revQuery['joins'] );
169  } else {
170  $this->limit = $this->getParameter( 'limit' ) ?: 10;
171  // Always join 'page' so orphaned revisions are filtered out
172  $this->addTables( [ 'revision', 'page' ] );
173  $this->addJoinConds(
174  [ 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ] ]
175  );
176  $this->addFields( [
177  'rev_id' => $idField, 'rev_timestamp' => $tsField, 'rev_page' => $pageField
178  ] );
179  }
180 
181  if ( $this->fld_tags ) {
182  $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'revision' ) ] );
183  }
184 
185  if ( $params['tag'] !== null ) {
186  $this->addTables( 'change_tag' );
187  $this->addJoinConds(
188  [ 'change_tag' => [ 'JOIN', [ 'rev_id=ct_rev_id' ] ] ]
189  );
190  $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
191  try {
192  $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) );
193  } catch ( NameTableAccessException $exception ) {
194  // Return nothing.
195  $this->addWhere( '1=0' );
196  }
197  }
198 
199  if ( $resultPageSet === null && $this->fetchContent ) {
200  // For each page we will request, the user must have read rights for that page
202  $user = $this->getUser();
203 
205  foreach ( $pageSet->getGoodTitles() as $title ) {
206  if ( !$this->getPermissionManager()->userCan( 'read', $user, $title ) ) {
207  $status->fatal( ApiMessage::create(
208  [ 'apierror-cannotviewtitle', wfEscapeWikiText( $title->getPrefixedText() ) ],
209  'accessdenied'
210  ) );
211  }
212  }
213  if ( !$status->isGood() ) {
214  $this->dieStatus( $status );
215  }
216  }
217 
218  if ( $enumRevMode ) {
219  // Indexes targeted:
220  // page_timestamp if we don't have rvuser
221  // page_actor_timestamp (on revision_actor_temp) if we have rvuser in READ_NEW mode
222  // page_user_timestamp if we have a logged-in rvuser
223  // page_timestamp or usertext_timestamp if we have an IP rvuser
224 
225  // This is mostly to prevent parameter errors (and optimize SQL?)
226  $this->requireMaxOneParameter( $params, 'startid', 'start' );
227  $this->requireMaxOneParameter( $params, 'endid', 'end' );
228  $this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
229 
230  if ( $params['continue'] !== null ) {
231  $cont = explode( '|', $params['continue'] );
232  $this->dieContinueUsageIf( count( $cont ) != 2 );
233  $op = ( $params['dir'] === 'newer' ? '>' : '<' );
234  $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
235  $continueId = (int)$cont[1];
236  $this->dieContinueUsageIf( $continueId != $cont[1] );
237  $this->addWhere( "$tsField $op $continueTimestamp OR " .
238  "($tsField = $continueTimestamp AND " .
239  "$idField $op= $continueId)"
240  );
241  }
242 
243  // Convert startid/endid to timestamps (T163532)
244  $revids = [];
245  if ( $params['startid'] !== null ) {
246  $revids[] = (int)$params['startid'];
247  }
248  if ( $params['endid'] !== null ) {
249  $revids[] = (int)$params['endid'];
250  }
251  if ( $revids ) {
252  $db = $this->getDB();
253  $sql = $db->unionQueries( [
254  $db->selectSQLText(
255  'revision',
256  [ 'id' => 'rev_id', 'ts' => 'rev_timestamp' ],
257  [ 'rev_id' => $revids ],
258  __METHOD__
259  ),
260  $db->selectSQLText(
261  'archive',
262  [ 'id' => 'ar_rev_id', 'ts' => 'ar_timestamp' ],
263  [ 'ar_rev_id' => $revids ],
264  __METHOD__
265  ),
266  ], $db::UNION_DISTINCT );
267  $res = $db->query( $sql, __METHOD__ );
268  foreach ( $res as $row ) {
269  if ( (int)$row->id === (int)$params['startid'] ) {
270  $params['start'] = $row->ts;
271  }
272  if ( (int)$row->id === (int)$params['endid'] ) {
273  $params['end'] = $row->ts;
274  }
275  }
276  if ( $params['startid'] !== null && $params['start'] === null ) {
277  $p = $this->encodeParamName( 'startid' );
278  $this->dieWithError( [ 'apierror-revisions-badid', $p ], "badid_$p" );
279  }
280  if ( $params['endid'] !== null && $params['end'] === null ) {
281  $p = $this->encodeParamName( 'endid' );
282  $this->dieWithError( [ 'apierror-revisions-badid', $p ], "badid_$p" );
283  }
284 
285  if ( $params['start'] !== null ) {
286  $op = ( $params['dir'] === 'newer' ? '>' : '<' );
287  $ts = $db->addQuotes( $db->timestampOrNull( $params['start'] ) );
288  if ( $params['startid'] !== null ) {
289  $this->addWhere( "$tsField $op $ts OR "
290  . "$tsField = $ts AND $idField $op= " . (int)$params['startid'] );
291  } else {
292  $this->addWhere( "$tsField $op= $ts" );
293  }
294  }
295  if ( $params['end'] !== null ) {
296  $op = ( $params['dir'] === 'newer' ? '<' : '>' ); // Yes, opposite of the above
297  $ts = $db->addQuotes( $db->timestampOrNull( $params['end'] ) );
298  if ( $params['endid'] !== null ) {
299  $this->addWhere( "$tsField $op $ts OR "
300  . "$tsField = $ts AND $idField $op= " . (int)$params['endid'] );
301  } else {
302  $this->addWhere( "$tsField $op= $ts" );
303  }
304  }
305  } else {
306  $this->addTimestampWhereRange( $tsField, $params['dir'],
307  $params['start'], $params['end'] );
308  }
309 
310  $sort = ( $params['dir'] === 'newer' ? '' : 'DESC' );
311  $this->addOption( 'ORDER BY', [ "rev_timestamp $sort", "rev_id $sort" ] );
312 
313  // There is only one ID, use it
314  $ids = array_keys( $pageSet->getGoodTitles() );
315  $this->addWhereFld( $pageField, reset( $ids ) );
316 
317  if ( $params['user'] !== null ) {
318  $actorQuery = ActorMigration::newMigration()
319  ->getWhere( $db, 'rev_user', User::newFromName( $params['user'], false ) );
320  $this->addTables( $actorQuery['tables'] );
321  $this->addJoinConds( $actorQuery['joins'] );
322  $this->addWhere( $actorQuery['conds'] );
323  } elseif ( $params['excludeuser'] !== null ) {
324  $actorQuery = ActorMigration::newMigration()
325  ->getWhere( $db, 'rev_user', User::newFromName( $params['excludeuser'], false ) );
326  $this->addTables( $actorQuery['tables'] );
327  $this->addJoinConds( $actorQuery['joins'] );
328  $this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' );
329  }
330  if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
331  // Paranoia: avoid brute force searches (T19342)
332  if ( !$this->getPermissionManager()->userHasRight( $this->getUser(), 'deletedhistory' ) ) {
333  $bitmask = RevisionRecord::DELETED_USER;
334  } elseif ( !$this->getPermissionManager()
335  ->userHasAnyRight( $this->getUser(), 'suppressrevision', 'viewsuppressed' )
336  ) {
337  $bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
338  } else {
339  $bitmask = 0;
340  }
341  if ( $bitmask ) {
342  $this->addWhere( $db->bitAnd( 'rev_deleted', $bitmask ) . " != $bitmask" );
343  }
344  }
345  } elseif ( $revCount > 0 ) {
346  // Always targets the PRIMARY index
347 
348  $revs = $pageSet->getLiveRevisionIDs();
349 
350  // Get all revision IDs
351  $this->addWhereFld( 'rev_id', array_keys( $revs ) );
352 
353  if ( $params['continue'] !== null ) {
354  $this->addWhere( 'rev_id >= ' . (int)$params['continue'] );
355  }
356  $this->addOption( 'ORDER BY', 'rev_id' );
357  } elseif ( $pageCount > 0 ) {
358  // Always targets the rev_page_id index
359 
360  $titles = $pageSet->getGoodTitles();
361 
362  // When working in multi-page non-enumeration mode,
363  // limit to the latest revision only
364  $this->addWhere( 'page_latest=rev_id' );
365 
366  // Get all page IDs
367  $this->addWhereFld( 'page_id', array_keys( $titles ) );
368  // Every time someone relies on equality propagation, god kills a kitten :)
369  $this->addWhereFld( 'rev_page', array_keys( $titles ) );
370 
371  if ( $params['continue'] !== null ) {
372  $cont = explode( '|', $params['continue'] );
373  $this->dieContinueUsageIf( count( $cont ) != 2 );
374  $pageid = (int)$cont[0];
375  $revid = (int)$cont[1];
376  $this->addWhere(
377  "rev_page > $pageid OR " .
378  "(rev_page = $pageid AND " .
379  "rev_id >= $revid)"
380  );
381  }
382  $this->addOption( 'ORDER BY', [
383  'rev_page',
384  'rev_id'
385  ] );
386  } else {
387  ApiBase::dieDebug( __METHOD__, 'param validation?' );
388  }
389 
390  $this->addOption( 'LIMIT', $this->limit + 1 );
391 
392  // T224017: `rev_timestamp` is never the correct index to use for this module, but
393  // MariaDB (10.1.37-39) sometimes insists on trying to use it anyway. Tell it not to.
394  $this->addOption( 'IGNORE INDEX', [ 'revision' => 'rev_timestamp' ] );
395 
396  $count = 0;
397  $generated = [];
398  $hookData = [];
399  $res = $this->select( __METHOD__, [], $hookData );
400 
401  foreach ( $res as $row ) {
402  if ( ++$count > $this->limit ) {
403  // We've reached the one extra which shows that there are
404  // additional pages to be had. Stop here...
405  if ( $enumRevMode ) {
406  $this->setContinueEnumParameter( 'continue',
407  $row->rev_timestamp . '|' . (int)$row->rev_id );
408  } elseif ( $revCount > 0 ) {
409  $this->setContinueEnumParameter( 'continue', (int)$row->rev_id );
410  } else {
411  $this->setContinueEnumParameter( 'continue', (int)$row->rev_page .
412  '|' . (int)$row->rev_id );
413  }
414  break;
415  }
416 
417  if ( $resultPageSet !== null ) {
418  $generated[] = $row->rev_id;
419  } else {
420  $revision = $revisionStore->newRevisionFromRow( $row );
421  $rev = $this->extractRevisionInfo( $revision, $row );
422 
423  if ( $this->token !== null ) {
424  $title = Title::newFromLinkTarget( $revision->getPageAsLinkTarget() );
425  $revisionCompat = new Revision( $revision );
427  foreach ( $this->token as $t ) {
428  $val = call_user_func( $tokenFunctions[$t], $title->getArticleID(), $title, $revisionCompat );
429  if ( $val === false ) {
430  $this->addWarning( [ 'apiwarn-tokennotallowed', $t ] );
431  } else {
432  $rev[$t . 'token'] = $val;
433  }
434  }
435  }
436 
437  $fit = $this->processRow( $row, $rev, $hookData ) &&
438  $this->addPageSubItem( $row->rev_page, $rev, 'rev' );
439  if ( !$fit ) {
440  if ( $enumRevMode ) {
441  $this->setContinueEnumParameter( 'continue',
442  $row->rev_timestamp . '|' . (int)$row->rev_id );
443  } elseif ( $revCount > 0 ) {
444  $this->setContinueEnumParameter( 'continue', (int)$row->rev_id );
445  } else {
446  $this->setContinueEnumParameter( 'continue', (int)$row->rev_page .
447  '|' . (int)$row->rev_id );
448  }
449  break;
450  }
451  }
452  }
453 
454  if ( $resultPageSet !== null ) {
455  $resultPageSet->populateFromRevisionIDs( $generated );
456  }
457  }
458 
459  public function getCacheMode( $params ) {
460  if ( isset( $params['token'] ) ) {
461  return 'private';
462  }
463  return parent::getCacheMode( $params );
464  }
465 
466  public function getAllowedParams() {
467  $ret = parent::getAllowedParams() + [
468  'startid' => [
469  ApiBase::PARAM_TYPE => 'integer',
470  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
471  ],
472  'endid' => [
473  ApiBase::PARAM_TYPE => 'integer',
474  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
475  ],
476  'start' => [
477  ApiBase::PARAM_TYPE => 'timestamp',
478  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
479  ],
480  'end' => [
481  ApiBase::PARAM_TYPE => 'timestamp',
482  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
483  ],
484  'dir' => [
485  ApiBase::PARAM_DFLT => 'older',
487  'newer',
488  'older'
489  ],
490  ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
491  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
492  ],
493  'user' => [
494  ApiBase::PARAM_TYPE => 'user',
495  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
496  ],
497  'excludeuser' => [
498  ApiBase::PARAM_TYPE => 'user',
499  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'singlepageonly' ] ],
500  ],
501  'tag' => null,
502  'token' => [
504  ApiBase::PARAM_TYPE => array_keys( $this->getTokenFunctions() ),
506  ],
507  'continue' => [
508  ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
509  ],
510  ];
511 
512  $ret['limit'][ApiBase::PARAM_HELP_MSG_INFO] = [ [ 'singlepageonly' ] ];
513 
514  return $ret;
515  }
516 
517  protected function getExamplesMessages() {
518  return [
519  'action=query&prop=revisions&titles=API|Main%20Page&' .
520  'rvslots=*&rvprop=timestamp|user|comment|content'
521  => 'apihelp-query+revisions-example-content',
522  'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
523  'rvprop=timestamp|user|comment'
524  => 'apihelp-query+revisions-example-last5',
525  'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
526  'rvprop=timestamp|user|comment&rvdir=newer'
527  => 'apihelp-query+revisions-example-first5',
528  'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
529  'rvprop=timestamp|user|comment&rvdir=newer&rvstart=2006-05-01T00:00:00Z'
530  => 'apihelp-query+revisions-example-first5-after',
531  'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
532  'rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1'
533  => 'apihelp-query+revisions-example-first5-not-localhost',
534  'action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
535  'rvprop=timestamp|user|comment&rvuser=MediaWiki%20default'
536  => 'apihelp-query+revisions-example-first5-user',
537  ];
538  }
539 
540  public function getHelpUrls() {
541  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Revisions';
542  }
543 }
ApiQueryRevisionsBase\parseParameters
parseParameters( $params)
Parse the parameters into the various instance fields.
Definition: ApiQueryRevisionsBase.php:77
ChangeTags\makeTagSummarySubquery
static makeTagSummarySubquery( $tables)
Make the tag summary subquery based on the given tables and return it.
Definition: ChangeTags.php:837
ApiQueryRevisions\$token
$token
Definition: ApiQueryRevisions.php:37
ApiQueryBase\processRow
processRow( $row, array &$data, array &$hookData)
Call the ApiQueryBaseProcessRow hook.
Definition: ApiQueryBase.php:425
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:193
ApiQuery
This is the main query class.
Definition: ApiQuery.php:37
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:46
ApiBase\addWarning
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
Definition: ApiBase.php:1933
ApiQueryGeneratorBase\encodeParamName
encodeParamName( $paramName)
Overrides ApiBase to prepend 'g' to every generator parameter.
Definition: ApiQueryGeneratorBase.php:71
ApiQueryRevisions\getRollbackToken
static getRollbackToken( $pageid, $title, $rev)
Definition: ApiQueryRevisions.php:77
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
ApiBase\dieWithError
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition: ApiBase.php:2014
ApiQueryBase\addTimestampWhereRange
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
Definition: ApiQueryBase.php:338
ApiBase\PARAM_HELP_MSG
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition: ApiBase.php:131
true
return true
Definition: router.php:92
ApiBase\PARAM_TYPE
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
Definition: ApiBase.php:94
ApiQueryRevisions\run
run(ApiPageSet $resultPageSet=null)
Definition: ApiQueryRevisions.php:87
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:515
ApiQueryBase\addOption
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
Definition: ApiQueryBase.php:350
$res
$res
Definition: testCompression.php:52
ContextSource\getUser
getUser()
Definition: ContextSource.php:120
$revQuery
$revQuery
Definition: testCompression.php:51
ApiBase\lacksSameOriginSecurity
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
Definition: ApiBase.php:568
ActorMigration\newMigration
static newMigration()
Static constructor.
Definition: ActorMigration.php:136
ApiPageSet
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:40
Revision
Definition: Revision.php:40
ApiQueryRevisionsBase
A base class for functions common to producing a list of revisions.
Definition: ApiQueryRevisionsBase.php:34
ApiQueryGeneratorBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
Definition: ApiQueryGeneratorBase.php:84
ApiBase\PARAM_DEPRECATED
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition: ApiBase.php:112
ApiQueryGeneratorBase\getPageSet
getPageSet()
Get the PageSet object to work on.
Definition: ApiQueryGeneratorBase.php:58
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:107
ApiQueryRevisions\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiQueryRevisions.php:517
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:161
ApiQueryBase\select
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
Definition: ApiQueryBase.php:375
$t
$t
Definition: make-normalization-table.php:143
ApiBase\extractRequestParams
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:761
$title
$title
Definition: testCompression.php:34
ApiMessage\create
static create( $msg, $code=null, array $data=null)
Create an IApiMessage for the message.
Definition: ApiMessage.php:40
$sort
$sort
Definition: profileinfo.php:331
ApiBase\getModulePrefix
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
Definition: ApiBase.php:528
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
Definition: ApiBase.php:2208
StatusValue\newGood
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:81
ApiQueryRevisionsBase\extractRevisionInfo
extractRevisionInfo(RevisionRecord $revision, $row)
Extract information from the RevisionRecord.
Definition: ApiQueryRevisionsBase.php:228
ApiBase\getPermissionManager
getPermissionManager()
Obtain a PermissionManager instance that subclasses may use in their authorization checks.
Definition: ApiBase.php:710
ApiQueryBase\addJoinConds
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
Definition: ApiQueryBase.php:182
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:1551
ApiQueryRevisions\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.
Definition: ApiQueryRevisions.php:459
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere( [ $field => $value ] )
Definition: ApiQueryBase.php:261
ApiBase\requireMaxOneParameter
requireMaxOneParameter( $params, $required)
Die if more than one of a certain set of parameters is set and not false.
Definition: ApiBase.php:931
ApiBase\PARAM_HELP_MSG_INFO
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
Definition: ApiBase.php:148
Title\newFromLinkTarget
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:268
Title
Represents a title within MediaWiki.
Definition: Title.php:42
$status
return $status
Definition: SyntaxHighlight.php:347
ApiBase\PARAM_DFLT
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:55
ApiBase\getParameter
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
Definition: ApiBase.php:876
ApiQueryRevisions\getTokenFunctions
getTokenFunctions()
Definition: ApiQueryRevisions.php:46
ApiBase\dieStatus
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
Definition: ApiBase.php:2086
MediaWiki\Storage\NameTableAccessException
Exception representing a failure to look up a row from a name table.
Definition: NameTableAccessException.php:32
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:58
ApiQueryRevisions\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiQueryRevisions.php:540
ApiQueryRevisions\__construct
__construct(ApiQuery $query, $moduleName)
Definition: ApiQueryRevisions.php:39
ApiQueryBase\addWhere
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Definition: ApiQueryBase.php:228
ApiQueryRevisions\$tokenFunctions
$tokenFunctions
Definition: ApiQueryRevisions.php:43
ApiQueryRevisions\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryRevisions.php:466
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
ApiQueryBase\addPageSubItem
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
Definition: ApiQueryBase.php:471
ApiBase\dieDebug
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:2220
ApiQueryRevisions
A query action to enumerate revisions of a given page, or show top revisions of multiple pages.
Definition: ApiQueryRevisions.php:35