MediaWiki REL1_27
ParserOptions.php
Go to the documentation of this file.
1<?php
33
38
43
48
53
57 private $mDateFormat = null;
58
62 private $mEditSection = true;
63
68
72 private $mTidy = false;
73
77 private $mInterfaceMessage = false;
78
82 private $mTargetLanguage = null;
83
88
93
98
103
108
113
117 private $mRemoveComments = true;
118
123 [ 'Parser', 'statelessFetchRevision' ];
124
129 [ 'Parser', 'statelessFetchTemplate' ];
130
134 private $mEnableLimitReport = false;
135
139 private $mTimestamp;
140
145
151
155 private $mPreSaveTransform = true;
156
161
166
171
175 private $mThumbSize;
176
181
185 private $mUserLang;
186
191 private $mUser;
192
196 private $mIsPreview = false;
197
201 private $mIsSectionPreview = false;
202
206 private $mIsPrintable = false;
207
211 private $mExtraKey = '';
212
216 private $onAccessCallback = null;
217
223 private $redirectTarget = null;
224
238 private $allowUnsafeRawHtml = true;
239
240 public function getInterwikiMagic() {
242 }
243
244 public function getAllowExternalImages() {
246 }
247
248 public function getAllowExternalImagesFrom() {
250 }
251
252 public function getEnableImageWhitelist() {
254 }
255
256 public function getEditSection() {
257 return $this->mEditSection;
258 }
259
260 public function getNumberHeadings() {
261 $this->optionUsed( 'numberheadings' );
262
264 }
265
266 public function getAllowSpecialInclusion() {
268 }
269
270 public function getTidy() {
271 return $this->mTidy;
272 }
273
274 public function getInterfaceMessage() {
276 }
277
278 public function getTargetLanguage() {
280 }
281
282 public function getMaxIncludeSize() {
284 }
285
286 public function getMaxPPNodeCount() {
288 }
289
290 public function getMaxGeneratedPPNodeCount() {
292 }
293
294 public function getMaxPPExpandDepth() {
296 }
297
298 public function getMaxTemplateDepth() {
300 }
301
302 /* @since 1.20 */
306
307 public function getRemoveComments() {
309 }
310
311 /* @since 1.24 */
312 public function getCurrentRevisionCallback() {
314 }
315
316 public function getTemplateCallback() {
318 }
319
320 public function getEnableLimitReport() {
322 }
323
324 public function getCleanSignatures() {
326 }
327
328 public function getExternalLinkTarget() {
330 }
331
335
336 public function getDisableTitleConversion() {
338 }
339
340 public function getThumbSize() {
341 $this->optionUsed( 'thumbsize' );
342
343 return $this->mThumbSize;
344 }
345
346 public function getStubThreshold() {
347 $this->optionUsed( 'stubthreshold' );
348
350 }
351
352 public function getIsPreview() {
353 return $this->mIsPreview;
354 }
355
356 public function getIsSectionPreview() {
358 }
359
360 public function getIsPrintable() {
361 $this->optionUsed( 'printable' );
362
363 return $this->mIsPrintable;
364 }
365
366 public function getUser() {
367 return $this->mUser;
368 }
369
370 public function getPreSaveTransform() {
372 }
373
374 public function getDateFormat() {
375 $this->optionUsed( 'dateformat' );
376 if ( !isset( $this->mDateFormat ) ) {
377 $this->mDateFormat = $this->mUser->getDatePreference();
378 }
379 return $this->mDateFormat;
380 }
381
382 public function getTimestamp() {
383 if ( !isset( $this->mTimestamp ) ) {
384 $this->mTimestamp = wfTimestampNow();
385 }
386 return $this->mTimestamp;
387 }
388
406 public function getUserLangObj() {
407 $this->optionUsed( 'userlang' );
408 return $this->mUserLang;
409 }
410
423 public function getUserLang() {
424 return $this->getUserLangObj()->getCode();
425 }
426
431 public function getAllowUnsafeRawHtml() {
433 }
434
435 public function setInterwikiMagic( $x ) {
436 return wfSetVar( $this->mInterwikiMagic, $x );
437 }
438
439 public function setAllowExternalImages( $x ) {
440 return wfSetVar( $this->mAllowExternalImages, $x );
441 }
442
443 public function setAllowExternalImagesFrom( $x ) {
444 return wfSetVar( $this->mAllowExternalImagesFrom, $x );
445 }
446
447 public function setEnableImageWhitelist( $x ) {
448 return wfSetVar( $this->mEnableImageWhitelist, $x );
449 }
450
451 public function setDateFormat( $x ) {
452 return wfSetVar( $this->mDateFormat, $x );
453 }
454
455 public function setEditSection( $x ) {
456 return wfSetVar( $this->mEditSection, $x );
457 }
458
459 public function setNumberHeadings( $x ) {
460 return wfSetVar( $this->mNumberHeadings, $x );
461 }
462
463 public function setAllowSpecialInclusion( $x ) {
464 return wfSetVar( $this->mAllowSpecialInclusion, $x );
465 }
466
467 public function setTidy( $x ) {
468 return wfSetVar( $this->mTidy, $x );
469 }
470
471 public function setInterfaceMessage( $x ) {
472 return wfSetVar( $this->mInterfaceMessage, $x );
473 }
474
475 public function setTargetLanguage( $x ) {
476 return wfSetVar( $this->mTargetLanguage, $x, true );
477 }
478
479 public function setMaxIncludeSize( $x ) {
480 return wfSetVar( $this->mMaxIncludeSize, $x );
481 }
482
483 public function setMaxPPNodeCount( $x ) {
484 return wfSetVar( $this->mMaxPPNodeCount, $x );
485 }
486
487 public function setMaxGeneratedPPNodeCount( $x ) {
488 return wfSetVar( $this->mMaxGeneratedPPNodeCount, $x );
489 }
490
491 public function setMaxTemplateDepth( $x ) {
492 return wfSetVar( $this->mMaxTemplateDepth, $x );
493 }
494
495 /* @since 1.20 */
496 public function setExpensiveParserFunctionLimit( $x ) {
497 return wfSetVar( $this->mExpensiveParserFunctionLimit, $x );
498 }
499
500 public function setRemoveComments( $x ) {
501 return wfSetVar( $this->mRemoveComments, $x );
502 }
503
504 /* @since 1.24 */
505 public function setCurrentRevisionCallback( $x ) {
506 return wfSetVar( $this->mCurrentRevisionCallback, $x );
507 }
508
509 public function setTemplateCallback( $x ) {
510 return wfSetVar( $this->mTemplateCallback, $x );
511 }
512
513 public function enableLimitReport( $x = true ) {
514 return wfSetVar( $this->mEnableLimitReport, $x );
515 }
516
517 public function setTimestamp( $x ) {
518 return wfSetVar( $this->mTimestamp, $x );
519 }
520
521 public function setCleanSignatures( $x ) {
522 return wfSetVar( $this->mCleanSignatures, $x );
523 }
524
525 public function setExternalLinkTarget( $x ) {
526 return wfSetVar( $this->mExternalLinkTarget, $x );
527 }
528
529 public function disableContentConversion( $x = true ) {
530 return wfSetVar( $this->mDisableContentConversion, $x );
531 }
532
533 public function disableTitleConversion( $x = true ) {
534 return wfSetVar( $this->mDisableTitleConversion, $x );
535 }
536
537 public function setUserLang( $x ) {
538 if ( is_string( $x ) ) {
539 $x = Language::factory( $x );
540 }
541
542 return wfSetVar( $this->mUserLang, $x );
543 }
544
545 public function setThumbSize( $x ) {
546 return wfSetVar( $this->mThumbSize, $x );
547 }
548
549 public function setStubThreshold( $x ) {
550 return wfSetVar( $this->mStubThreshold, $x );
551 }
552
553 public function setPreSaveTransform( $x ) {
554 return wfSetVar( $this->mPreSaveTransform, $x );
555 }
556
557 public function setIsPreview( $x ) {
558 return wfSetVar( $this->mIsPreview, $x );
559 }
560
561 public function setIsSectionPreview( $x ) {
562 return wfSetVar( $this->mIsSectionPreview, $x );
563 }
564
565 public function setIsPrintable( $x ) {
566 return wfSetVar( $this->mIsPrintable, $x );
567 }
568
574 public function setAllowUnsafeRawHtml( $x ) {
575 return wfSetVar( $this->allowUnsafeRawHtml, $x );
576 }
577
588 function setRedirectTarget( $title ) {
589 $this->redirectTarget = $title;
590 }
591
598 function getRedirectTarget() {
600 }
601
606 public function addExtraKey( $key ) {
607 $this->mExtraKey .= '!' . $key;
608 }
609
615 public function __construct( $user = null, $lang = null ) {
616 if ( $user === null ) {
618 if ( $wgUser === null ) {
619 $user = new User;
620 } else {
621 $user = $wgUser;
622 }
623 }
624 if ( $lang === null ) {
627 $wgLang->_unstub();
628 }
629 $lang = $wgLang;
630 }
631 $this->initialiseFromUser( $user, $lang );
632 }
633
639 public static function newFromAnon() {
641 return new ParserOptions( new User, $wgContLang );
642 }
643
651 public static function newFromUser( $user ) {
652 return new ParserOptions( $user );
653 }
654
662 public static function newFromUserAndLang( User $user, Language $lang ) {
663 return new ParserOptions( $user, $lang );
664 }
665
672 public static function newFromContext( IContextSource $context ) {
673 return new ParserOptions( $context->getUser(), $context->getLanguage() );
674 }
675
682 private function initialiseFromUser( $user, $lang ) {
688
689 // *UPDATE* ParserOptions::matches() if any of this changes as needed
690 $this->mInterwikiMagic = $wgInterwikiMagic;
691 $this->mAllowExternalImages = $wgAllowExternalImages;
692 $this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom;
693 $this->mEnableImageWhitelist = $wgEnableImageWhitelist;
694 $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion;
695 $this->mMaxIncludeSize = $wgMaxArticleSize * 1024;
696 $this->mMaxPPNodeCount = $wgMaxPPNodeCount;
697 $this->mMaxGeneratedPPNodeCount = $wgMaxGeneratedPPNodeCount;
698 $this->mMaxPPExpandDepth = $wgMaxPPExpandDepth;
699 $this->mMaxTemplateDepth = $wgMaxTemplateDepth;
700 $this->mExpensiveParserFunctionLimit = $wgExpensiveParserFunctionLimit;
701 $this->mCleanSignatures = $wgCleanSignatures;
702 $this->mExternalLinkTarget = $wgExternalLinkTarget;
703 $this->mDisableContentConversion = $wgDisableLangConversion;
704 $this->mDisableTitleConversion = $wgDisableLangConversion || $wgDisableTitleConversion;
705
706 $this->mUser = $user;
707 $this->mNumberHeadings = $user->getOption( 'numberheadings' );
708 $this->mThumbSize = $user->getOption( 'thumbsize' );
709 $this->mStubThreshold = $user->getStubThreshold();
710 $this->mUserLang = $lang;
711
712 }
713
723 public function matches( ParserOptions $other ) {
724 $fields = array_keys( get_class_vars( __CLASS__ ) );
725 $fields = array_diff( $fields, [
726 'mEnableLimitReport', // only effects HTML comments
727 'onAccessCallback', // only used for ParserOutput option tracking
728 ] );
729 foreach ( $fields as $field ) {
730 if ( !is_object( $this->$field ) && $this->$field !== $other->$field ) {
731 return false;
732 }
733 }
734 // Check the object and lazy-loaded options
735 return (
736 $this->mUserLang->getCode() === $other->mUserLang->getCode() &&
737 $this->getDateFormat() === $other->getDateFormat()
738 );
739 }
740
746 public function registerWatcher( $callback ) {
747 $this->onAccessCallback = $callback;
748 }
749
758 public function optionUsed( $optionName ) {
759 if ( $this->onAccessCallback ) {
760 call_user_func( $this->onAccessCallback, $optionName );
761 }
762 }
763
770 public static function legacyOptions() {
771 return [
772 'stubthreshold',
773 'numberheadings',
774 'userlang',
775 'thumbsize',
776 'editsection',
777 'printable'
778 ];
779 }
780
797 public function optionsHash( $forOptions, $title = null ) {
799
800 // FIXME: Once the cache key is reorganized this argument
801 // can be dropped. It was used when the math extension was
802 // part of core.
803 $confstr = '*';
804
805 // Space assigned for the stubthreshold but unused
806 // since it disables the parser cache, its value will always
807 // be 0 when this function is called by parsercache.
808 if ( in_array( 'stubthreshold', $forOptions ) ) {
809 $confstr .= '!' . $this->mStubThreshold;
810 } else {
811 $confstr .= '!*';
812 }
813
814 if ( in_array( 'dateformat', $forOptions ) ) {
815 $confstr .= '!' . $this->getDateFormat();
816 }
817
818 if ( in_array( 'numberheadings', $forOptions ) ) {
819 $confstr .= '!' . ( $this->mNumberHeadings ? '1' : '' );
820 } else {
821 $confstr .= '!*';
822 }
823
824 if ( in_array( 'userlang', $forOptions ) ) {
825 $confstr .= '!' . $this->mUserLang->getCode();
826 } else {
827 $confstr .= '!*';
828 }
829
830 if ( in_array( 'thumbsize', $forOptions ) ) {
831 $confstr .= '!' . $this->mThumbSize;
832 } else {
833 $confstr .= '!*';
834 }
835
836 // add in language specific options, if any
837 // @todo FIXME: This is just a way of retrieving the url/user preferred variant
838 if ( !is_null( $title ) ) {
839 $confstr .= $title->getPageLanguage()->getExtraHashOptions();
840 } else {
842 $confstr .= $wgContLang->getExtraHashOptions();
843 }
844
845 $confstr .= $wgRenderHashAppend;
846
847 // @note: as of Feb 2015, core never sets the editsection flag, since it uses
848 // <mw:editsection> tags to inject editsections on the fly. However, extensions
849 // may be using it by calling ParserOption::optionUsed resp. ParserOutput::registerOption
850 // directly. At least Wikibase does at this point in time.
851 if ( !in_array( 'editsection', $forOptions ) ) {
852 $confstr .= '!*';
853 } elseif ( !$this->mEditSection ) {
854 $confstr .= '!edit=0';
855 }
856
857 if ( $this->mIsPrintable && in_array( 'printable', $forOptions ) ) {
858 $confstr .= '!printable=1';
859 }
860
861 if ( $this->mExtraKey != '' ) {
862 $confstr .= $this->mExtraKey;
863 }
864
865 // Give a chance for extensions to modify the hash, if they have
866 // extra options or other effects on the parser cache.
867 Hooks::run( 'PageRenderingHash', [ &$confstr, $this->getUser(), &$forOptions ] );
868
869 // Make it a valid memcached key fragment
870 $confstr = str_replace( ' ', '_', $confstr );
871
872 return $confstr;
873 }
874
885 public function setupFakeRevision( $title, $content, $user ) {
886 $oldCallback = $this->setCurrentRevisionCallback(
887 function (
888 $titleToCheck, $parser = false ) use ( $title, $content, $user, &$oldCallback
889 ) {
890 if ( $titleToCheck->equals( $title ) ) {
891 return new Revision( [
892 'page' => $title->getArticleID(),
893 'user_text' => $user->getName(),
894 'user' => $user->getId(),
895 'parent_id' => $title->getLatestRevID(),
896 'title' => $title,
897 'content' => $content
898 ] );
899 } else {
900 return call_user_func( $oldCallback, $titleToCheck, $parser );
901 }
902 }
903 );
904
906 $wgHooks['TitleExists'][] =
907 function ( $titleToCheck, &$exists ) use ( $title ) {
908 if ( $titleToCheck->equals( $title ) ) {
909 $exists = true;
910 }
911 };
912 end( $wgHooks['TitleExists'] );
913 $key = key( $wgHooks['TitleExists'] );
914 LinkCache::singleton()->clearBadLink( $title->getPrefixedDBkey() );
915 return new ScopedCallback( function () use ( $title, $key ) {
917 unset( $wgHooks['TitleExists'][$key] );
918 LinkCache::singleton()->clearLink( $title );
919 } );
920 }
921}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
$wgMaxTemplateDepth
Maximum recursion depth for templates within templates.
$wgMaxPPNodeCount
A complexity limit on template expansion: the maximum number of nodes visited by PPFrame::expand()
$wgMaxArticleSize
Maximum article size in kilobytes.
$wgMaxGeneratedPPNodeCount
A complexity limit on template expansion: the maximum number of elements generated by Preprocessor::p...
$wgEnableImageWhitelist
If $wgAllowExternalImages is false, you can allow an on-wiki whitelist of regular expression fragment...
$wgCleanSignatures
If true, removes (by substituting) templates in signatures.
$wgRenderHashAppend
Append a configured value to the parser cache and the sitenotice key so that they can be kept separat...
$wgMaxPPExpandDepth
$wgDisableLangConversion
Whether to enable language variant conversion.
$wgAllowSpecialInclusion
Allow special page inclusions such as {{Special:Allpages}}.
$wgAllowExternalImagesFrom
If the above is false, you can specify an exception here.
$wgInterwikiMagic
Treat language links as magic connectors, not inline links.
$wgAllowExternalImages
Whether to allow inline image pointing to other websites.
$wgExternalLinkTarget
Set a default target for external links, e.g.
$wgExpensiveParserFunctionLimit
Maximum number of calls per parse to expensive parser functions such as PAGESINCATEGORY.
$wgDisableTitleConversion
Whether to enable language variant conversion for links.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
$wgUser
Definition Setup.php:794
Internationalisation code.
Definition Language.php:39
static singleton()
Get an instance of this class.
Definition LinkCache.php:61
Set options of the Parser.
setAllowExternalImagesFrom( $x)
disableTitleConversion( $x=true)
$mCurrentRevisionCallback
Callback for current revision fetching.
$mEnableImageWhitelist
If not or it doesn't match, should we check an on-wiki whitelist?
$mMaxTemplateDepth
Maximum recursion depth for templates within templates.
$mAllowExternalImages
Allow external images inline?
$mIsPrintable
Parsing the printable version of the page?
getRedirectTarget()
Get the previously-set redirect target.
$mMaxPPNodeCount
Maximum number of nodes touched by PPFrame::expand()
$mInterwikiMagic
Interlanguage links are removed and returned in an array.
enableLimitReport( $x=true)
$mMaxGeneratedPPNodeCount
Maximum number of nodes generated by Preprocessor::preprocessToObj()
$mDisableTitleConversion
Whether title conversion should be disabled.
matches(ParserOptions $other)
Check if these options match that of another options set.
$mEnableLimitReport
Enable limit report in an HTML comment on output.
$mMaxPPExpandDepth
Maximum recursion depth in PPFrame::expand()
$mPreSaveTransform
Transform wiki markup when saving the page?
$mRemoveComments
Remove HTML comments.
setAllowExternalImages( $x)
getUserLangObj()
Get the user language used by the parser for this page and split the parser cache.
$mTemplateCallback
Callback for template fetching.
$mExternalLinkTarget
Target attribute for external links.
$mInterfaceMessage
Which lang to call for PLURAL and GRAMMAR.
$mAllowExternalImagesFrom
If not, any exception?
$onAccessCallback
Function to be called when an option is accessed.
$mNumberHeadings
Automatically number headings?
$mStubThreshold
Maximum article size of an article to be marked as "stub".
$mExpensiveParserFunctionLimit
Maximum number of calls per parse to expensive parser functions.
getExpensiveParserFunctionLimit()
$mTimestamp
Timestamp used for {{CURRENTDAY}} etc.
setCurrentRevisionCallback( $x)
$mTargetLanguage
Overrides $mInterfaceMessage with arbitrary language.
$mEditSection
Create "edit section" links?
setEnableImageWhitelist( $x)
$mThumbSize
Thumb size preferred by the user.
$mIsPreview
Parsing the page for a "preview" operation?
User $mUser
Stored user object.
optionUsed( $optionName)
Called when an option is accessed.
setRedirectTarget( $title)
Set the redirect target.
disableContentConversion( $x=true)
initialiseFromUser( $user, $lang)
Get user options.
optionsHash( $forOptions, $title=null)
Generate a hash string with the values set on these ParserOptions for the keys given in the array.
$mExtraKey
Extra key that should be present in the caching key.
setAllowSpecialInclusion( $x)
$mIsSectionPreview
Parsing the page for a "preview" operation on a single section?
$mDisableContentConversion
Whether content conversion should be disabled.
setupFakeRevision( $title, $content, $user)
Sets a hook to force that a page exists, and sets a current revision callback to return a revision wi...
static legacyOptions()
Returns the full array of options that would have been used by in 1.16.
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
$mTidy
Use tidy to cleanup output HTML?
registerWatcher( $callback)
Registers a callback for tracking which ParserOptions which are used.
addExtraKey( $key)
Extra key that should be present in the parser cache key.
static newFromAnon()
Get a ParserOptions object for an anonymous user.
static newFromUser( $user)
Get a ParserOptions object from a given user.
getUserLang()
Same as getUserLangObj() but returns a string instead.
Title null $redirectTarget
If the page being parsed is a redirect, this should hold the redirect target.
boolean $allowUnsafeRawHtml
If the wiki is configured to allow raw html ($wgRawHtml = true) is it allowed in the specific case of...
setMaxGeneratedPPNodeCount( $x)
$mUserLang
Language object of the User language.
static newFromUserAndLang(User $user, Language $lang)
Get a ParserOptions object from a given user and language.
$mCleanSignatures
Clean up signature texts?
__construct( $user=null, $lang=null)
Constructor.
$mDateFormat
Date format index.
$mMaxIncludeSize
Maximum size of template expansions, in bytes.
$mAllowSpecialInclusion
Allow inclusion of special pages?
setExpensiveParserFunctionLimit( $x)
Class for asserting that a callback happens when an dummy object leaves scope.
static isRealObject( $obj)
Returns a bool value whenever $obj is a stub object.
Represents a title within MediaWiki.
Definition Title.php:34
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:47
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
Definition design.txt:26
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
Definition design.txt:56
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
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
do that in ParserLimitReportFormat instead $parser
Definition hooks.txt:2341
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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:1040
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:944
$wgHooks['ArticleShow'][]
Definition hooks.txt:110
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
Interface for objects which can provide a MediaWiki context on request.
$context
Definition load.php:44
if(!isset( $args[0])) $lang