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