MediaWiki
1.28.0
|
Interface for objects which can provide a MediaWiki context on request. More...
Public Member Functions | |
canUseWikiPage () | |
Check whether a WikiPage object can be get with getWikiPage(). More... | |
exportSession () | |
Export the resolved user IP, HTTP headers, user ID, and session ID. More... | |
getConfig () | |
Get the site configuration. More... | |
getLanguage () | |
Get the Language object. More... | |
getOutput () | |
Get the OutputPage object. More... | |
getRequest () | |
Get the WebRequest object. More... | |
getSkin () | |
Get the Skin object. More... | |
getStats () | |
Get the stats object. More... | |
getTiming () | |
Get the timing object. More... | |
getTitle () | |
Get the Title object. More... | |
getUser () | |
Get the User object. More... | |
getWikiPage () | |
Get the WikiPage object. More... | |
msg () | |
Get a Message object with context set. More... | |
Interface for objects which can provide a MediaWiki context on request.
Context objects contain request-dependent objects that manage the core web request/response logic for essentially all requests to MediaWiki. The contained objects include: a) Key objects that depend (for construction/loading) on the HTTP request b) Key objects used for response building and PHP session state control c) Performance metric deltas accumulated from request execution d) The site configuration object All of the objects are useful for the vast majority of MediaWiki requests. The site configuration object is included on grounds of extreme utility, even though it should not actually depend on the web request.
More specifically, the scope of the context includes: a) Objects that represent the HTTP request/response and PHP session state b) Object representing the MediaWiki user (as determined by the HTTP request) c) Primary MediaWiki output builder objects (OutputPage, user skin object) d) The language object for the user/request e) The title and wiki page objects requested via URL (if any) f) Performance metric deltas accumulated from request execution g) The site configuration object
This class is not intended as a service-locator nor a service singleton. Objects that only depend on site configuration do not belong here (aside from Config itself). Objects that represent persistent data stores do not belong here either. Session state changes should only be propagated on shutdown by separate persistence handler objects, for example.
Definition at line 55 of file IContextSource.php.
IContextSource::canUseWikiPage | ( | ) |
Check whether a WikiPage object can be get with getWikiPage().
Callers should expect that an exception is thrown from getWikiPage() if this method returns false.
Implemented in RequestContext, DerivativeContext, and ContextSource.
Referenced by Action\getActionName().
IContextSource::exportSession | ( | ) |
Export the resolved user IP, HTTP headers, user ID, and session ID.
The result will be reasonably sized to allow for serialization.
Implemented in RequestContext, and ContextSource.
IContextSource::getConfig | ( | ) |
Get the site configuration.
Implemented in DerivativeContext, RequestContext, and ContextSource.
Referenced by MediaWiki\__construct(), CategoryViewer\__construct(), Preferences\editingPreferences(), SpecialPageFactory\executePath(), ImageGalleryBase\factory(), Preferences\generateSkinOptions(), ApiHelp\getHelp(), Preferences\getImageSizes(), Preferences\getThumbSizes(), Preferences\getTimezoneOptions(), MediaWiki\getUrlDomainDistance(), MediaWiki\preOutputCommit(), Preferences\profilePreferences(), Preferences\rcPreferences(), Preferences\renderingPreferences(), ChangesList\showCharacterDifference(), Preferences\skinPreferences(), SpecialEmailUser\submit(), and Preferences\watchlistPreferences().
IContextSource::getLanguage | ( | ) |
Get the Language object.
Implemented in RequestContext, DerivativeContext, and ContextSource.
Referenced by SpecialPageFactory\capturePath(), Preferences\datetimePreferences(), Preferences\generateSkinOptions(), ApiPageSet\getAllowedParams(), CacheHelper\getCachedNotice(), Preferences\getDateOptions(), MWDebug\getDebugInfo(), MWDebug\getFilesIncluded(), ApiHelp\getHelp(), ApiHelp\getHelpInternal(), Block\getPermissionsError(), Preferences\getTimezoneOptions(), ParserOptions\newFromContext(), Preferences\profilePreferences(), Message\setContext(), ChangesList\showCharacterDifference(), LogEventsList\showLogExtract(), Preferences\skinPreferences(), MediaWiki\Auth\AuthManagerTest\testSetDefaultUserOptions(), HTMLFileCache\useFileCache(), and Preferences\watchlistPreferences().
IContextSource::getOutput | ( | ) |
Get the OutputPage object.
Implemented in RequestContext, DerivativeContext, and ContextSource.
Referenced by SpecialPageFactory\capturePath(), ApiParse\categoriesHtml(), ApiHelp\execute(), SpecialPageFactory\executePath(), ApiHelp\getHelp(), HTMLFileCache\loadFromFileCache(), MediaWiki\preOutputCommit(), and Preferences\profilePreferences().
IContextSource::getRequest | ( | ) |
Get the WebRequest object.
Implemented in DerivativeContext, RequestContext, and ContextSource.
Referenced by SpecialPageFactory\capturePath(), SpecialPageFactory\executePath(), Action\getActionName(), CacheHelper\getCachedNotice(), MWDebug\getDebugInfo(), Block\getPermissionsError(), ChangesList\newFromContext(), MediaWiki\preOutputCommit(), Preferences\profilePreferences(), MediaWiki\run(), and HTMLFileCache\useFileCache().
IContextSource::getSkin | ( | ) |
Get the Skin object.
Implemented in RequestContext, DerivativeContext, and ContextSource.
Referenced by ApiParse\categoriesHtml(), ApiParse\execute(), and ChangesList\newFromContext().
IContextSource::getStats | ( | ) |
Get the stats object.
Implemented in ContextSource, RequestContext, and DerivativeContext.
IContextSource::getTiming | ( | ) |
Get the timing object.
Implemented in ContextSource, RequestContext, and DerivativeContext.
IContextSource::getTitle | ( | ) |
Get the Title object.
Implemented in HTMLForm, ImageListPager, AllMessagesTablePager, RequestContext, DerivativeContext, ContextSource, ProtectedTitlesPager, and ImageHistoryPseudoPager.
Referenced by CacheHelper\getCachedNotice(), HTMLFileCache\loadFromFileCache(), Preferences\profilePreferences(), MediaWiki\run(), and Message\setContext().
IContextSource::getUser | ( | ) |
Get the User object.
Implemented in RequestContext, DerivativeContext, and ContextSource.
Referenced by SpecialPageFactory\capturePath(), Block\getPermissionsError(), ChangesList\newFromContext(), ParserOptions\newFromContext(), SpecialBlock\processForm(), SpecialUnblock\processUnblock(), Preferences\profilePreferences(), SpecialEmailUser\submit(), and HTMLFileCache\useFileCache().
IContextSource::getWikiPage | ( | ) |
Get the WikiPage object.
May throw an exception if there's no Title object set or the Title object belongs to a special namespace that doesn't have WikiPage, so use first canUseWikiPage() to check whether this method can be called safely.
Implemented in RequestContext, DerivativeContext, and ContextSource.
Referenced by Action\getActionName().
IContextSource::msg | ( | ) |
Get a Message object with context set.
See wfMessage for parameters.
mixed | ... |
Implemented in RequestContext, DerivativeContext, and ContextSource.
Referenced by ApiFormatBase\closePrinter(), Preferences\editingPreferences(), Preferences\generateSkinOptions(), CacheHelper\getCachedNotice(), Preferences\getDateOptions(), Preferences\getFormObject(), ApiHelp\getHelp(), ApiHelp\getHelpInternal(), Preferences\getImageSizes(), Linker\getInvalidTitleDescription(), Block\getPermissionsError(), Preferences\getThumbSizes(), Preferences\getTimezoneOptions(), Preferences\profilePreferences(), Preferences\rcPreferences(), Preferences\renderingPreferences(), ChangesList\showCharacterDifference(), LogEventsList\showLogExtract(), Preferences\skinPreferences(), SpecialEmailUser\submit(), and Preferences\watchlistPreferences().