MediaWiki  REL1_31
ApiQueryRevisionsBase.php
Go to the documentation of this file.
1 <?php
29 
32 
33  protected $fld_ids = false, $fld_flags = false, $fld_timestamp = false,
34  $fld_size = false, $fld_sha1 = false, $fld_comment = false,
35  $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
36  $fld_content = false, $fld_tags = false, $fld_contentmodel = false, $fld_parsetree = false;
37 
38  public function execute() {
39  $this->run();
40  }
41 
42  public function executeGenerator( $resultPageSet ) {
43  $this->run( $resultPageSet );
44  }
45 
50  abstract protected function run( ApiPageSet $resultPageSet = null );
51 
57  protected function parseParameters( $params ) {
58  if ( !is_null( $params['difftotext'] ) ) {
59  $this->difftotext = $params['difftotext'];
60  $this->difftotextpst = $params['difftotextpst'];
61  } elseif ( !is_null( $params['diffto'] ) ) {
62  if ( $params['diffto'] == 'cur' ) {
63  $params['diffto'] = 0;
64  }
65  if ( ( !ctype_digit( $params['diffto'] ) || $params['diffto'] < 0 )
66  && $params['diffto'] != 'prev' && $params['diffto'] != 'next'
67  ) {
68  $p = $this->getModulePrefix();
69  $this->dieWithError( [ 'apierror-baddiffto', $p ], 'diffto' );
70  }
71  // Check whether the revision exists and is readable,
72  // DifferenceEngine returns a rather ambiguous empty
73  // string if that's not the case
74  if ( $params['diffto'] != 0 ) {
75  $difftoRev = Revision::newFromId( $params['diffto'] );
76  if ( !$difftoRev ) {
77  $this->dieWithError( [ 'apierror-nosuchrevid', $params['diffto'] ] );
78  }
79  if ( !$difftoRev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
80  $this->addWarning( [ 'apiwarn-difftohidden', $difftoRev->getId() ] );
81  $params['diffto'] = null;
82  }
83  }
84  $this->diffto = $params['diffto'];
85  }
86 
87  $prop = array_flip( $params['prop'] );
88 
89  $this->fld_ids = isset( $prop['ids'] );
90  $this->fld_flags = isset( $prop['flags'] );
91  $this->fld_timestamp = isset( $prop['timestamp'] );
92  $this->fld_comment = isset( $prop['comment'] );
93  $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
94  $this->fld_size = isset( $prop['size'] );
95  $this->fld_sha1 = isset( $prop['sha1'] );
96  $this->fld_content = isset( $prop['content'] );
97  $this->fld_contentmodel = isset( $prop['contentmodel'] );
98  $this->fld_userid = isset( $prop['userid'] );
99  $this->fld_user = isset( $prop['user'] );
100  $this->fld_tags = isset( $prop['tags'] );
101  $this->fld_parsetree = isset( $prop['parsetree'] );
102 
103  if ( $this->fld_parsetree ) {
104  $encParam = $this->encodeParamName( 'prop' );
105  $name = $this->getModuleName();
106  $parent = $this->getParent();
107  $parentParam = $parent->encodeParamName( $parent->getModuleManager()->getModuleGroup( $name ) );
108  $this->addDeprecation(
109  [ 'apiwarn-deprecation-parameter', "{$encParam}=parsetree" ],
110  "action=query&{$parentParam}={$name}&{$encParam}=parsetree"
111  );
112  }
113 
114  if ( !empty( $params['contentformat'] ) ) {
115  $this->contentFormat = $params['contentformat'];
116  }
117 
118  $this->limit = $params['limit'];
119 
120  $this->fetchContent = $this->fld_content || !is_null( $this->diffto )
121  || !is_null( $this->difftotext ) || $this->fld_parsetree;
122 
123  $smallLimit = false;
124  if ( $this->fetchContent ) {
125  $smallLimit = true;
126  $this->expandTemplates = $params['expandtemplates'];
127  $this->generateXML = $params['generatexml'];
128  $this->parseContent = $params['parse'];
129  if ( $this->parseContent ) {
130  // Must manually initialize unset limit
131  if ( is_null( $this->limit ) ) {
132  $this->limit = 1;
133  }
134  }
135  if ( isset( $params['section'] ) ) {
136  $this->section = $params['section'];
137  } else {
138  $this->section = false;
139  }
140  }
141 
142  $userMax = $this->parseContent ? 1 : ( $smallLimit ? ApiBase::LIMIT_SML1 : ApiBase::LIMIT_BIG1 );
143  $botMax = $this->parseContent ? 1 : ( $smallLimit ? ApiBase::LIMIT_SML2 : ApiBase::LIMIT_BIG2 );
144  if ( $this->limit == 'max' ) {
145  $this->limit = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
146  if ( $this->setParsedLimit ) {
147  $this->getResult()->addParsedLimit( $this->getModuleName(), $this->limit );
148  }
149  }
150 
151  if ( is_null( $this->limit ) ) {
152  $this->limit = 10;
153  }
154  $this->validateLimit( 'limit', $this->limit, 1, $userMax, $botMax );
155  }
156 
164  protected function extractRevisionInfo( Revision $revision, $row ) {
165  $title = $revision->getTitle();
166  $user = $this->getUser();
167  $vals = [];
168  $anyHidden = false;
169 
170  if ( $this->fld_ids ) {
171  $vals['revid'] = intval( $revision->getId() );
172  if ( !is_null( $revision->getParentId() ) ) {
173  $vals['parentid'] = intval( $revision->getParentId() );
174  }
175  }
176 
177  if ( $this->fld_flags ) {
178  $vals['minor'] = $revision->isMinor();
179  }
180 
181  if ( $this->fld_user || $this->fld_userid ) {
182  if ( $revision->isDeleted( Revision::DELETED_USER ) ) {
183  $vals['userhidden'] = true;
184  $anyHidden = true;
185  }
186  if ( $revision->userCan( Revision::DELETED_USER, $user ) ) {
187  if ( $this->fld_user ) {
188  $vals['user'] = $revision->getUserText( Revision::RAW );
189  }
190  $userid = $revision->getUser( Revision::RAW );
191  if ( !$userid ) {
192  $vals['anon'] = true;
193  }
194 
195  if ( $this->fld_userid ) {
196  $vals['userid'] = $userid;
197  }
198  }
199  }
200 
201  if ( $this->fld_timestamp ) {
202  $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $revision->getTimestamp() );
203  }
204 
205  if ( $this->fld_size ) {
206  if ( !is_null( $revision->getSize() ) ) {
207  $vals['size'] = intval( $revision->getSize() );
208  } else {
209  $vals['size'] = 0;
210  }
211  }
212 
213  if ( $this->fld_sha1 ) {
214  if ( $revision->isDeleted( Revision::DELETED_TEXT ) ) {
215  $vals['sha1hidden'] = true;
216  $anyHidden = true;
217  }
218  if ( $revision->userCan( Revision::DELETED_TEXT, $user ) ) {
219  if ( $revision->getSha1() != '' ) {
220  $vals['sha1'] = Wikimedia\base_convert( $revision->getSha1(), 36, 16, 40 );
221  } else {
222  $vals['sha1'] = '';
223  }
224  }
225  }
226 
227  if ( $this->fld_contentmodel ) {
228  $vals['contentmodel'] = $revision->getContentModel();
229  }
230 
231  if ( $this->fld_comment || $this->fld_parsedcomment ) {
232  if ( $revision->isDeleted( Revision::DELETED_COMMENT ) ) {
233  $vals['commenthidden'] = true;
234  $anyHidden = true;
235  }
236  if ( $revision->userCan( Revision::DELETED_COMMENT, $user ) ) {
237  $comment = $revision->getComment( Revision::RAW );
238 
239  if ( $this->fld_comment ) {
240  $vals['comment'] = $comment;
241  }
242 
243  if ( $this->fld_parsedcomment ) {
244  $vals['parsedcomment'] = Linker::formatComment( $comment, $title );
245  }
246  }
247  }
248 
249  if ( $this->fld_tags ) {
250  if ( $row->ts_tags ) {
251  $tags = explode( ',', $row->ts_tags );
252  ApiResult::setIndexedTagName( $tags, 'tag' );
253  $vals['tags'] = $tags;
254  } else {
255  $vals['tags'] = [];
256  }
257  }
258 
259  $content = null;
261  if ( $this->fetchContent ) {
262  $content = $revision->getContent( Revision::FOR_THIS_USER, $this->getUser() );
263  // Expand templates after getting section content because
264  // template-added sections don't count and Parser::preprocess()
265  // will have less input
266  if ( $content && $this->section !== false ) {
267  $content = $content->getSection( $this->section, false );
268  if ( !$content ) {
269  $this->dieWithError(
270  [
271  'apierror-nosuchsection-what',
272  wfEscapeWikiText( $this->section ),
273  $this->msg( 'revid', $revision->getId() )
274  ],
275  'nosuchsection'
276  );
277  }
278  }
279  if ( $revision->isDeleted( Revision::DELETED_TEXT ) ) {
280  $vals['texthidden'] = true;
281  $anyHidden = true;
282  } elseif ( !$content ) {
283  $vals['textmissing'] = true;
284  }
285  }
286  if ( $this->fld_parsetree || ( $this->fld_content && $this->generateXML ) ) {
287  if ( $content ) {
288  if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) {
289  $t = $content->getNativeData(); # note: don't set $text
290 
291  $wgParser->startExternalParse(
292  $title,
293  ParserOptions::newFromContext( $this->getContext() ),
294  Parser::OT_PREPROCESS
295  );
296  $dom = $wgParser->preprocessToDom( $t );
297  if ( is_callable( [ $dom, 'saveXML' ] ) ) {
298  $xml = $dom->saveXML();
299  } else {
300  $xml = $dom->__toString();
301  }
302  $vals['parsetree'] = $xml;
303  } else {
304  $vals['badcontentformatforparsetree'] = true;
305  $this->addWarning(
306  [
307  'apierror-parsetree-notwikitext-title',
308  wfEscapeWikiText( $title->getPrefixedText() ),
309  $content->getModel()
310  ],
311  'parsetree-notwikitext'
312  );
313  }
314  }
315  }
316 
317  if ( $this->fld_content && $content ) {
318  $text = null;
319 
320  if ( $this->expandTemplates && !$this->parseContent ) {
321  # XXX: implement template expansion for all content types in ContentHandler?
322  if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) {
323  $text = $content->getNativeData();
324 
325  $text = $wgParser->preprocess(
326  $text,
327  $title,
328  ParserOptions::newFromContext( $this->getContext() )
329  );
330  } else {
331  $this->addWarning( [
332  'apierror-templateexpansion-notwikitext',
333  wfEscapeWikiText( $title->getPrefixedText() ),
334  $content->getModel()
335  ] );
336  $vals['badcontentformat'] = true;
337  $text = false;
338  }
339  }
340  if ( $this->parseContent ) {
341  $po = $content->getParserOutput(
342  $title,
343  $revision->getId(),
344  ParserOptions::newFromContext( $this->getContext() )
345  );
346  $text = $po->getText();
347  }
348 
349  if ( $text === null ) {
350  $format = $this->contentFormat ?: $content->getDefaultFormat();
351  $model = $content->getModel();
352 
353  if ( !$content->isSupportedFormat( $format ) ) {
354  $name = wfEscapeWikiText( $title->getPrefixedText() );
355  $this->addWarning( [ 'apierror-badformat', $this->contentFormat, $model, $name ] );
356  $vals['badcontentformat'] = true;
357  $text = false;
358  } else {
359  $text = $content->serialize( $format );
360  // always include format and model.
361  // Format is needed to deserialize, model is needed to interpret.
362  $vals['contentformat'] = $format;
363  $vals['contentmodel'] = $model;
364  }
365  }
366 
367  if ( $text !== false ) {
368  ApiResult::setContentValue( $vals, 'content', $text );
369  }
370  }
371 
372  if ( $content && ( !is_null( $this->diffto ) || !is_null( $this->difftotext ) ) ) {
373  static $n = 0; // Number of uncached diffs we've had
374 
375  if ( $n < $this->getConfig()->get( 'APIMaxUncachedDiffs' ) ) {
376  $vals['diff'] = [];
377  $context = new DerivativeContext( $this->getContext() );
378  $context->setTitle( $title );
379  $handler = $revision->getContentHandler();
380 
381  if ( !is_null( $this->difftotext ) ) {
382  $model = $title->getContentModel();
383 
384  if ( $this->contentFormat
385  && !ContentHandler::getForModelID( $model )->isSupportedFormat( $this->contentFormat )
386  ) {
387  $name = wfEscapeWikiText( $title->getPrefixedText() );
388  $this->addWarning( [ 'apierror-badformat', $this->contentFormat, $model, $name ] );
389  $vals['diff']['badcontentformat'] = true;
390  $engine = null;
391  } else {
392  $difftocontent = ContentHandler::makeContent(
393  $this->difftotext,
394  $title,
395  $model,
396  $this->contentFormat
397  );
398 
399  if ( $this->difftotextpst ) {
400  $popts = ParserOptions::newFromContext( $this->getContext() );
401  $difftocontent = $difftocontent->preSaveTransform( $title, $user, $popts );
402  }
403 
404  $engine = $handler->createDifferenceEngine( $context );
405  $engine->setContent( $content, $difftocontent );
406  }
407  } else {
408  $engine = $handler->createDifferenceEngine( $context, $revision->getId(), $this->diffto );
409  $vals['diff']['from'] = $engine->getOldid();
410  $vals['diff']['to'] = $engine->getNewid();
411  }
412  if ( $engine ) {
413  $difftext = $engine->getDiffBody();
414  ApiResult::setContentValue( $vals['diff'], 'body', $difftext );
415  if ( !$engine->wasCacheHit() ) {
416  $n++;
417  }
418  }
419  } else {
420  $vals['diff']['notcached'] = true;
421  }
422  }
423 
424  if ( $anyHidden && $revision->isDeleted( Revision::DELETED_RESTRICTED ) ) {
425  $vals['suppressed'] = true;
426  }
427 
428  return $vals;
429  }
430 
431  public function getCacheMode( $params ) {
432  if ( $this->userCanSeeRevDel() ) {
433  return 'private';
434  }
435 
436  return 'public';
437  }
438 
439  public function getAllowedParams() {
440  return [
441  'prop' => [
442  ApiBase::PARAM_ISMULTI => true,
443  ApiBase::PARAM_DFLT => 'ids|timestamp|flags|comment|user',
445  'ids',
446  'flags',
447  'timestamp',
448  'user',
449  'userid',
450  'size',
451  'sha1',
452  'contentmodel',
453  'comment',
454  'parsedcomment',
455  'content',
456  'tags',
457  'parsetree',
458  ],
459  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-prop',
461  'ids' => 'apihelp-query+revisions+base-paramvalue-prop-ids',
462  'flags' => 'apihelp-query+revisions+base-paramvalue-prop-flags',
463  'timestamp' => 'apihelp-query+revisions+base-paramvalue-prop-timestamp',
464  'user' => 'apihelp-query+revisions+base-paramvalue-prop-user',
465  'userid' => 'apihelp-query+revisions+base-paramvalue-prop-userid',
466  'size' => 'apihelp-query+revisions+base-paramvalue-prop-size',
467  'sha1' => 'apihelp-query+revisions+base-paramvalue-prop-sha1',
468  'contentmodel' => 'apihelp-query+revisions+base-paramvalue-prop-contentmodel',
469  'comment' => 'apihelp-query+revisions+base-paramvalue-prop-comment',
470  'parsedcomment' => 'apihelp-query+revisions+base-paramvalue-prop-parsedcomment',
471  'content' => 'apihelp-query+revisions+base-paramvalue-prop-content',
472  'tags' => 'apihelp-query+revisions+base-paramvalue-prop-tags',
473  'parsetree' => [ 'apihelp-query+revisions+base-paramvalue-prop-parsetree',
475  ],
476  ],
477  'limit' => [
478  ApiBase::PARAM_TYPE => 'limit',
479  ApiBase::PARAM_MIN => 1,
482  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-limit',
483  ],
484  'expandtemplates' => [
485  ApiBase::PARAM_DFLT => false,
486  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-expandtemplates',
488  ],
489  'generatexml' => [
490  ApiBase::PARAM_DFLT => false,
492  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-generatexml',
493  ],
494  'parse' => [
495  ApiBase::PARAM_DFLT => false,
496  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-parse',
498  ],
499  'section' => [
500  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-section',
501  ],
502  'diffto' => [
503  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-diffto',
505  ],
506  'difftotext' => [
507  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotext',
509  ],
510  'difftotextpst' => [
511  ApiBase::PARAM_DFLT => false,
512  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotextpst',
514  ],
515  'contentformat' => [
517  ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-contentformat',
518  ],
519  ];
520  }
521 
522 }
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:247
ApiQueryRevisionsBase\parseParameters
parseParameters( $params)
Parse the parameters into the various instance fields.
Definition: ApiQueryRevisionsBase.php:57
Revision\DELETED_USER
const DELETED_USER
Definition: Revision.php:49
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:63
Revision\getTimestamp
getTimestamp()
Definition: Revision.php:1008
ContentHandler\getForModelID
static getForModelID( $modelId)
Returns the ContentHandler singleton for the given model ID.
Definition: ContentHandler.php:293
$handler
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
Definition: hooks.txt:903
Revision\DELETED_RESTRICTED
const DELETED_RESTRICTED
Definition: Revision.php:50
ContextSource\getContext
getContext()
Get the base IContextSource object.
Definition: ContextSource.php:40
Revision\getUserText
getUserText( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision's username if it's available to the specified audience.
Definition: Revision.php:813
ContentHandler\getAllContentFormats
static getAllContentFormats()
Definition: ContentHandler.php:376
ApiBase\addWarning
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
Definition: ApiBase.php:1819
Revision\DELETED_COMMENT
const DELETED_COMMENT
Definition: Revision.php:48
ApiQueryGeneratorBase\encodeParamName
encodeParamName( $paramName)
Overrides ApiBase to prepend 'g' to every generator parameter.
Definition: ApiQueryGeneratorBase.php:71
Revision\newFromId
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
Definition: Revision.php:114
content
per default it will return the text for text based content
Definition: contenthandler.txt:104
Revision\getUser
getUser( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision's user id if it's available to the specified audience.
Definition: Revision.php:778
$wgParser
$wgParser
Definition: Setup.php:917
ApiQueryRevisionsBase\$fld_comment
$fld_comment
Definition: ApiQueryRevisionsBase.php:34
Revision\getSize
getSize()
Returns the length of the text in this revision, or null if unknown.
Definition: Revision.php:705
ApiQueryBase\getParent
getParent()
@inheritDoc
Definition: ApiQueryBase.php:97
ApiBase\dieWithError
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition: ApiBase.php:1895
ApiBase\PARAM_HELP_MSG
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition: ApiBase.php:124
ContextSource\msg
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:168
ApiQueryRevisionsBase\$section
$section
Definition: ApiQueryRevisionsBase.php:31
Revision\getContent
getContent( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision content if it's available to the specified audience.
Definition: Revision.php:929
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1980
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:87
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:641
ApiQueryRevisionsBase\$fld_userid
$fld_userid
Definition: ApiQueryRevisionsBase.php:35
ApiQueryRevisionsBase\$fld_sha1
$fld_sha1
Definition: ApiQueryRevisionsBase.php:34
$params
$params
Definition: styleTest.css.php:40
Revision\getParentId
getParentId()
Get parent revision ID (the original previous page revision)
Definition: Revision.php:696
Revision\getContentHandler
getContentHandler()
Returns the content handler appropriate for this revision's content model.
Definition: Revision.php:1001
ApiQueryRevisionsBase\$fetchContent
$fetchContent
Definition: ApiQueryRevisionsBase.php:31
CONTENT_MODEL_WIKITEXT
const CONTENT_MODEL_WIKITEXT
Definition: Defines.php:245
Revision\getSha1
getSha1()
Returns the base36 sha1 of the content in this revision, or null if unknown.
Definition: Revision.php:718
ApiQueryRevisionsBase\$setParsedLimit
$setParsedLimit
Definition: ApiQueryRevisionsBase.php:31
Revision\getId
getId()
Get revision ID.
Definition: Revision.php:617
ContextSource\getUser
getUser()
Definition: ContextSource.php:120
Revision\getContentModel
getContentModel()
Returns the content model for the main slot of this revision.
Definition: Revision.php:969
ApiQueryRevisionsBase\$difftotextpst
$difftotextpst
Definition: ApiQueryRevisionsBase.php:30
ApiPageSet
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:40
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
ApiQueryRevisionsBase\$limit
$limit
Definition: ApiQueryRevisionsBase.php:30
ApiQueryRevisionsBase\$fld_content
$fld_content
Definition: ApiQueryRevisionsBase.php:36
Revision\FOR_THIS_USER
const FOR_THIS_USER
Definition: Revision.php:56
Revision
Definition: Revision.php:41
ApiResult\setContentValue
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
Definition: ApiResult.php:478
ApiQueryRevisionsBase\$fld_contentmodel
$fld_contentmodel
Definition: ApiQueryRevisionsBase.php:36
ApiQueryRevisionsBase
A base class for functions common to producing a list of revisions.
Definition: ApiQueryRevisionsBase.php:28
ApiBase\PARAM_DEPRECATED
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition: ApiBase.php:105
ApiBase\PARAM_MIN
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:99
DerivativeContext
An IContextSource implementation which will inherit context from another source but allow individual ...
Definition: DerivativeContext.php:30
ApiQueryRevisionsBase\$expandTemplates
$expandTemplates
Definition: ApiQueryRevisionsBase.php:30
ApiQueryRevisionsBase\$contentFormat
$contentFormat
Definition: ApiQueryRevisionsBase.php:31
ApiBase\LIMIT_BIG1
const LIMIT_BIG1
Fast query, standard limit.
Definition: ApiBase.php:234
title
title
Definition: parserTests.txt:219
ApiQueryRevisionsBase\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryRevisionsBase.php:439
ApiBase\PARAM_MAX
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:90
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:964
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:95
ApiQueryRevisionsBase\$diffto
$diffto
Definition: ApiQueryRevisionsBase.php:30
ApiQueryRevisionsBase\$fld_parsetree
$fld_parsetree
Definition: ApiQueryRevisionsBase.php:36
ApiQueryRevisionsBase\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQueryRevisionsBase.php:38
ApiQueryRevisionsBase\$fld_tags
$fld_tags
Definition: ApiQueryRevisionsBase.php:36
ContentHandler\makeContent
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
Definition: ContentHandler.php:129
ApiBase\getModulePrefix
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
Definition: ApiBase.php:529
Revision\getTitle
getTitle()
Returns the title of the page associated with this entry.
Definition: Revision.php:734
ApiQueryRevisionsBase\extractRevisionInfo
extractRevisionInfo(Revision $revision, $row)
Extract information from the Revision.
Definition: ApiQueryRevisionsBase.php:164
ApiResult\setIndexedTagName
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
ApiQueryRevisionsBase\$parseContent
$parseContent
Definition: ApiQueryRevisionsBase.php:31
ParserOptions\newFromContext
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
Definition: ParserOptions.php:1005
ApiBase\addDeprecation
addDeprecation( $msg, $feature, $data=[])
Add a deprecation warning for this module.
Definition: ApiBase.php:1833
ApiBase\LIMIT_SML2
const LIMIT_SML2
Slow query, apihighlimits limit.
Definition: ApiBase.php:240
Revision\isDeleted
isDeleted( $field)
Definition: Revision.php:902
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:1643
$engine
the value to return A Title object or null for latest all implement SearchIndexField $engine
Definition: hooks.txt:2881
Revision\RAW
const RAW
Definition: Revision.php:57
ApiQueryRevisionsBase\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.
Definition: ApiQueryRevisionsBase.php:431
ApiQueryRevisionsBase\$fld_flags
$fld_flags
Definition: ApiQueryRevisionsBase.php:33
Linker\formatComment
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Definition: Linker.php:1109
ApiQueryRevisionsBase\$difftotext
$difftotext
Definition: ApiQueryRevisionsBase.php:30
ApiQueryGeneratorBase
Definition: ApiQueryGeneratorBase.php:26
ApiQueryRevisionsBase\$fld_ids
$fld_ids
Definition: ApiQueryRevisionsBase.php:33
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Fast query, apihighlimits limit.
Definition: ApiBase.php:236
ApiBase\validateLimit
validateLimit( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
Validate the value against the minimum and user/bot maximum limits.
Definition: ApiBase.php:1485
ApiBase\PARAM_DFLT
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:48
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:521
ApiQueryRevisionsBase\$fld_user
$fld_user
Definition: ApiQueryRevisionsBase.php:35
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:51
ApiQueryRevisionsBase\$fld_timestamp
$fld_timestamp
Definition: ApiQueryRevisionsBase.php:33
Revision\getComment
getComment( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision comment if it's available to the specified audience.
Definition: Revision.php:848
ApiBase\PARAM_MAX2
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
Definition: ApiBase.php:96
ApiBase\getMain
getMain()
Get the main module.
Definition: ApiBase.php:537
Revision\isMinor
isMinor()
Definition: Revision.php:873
ApiQueryRevisionsBase\executeGenerator
executeGenerator( $resultPageSet)
Execute this module as a generator.
Definition: ApiQueryRevisionsBase.php:42
$t
$t
Definition: testCompression.php:69
ApiQueryRevisionsBase\$fld_parsedcomment
$fld_parsedcomment
Definition: ApiQueryRevisionsBase.php:35
ApiQueryRevisionsBase\run
run(ApiPageSet $resultPageSet=null)
ApiBase\PARAM_HELP_MSG_PER_VALUE
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
Definition: ApiBase.php:157
ApiQueryBase\userCanSeeRevDel
userCanSeeRevDel()
Check whether the current user has permission to view revision-deleted fields.
Definition: ApiQueryBase.php:602
ApiQueryRevisionsBase\$fld_size
$fld_size
Definition: ApiQueryRevisionsBase.php:34
Revision\DELETED_TEXT
const DELETED_TEXT
Definition: Revision.php:47
Revision\userCan
userCan( $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
Definition: Revision.php:1187
ApiBase\LIMIT_SML1
const LIMIT_SML1
Slow query, standard limit.
Definition: ApiBase.php:238
ApiQueryRevisionsBase\$generateXML
$generateXML
Definition: ApiQueryRevisionsBase.php:30