MediaWiki REL1_29
ApiQueryRevisionsBase.php
Go to the documentation of this file.
1<?php
33
36
37 protected $fld_ids = false, $fld_flags = false, $fld_timestamp = false,
38 $fld_size = false, $fld_sha1 = false, $fld_comment = false,
39 $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
40 $fld_content = false, $fld_tags = false, $fld_contentmodel = false, $fld_parsetree = false;
41
42 public function execute() {
43 $this->run();
44 }
45
46 public function executeGenerator( $resultPageSet ) {
47 $this->run( $resultPageSet );
48 }
49
54 abstract protected function run( ApiPageSet $resultPageSet = null );
55
61 protected function parseParameters( $params ) {
62 if ( !is_null( $params['difftotext'] ) ) {
63 $this->difftotext = $params['difftotext'];
64 $this->difftotextpst = $params['difftotextpst'];
65 } elseif ( !is_null( $params['diffto'] ) ) {
66 if ( $params['diffto'] == 'cur' ) {
67 $params['diffto'] = 0;
68 }
69 if ( ( !ctype_digit( $params['diffto'] ) || $params['diffto'] < 0 )
70 && $params['diffto'] != 'prev' && $params['diffto'] != 'next'
71 ) {
72 $p = $this->getModulePrefix();
73 $this->dieWithError( [ 'apierror-baddiffto', $p ], 'diffto' );
74 }
75 // Check whether the revision exists and is readable,
76 // DifferenceEngine returns a rather ambiguous empty
77 // string if that's not the case
78 if ( $params['diffto'] != 0 ) {
79 $difftoRev = Revision::newFromId( $params['diffto'] );
80 if ( !$difftoRev ) {
81 $this->dieWithError( [ 'apierror-nosuchrevid', $params['diffto'] ] );
82 }
83 if ( !$difftoRev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
84 $this->addWarning( [ 'apiwarn-difftohidden', $difftoRev->getId() ] );
85 $params['diffto'] = null;
86 }
87 }
88 $this->diffto = $params['diffto'];
89 }
90
91 $prop = array_flip( $params['prop'] );
92
93 $this->fld_ids = isset( $prop['ids'] );
94 $this->fld_flags = isset( $prop['flags'] );
95 $this->fld_timestamp = isset( $prop['timestamp'] );
96 $this->fld_comment = isset( $prop['comment'] );
97 $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
98 $this->fld_size = isset( $prop['size'] );
99 $this->fld_sha1 = isset( $prop['sha1'] );
100 $this->fld_content = isset( $prop['content'] );
101 $this->fld_contentmodel = isset( $prop['contentmodel'] );
102 $this->fld_userid = isset( $prop['userid'] );
103 $this->fld_user = isset( $prop['user'] );
104 $this->fld_tags = isset( $prop['tags'] );
105 $this->fld_parsetree = isset( $prop['parsetree'] );
106
107 if ( !empty( $params['contentformat'] ) ) {
108 $this->contentFormat = $params['contentformat'];
109 }
110
111 $this->limit = $params['limit'];
112
113 $this->fetchContent = $this->fld_content || !is_null( $this->diffto )
114 || !is_null( $this->difftotext ) || $this->fld_parsetree;
115
116 $smallLimit = false;
117 if ( $this->fetchContent ) {
118 $smallLimit = true;
119 $this->expandTemplates = $params['expandtemplates'];
120 $this->generateXML = $params['generatexml'];
121 $this->parseContent = $params['parse'];
122 if ( $this->parseContent ) {
123 // Must manually initialize unset limit
124 if ( is_null( $this->limit ) ) {
125 $this->limit = 1;
126 }
127 }
128 if ( isset( $params['section'] ) ) {
129 $this->section = $params['section'];
130 } else {
131 $this->section = false;
132 }
133 }
134
135 $userMax = $this->parseContent ? 1 : ( $smallLimit ? ApiBase::LIMIT_SML1 : ApiBase::LIMIT_BIG1 );
136 $botMax = $this->parseContent ? 1 : ( $smallLimit ? ApiBase::LIMIT_SML2 : ApiBase::LIMIT_BIG2 );
137 if ( $this->limit == 'max' ) {
138 $this->limit = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
139 if ( $this->setParsedLimit ) {
140 $this->getResult()->addParsedLimit( $this->getModuleName(), $this->limit );
141 }
142 }
143
144 if ( is_null( $this->limit ) ) {
145 $this->limit = 10;
146 }
147 $this->validateLimit( 'limit', $this->limit, 1, $userMax, $botMax );
148 }
149
157 protected function extractRevisionInfo( Revision $revision, $row ) {
158 $title = $revision->getTitle();
159 $user = $this->getUser();
160 $vals = [];
161 $anyHidden = false;
162
163 if ( $this->fld_ids ) {
164 $vals['revid'] = intval( $revision->getId() );
165 if ( !is_null( $revision->getParentId() ) ) {
166 $vals['parentid'] = intval( $revision->getParentId() );
167 }
168 }
169
170 if ( $this->fld_flags ) {
171 $vals['minor'] = $revision->isMinor();
172 }
173
174 if ( $this->fld_user || $this->fld_userid ) {
175 if ( $revision->isDeleted( Revision::DELETED_USER ) ) {
176 $vals['userhidden'] = true;
177 $anyHidden = true;
178 }
179 if ( $revision->userCan( Revision::DELETED_USER, $user ) ) {
180 if ( $this->fld_user ) {
181 $vals['user'] = $revision->getUserText( Revision::RAW );
182 }
183 $userid = $revision->getUser( Revision::RAW );
184 if ( !$userid ) {
185 $vals['anon'] = true;
186 }
187
188 if ( $this->fld_userid ) {
189 $vals['userid'] = $userid;
190 }
191 }
192 }
193
194 if ( $this->fld_timestamp ) {
195 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $revision->getTimestamp() );
196 }
197
198 if ( $this->fld_size ) {
199 if ( !is_null( $revision->getSize() ) ) {
200 $vals['size'] = intval( $revision->getSize() );
201 } else {
202 $vals['size'] = 0;
203 }
204 }
205
206 if ( $this->fld_sha1 ) {
207 if ( $revision->isDeleted( Revision::DELETED_TEXT ) ) {
208 $vals['sha1hidden'] = true;
209 $anyHidden = true;
210 }
211 if ( $revision->userCan( Revision::DELETED_TEXT, $user ) ) {
212 if ( $revision->getSha1() != '' ) {
213 $vals['sha1'] = Wikimedia\base_convert( $revision->getSha1(), 36, 16, 40 );
214 } else {
215 $vals['sha1'] = '';
216 }
217 }
218 }
219
220 if ( $this->fld_contentmodel ) {
221 $vals['contentmodel'] = $revision->getContentModel();
222 }
223
224 if ( $this->fld_comment || $this->fld_parsedcomment ) {
225 if ( $revision->isDeleted( Revision::DELETED_COMMENT ) ) {
226 $vals['commenthidden'] = true;
227 $anyHidden = true;
228 }
229 if ( $revision->userCan( Revision::DELETED_COMMENT, $user ) ) {
230 $comment = $revision->getComment( Revision::RAW );
231
232 if ( $this->fld_comment ) {
233 $vals['comment'] = $comment;
234 }
235
236 if ( $this->fld_parsedcomment ) {
237 $vals['parsedcomment'] = Linker::formatComment( $comment, $title );
238 }
239 }
240 }
241
242 if ( $this->fld_tags ) {
243 if ( $row->ts_tags ) {
244 $tags = explode( ',', $row->ts_tags );
245 ApiResult::setIndexedTagName( $tags, 'tag' );
246 $vals['tags'] = $tags;
247 } else {
248 $vals['tags'] = [];
249 }
250 }
251
252 $content = null;
254 if ( $this->fetchContent ) {
255 $content = $revision->getContent( Revision::FOR_THIS_USER, $this->getUser() );
256 // Expand templates after getting section content because
257 // template-added sections don't count and Parser::preprocess()
258 // will have less input
259 if ( $content && $this->section !== false ) {
260 $content = $content->getSection( $this->section, false );
261 if ( !$content ) {
262 $this->dieWithError(
263 [
264 'apierror-nosuchsection-what',
265 wfEscapeWikiText( $this->section ),
266 $this->msg( 'revid', $revision->getId() )
267 ],
268 'nosuchsection'
269 );
270 }
271 }
272 if ( $revision->isDeleted( Revision::DELETED_TEXT ) ) {
273 $vals['texthidden'] = true;
274 $anyHidden = true;
275 } elseif ( !$content ) {
276 $vals['textmissing'] = true;
277 }
278 }
279 if ( $this->fld_parsetree || ( $this->fld_content && $this->generateXML ) ) {
280 if ( $content ) {
281 if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) {
282 $t = $content->getNativeData(); # note: don't set $text
283
284 $wgParser->startExternalParse(
285 $title,
286 ParserOptions::newFromContext( $this->getContext() ),
287 Parser::OT_PREPROCESS
288 );
289 $dom = $wgParser->preprocessToDom( $t );
290 if ( is_callable( [ $dom, 'saveXML' ] ) ) {
291 $xml = $dom->saveXML();
292 } else {
293 $xml = $dom->__toString();
294 }
295 $vals['parsetree'] = $xml;
296 } else {
297 $vals['badcontentformatforparsetree'] = true;
298 $this->addWarning(
299 [
300 'apierror-parsetree-notwikitext-title',
301 wfEscapeWikiText( $title->getPrefixedText() ),
302 $content->getModel()
303 ],
304 'parsetree-notwikitext'
305 );
306 }
307 }
308 }
309
310 if ( $this->fld_content && $content ) {
311 $text = null;
312
313 if ( $this->expandTemplates && !$this->parseContent ) {
314 # XXX: implement template expansion for all content types in ContentHandler?
315 if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) {
316 $text = $content->getNativeData();
317
318 $text = $wgParser->preprocess(
319 $text,
320 $title,
321 ParserOptions::newFromContext( $this->getContext() )
322 );
323 } else {
324 $this->addWarning( [
325 'apierror-templateexpansion-notwikitext',
326 wfEscapeWikiText( $title->getPrefixedText() ),
327 $content->getModel()
328 ] );
329 $vals['badcontentformat'] = true;
330 $text = false;
331 }
332 }
333 if ( $this->parseContent ) {
334 $po = $content->getParserOutput(
335 $title,
336 $revision->getId(),
337 ParserOptions::newFromContext( $this->getContext() )
338 );
339 $text = $po->getText();
340 }
341
342 if ( $text === null ) {
343 $format = $this->contentFormat ?: $content->getDefaultFormat();
344 $model = $content->getModel();
345
346 if ( !$content->isSupportedFormat( $format ) ) {
347 $name = wfEscapeWikiText( $title->getPrefixedText() );
348 $this->addWarning( [ 'apierror-badformat', $this->contentFormat, $model, $name ] );
349 $vals['badcontentformat'] = true;
350 $text = false;
351 } else {
352 $text = $content->serialize( $format );
353 // always include format and model.
354 // Format is needed to deserialize, model is needed to interpret.
355 $vals['contentformat'] = $format;
356 $vals['contentmodel'] = $model;
357 }
358 }
359
360 if ( $text !== false ) {
361 ApiResult::setContentValue( $vals, 'content', $text );
362 }
363 }
364
365 if ( $content && ( !is_null( $this->diffto ) || !is_null( $this->difftotext ) ) ) {
366 static $n = 0; // Number of uncached diffs we've had
367
368 if ( $n < $this->getConfig()->get( 'APIMaxUncachedDiffs' ) ) {
369 $vals['diff'] = [];
370 $context = new DerivativeContext( $this->getContext() );
371 $context->setTitle( $title );
372 $handler = $revision->getContentHandler();
373
374 if ( !is_null( $this->difftotext ) ) {
375 $model = $title->getContentModel();
376
377 if ( $this->contentFormat
378 && !ContentHandler::getForModelID( $model )->isSupportedFormat( $this->contentFormat )
379 ) {
380 $name = wfEscapeWikiText( $title->getPrefixedText() );
381 $this->addWarning( [ 'apierror-badformat', $this->contentFormat, $model, $name ] );
382 $vals['diff']['badcontentformat'] = true;
383 $engine = null;
384 } else {
385 $difftocontent = ContentHandler::makeContent(
386 $this->difftotext,
387 $title,
388 $model,
389 $this->contentFormat
390 );
391
392 if ( $this->difftotextpst ) {
393 $popts = ParserOptions::newFromContext( $this->getContext() );
394 $difftocontent = $difftocontent->preSaveTransform( $title, $user, $popts );
395 }
396
397 $engine = $handler->createDifferenceEngine( $context );
398 $engine->setContent( $content, $difftocontent );
399 }
400 } else {
401 $engine = $handler->createDifferenceEngine( $context, $revision->getId(), $this->diffto );
402 $vals['diff']['from'] = $engine->getOldid();
403 $vals['diff']['to'] = $engine->getNewid();
404 }
405 if ( $engine ) {
406 $difftext = $engine->getDiffBody();
407 ApiResult::setContentValue( $vals['diff'], 'body', $difftext );
408 if ( !$engine->wasCacheHit() ) {
409 $n++;
410 }
411 }
412 } else {
413 $vals['diff']['notcached'] = true;
414 }
415 }
416
417 if ( $anyHidden && $revision->isDeleted( Revision::DELETED_RESTRICTED ) ) {
418 $vals['suppressed'] = true;
419 }
420
421 return $vals;
422 }
423
424 public function getCacheMode( $params ) {
425 if ( $this->userCanSeeRevDel() ) {
426 return 'private';
427 }
428
429 return 'public';
430 }
431
432 public function getAllowedParams() {
433 return [
434 'prop' => [
436 ApiBase::PARAM_DFLT => 'ids|timestamp|flags|comment|user',
438 'ids',
439 'flags',
440 'timestamp',
441 'user',
442 'userid',
443 'size',
444 'sha1',
445 'contentmodel',
446 'comment',
447 'parsedcomment',
448 'content',
449 'tags',
450 'parsetree',
451 ],
452 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-prop',
454 'ids' => 'apihelp-query+revisions+base-paramvalue-prop-ids',
455 'flags' => 'apihelp-query+revisions+base-paramvalue-prop-flags',
456 'timestamp' => 'apihelp-query+revisions+base-paramvalue-prop-timestamp',
457 'user' => 'apihelp-query+revisions+base-paramvalue-prop-user',
458 'userid' => 'apihelp-query+revisions+base-paramvalue-prop-userid',
459 'size' => 'apihelp-query+revisions+base-paramvalue-prop-size',
460 'sha1' => 'apihelp-query+revisions+base-paramvalue-prop-sha1',
461 'contentmodel' => 'apihelp-query+revisions+base-paramvalue-prop-contentmodel',
462 'comment' => 'apihelp-query+revisions+base-paramvalue-prop-comment',
463 'parsedcomment' => 'apihelp-query+revisions+base-paramvalue-prop-parsedcomment',
464 'content' => 'apihelp-query+revisions+base-paramvalue-prop-content',
465 'tags' => 'apihelp-query+revisions+base-paramvalue-prop-tags',
466 'parsetree' => [ 'apihelp-query+revisions+base-paramvalue-prop-parsetree',
468 ],
469 ],
470 'limit' => [
471 ApiBase::PARAM_TYPE => 'limit',
475 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-limit',
476 ],
477 'expandtemplates' => [
478 ApiBase::PARAM_DFLT => false,
479 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-expandtemplates',
480 ],
481 'generatexml' => [
482 ApiBase::PARAM_DFLT => false,
484 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-generatexml',
485 ],
486 'parse' => [
487 ApiBase::PARAM_DFLT => false,
488 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-parse',
489 ],
490 'section' => [
491 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-section',
492 ],
493 'diffto' => [
494 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-diffto',
495 ],
496 'difftotext' => [
497 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotext',
498 ],
499 'difftotextpst' => [
500 ApiBase::PARAM_DFLT => false,
501 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotextpst',
502 ],
503 'contentformat' => [
505 ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-contentformat',
506 ],
507 ];
508 }
509
510}
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getContext()
$wgParser
Definition Setup.php:796
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
Definition ApiBase.php:498
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
Definition ApiBase.php:100
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition ApiBase.php:109
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition ApiBase.php:94
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition ApiBase.php:1796
getMain()
Get the main module.
Definition ApiBase.php:506
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
Definition ApiBase.php:91
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition ApiBase.php:52
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:160
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition ApiBase.php:103
const LIMIT_BIG1
Fast query, standard limit.
Definition ApiBase.php:203
const LIMIT_SML2
Slow query, apihighlimits limit.
Definition ApiBase.php:209
validateLimit( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
Validate the value against the minimum and user/bot maximum limits.
Definition ApiBase.php:1407
getResult()
Get the result object.
Definition ApiBase.php:610
const LIMIT_SML1
Slow query, standard limit.
Definition ApiBase.php:207
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition ApiBase.php:128
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
Definition ApiBase.php:1720
const LIMIT_BIG2
Fast query, apihighlimits limit.
Definition ApiBase.php:205
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:490
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition ApiBase.php:55
This class contains a list of pages that the client has requested.
userCanSeeRevDel()
Check whether the current user has permission to view revision-deleted fields.
A base class for functions common to producing a list of revisions.
executeGenerator( $resultPageSet)
Execute this module as a generator.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
parseParameters( $params)
Parse the parameters into the various instance fields.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
extractRevisionInfo(Revision $revision, $row)
Extract information from the Revision.
run(ApiPageSet $resultPageSet=null)
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
static getAllContentFormats()
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
static getForModelID( $modelId)
Returns the ContentHandler singleton for the given model ID.
getUser()
Get the User object.
getConfig()
Get the Config object.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
An IContextSource implementation which will inherit context from another source but allow individual ...
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:1094
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
getUserText( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision's username if it's available to the specified audience.
Definition Revision.php:903
getTitle()
Returns the title of the page associated with this entry or null.
Definition Revision.php:809
getSize()
Returns the length of the text in this revision, or null if unknown.
Definition Revision.php:789
getId()
Get revision ID.
Definition Revision.php:735
getContentHandler()
Returns the content handler appropriate for this revision's content model.
getComment( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision comment if it's available to the specified audience.
Definition Revision.php:947
getContentModel()
Returns the content model for this revision.
getUser( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision's user id if it's available to the specified audience.
Definition Revision.php:869
getContent( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision content if it's available to the specified audience.
const DELETED_USER
Definition Revision.php:92
const DELETED_TEXT
Definition Revision.php:90
getSha1()
Returns the base36 sha1 of the text in this revision, or null if unknown.
Definition Revision.php:798
const DELETED_RESTRICTED
Definition Revision.php:93
userCan( $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
getParentId()
Get parent revision ID (the original previous page revision)
Definition Revision.php:780
const RAW
Definition Revision.php:100
isDeleted( $field)
const DELETED_COMMENT
Definition Revision.php:91
const FOR_THIS_USER
Definition Revision.php:99
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
Definition Revision.php:116
per default it will return the text for text based content
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
const CONTENT_MODEL_WIKITEXT
Definition Defines.php:233
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 local account $user
Definition hooks.txt:249
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2728
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
Definition hooks.txt:1100
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:964
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:304
the value to return A Title object or null for latest all implement SearchIndexField $engine
Definition hooks.txt:2798
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
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
title
$params