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