MediaWiki master
|
Interface for objects which can provide a MediaWiki context on request. More...
Inherits MediaWiki\Language\LocalizationContext, and MediaWiki\Session\CsrfTokenSetProvider.
Inherited by MediaWiki\Context\ContextSource, and MediaWiki\Context\RequestContext.
Public Member Functions | |
canUseWikiPage () | |
Check whether a WikiPage object can be obtained with getWikiPage(). | |
exportSession () | |
Export the resolved user IP, HTTP headers, user ID, and session ID. | |
getActionName () | |
Get the action name for the current web request. | |
getAuthority () | |
getConfig () | |
Get the site configuration. | |
getLanguage () | |
getOutput () | |
getRequest () | |
getSkin () | |
getTiming () | |
getTitle () | |
getUser () | |
getWikiPage () | |
Get the WikiPage object. | |
Public Member Functions inherited from MediaWiki\Language\LocalizationContext | |
getLanguageCode () | |
Returns the target language for UI localization. | |
Public Member Functions inherited from MessageLocalizer | |
msg ( $key,... $params) | |
This is the method for getting translated interface messages. | |
Public Member Functions inherited from MediaWiki\Session\CsrfTokenSetProvider | |
getCsrfTokenSet () | |
Get a set of CSRF tokens to obtain and match specific tokens. | |
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 these 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 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.
Must not be implemented directly by extensions, extend ContextSource instead.
Definition at line 71 of file IContextSource.php.
MediaWiki\Context\IContextSource::canUseWikiPage | ( | ) |
Check whether a WikiPage object can be obtained with getWikiPage().
Callers should expect that an exception is thrown from getWikiPage() if this method returns false.
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
MediaWiki\Context\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 MediaWiki\Context\ContextSource, and MediaWiki\Context\RequestContext.
MediaWiki\Context\IContextSource::getActionName | ( | ) |
Get the action name for the current web request.
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by Action\getActionName().
MediaWiki\Context\IContextSource::getAuthority | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by MediaWiki\Pager\PagerTools\__construct(), MediaWiki\Specials\SpecialBlock\processForm(), and DeleteAction\tempDelete().
MediaWiki\Context\IContextSource::getConfig | ( | ) |
Get the site configuration.
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by MediaWiki\Output\OutputPage\__construct(), MediaWiki\MediaWikiEntryPoint\__construct(), MediaWiki\Category\CategoryViewer\__construct(), MediaWiki\Specials\SpecialPageLanguage\changePageLanguage(), MediaWiki\MediaWikiEntryPoint\commitMainTransaction(), MediaWiki\SpecialPage\SpecialPageFactory\executePath(), and MediaWiki\Api\ApiHelp\getHelp().
MediaWiki\Context\IContextSource::getLanguage | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\capturePath(), MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\getDateOptions(), MediaWiki\Debug\MWDebug\getDebugInfo(), MediaWiki\Debug\MWDebug\getFilesIncluded(), MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor(), MediaWiki\Api\ApiHelp\getHelp(), ParserOptions\newFromContext(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\searchPreferences(), MediaWiki\Message\Message\setContext(), MediaWiki\Preferences\DefaultPreferencesFactory\skinPreferences(), DeleteAction\tempDelete(), and HTMLFileCache\useFileCache().
MediaWiki\Context\IContextSource::getOutput | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\capturePath(), MediaWiki\MediaWikiEntryPoint\commitMainTransaction(), MediaWiki\SpecialPage\SpecialPageFactory\executePath(), MediaWiki\Preferences\DefaultPreferencesFactory\getForm(), MediaWiki\Api\ApiHelp\getHelp(), HTMLFileCache\loadFromFileCache(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), and DeleteAction\tempDelete().
MediaWiki\Context\IContextSource::getRequest | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by MediaWiki\Output\OutputPage\__construct(), MediaWiki\SpecialPage\SpecialPageFactory\capturePath(), MediaWiki\MediaWikiEntryPoint\commitMainTransaction(), MediaWiki\SpecialPage\SpecialPageFactory\executePath(), MediaWiki\Debug\MWDebug\getDebugInfo(), MediaWiki\Preferences\DefaultPreferencesFactory\getForm(), TextSlotDiffRenderer\getTablePrefix(), ParserOptions\newFromContext(), ChangesList\newFromContext(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), DeleteAction\tempDelete(), and HTMLFileCache\useFileCache().
MediaWiki\Context\IContextSource::getSkin | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor(), and ChangesList\newFromContext().
MediaWiki\Context\IContextSource::getTiming | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
MediaWiki\Context\IContextSource::getTitle | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, MediaWiki\Context\RequestContext, DifferenceEngine, MediaWiki\HTMLForm\HTMLForm, ImageHistoryPseudoPager, MediaWiki\Pager\AllMessagesTablePager, and MediaWiki\Pager\ImageListPager.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\getForm(), HTMLFileCache\loadFromFileCache(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), and MediaWiki\Message\Message\setContext().
MediaWiki\Context\IContextSource::getUser | ( | ) |
Implemented in MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.
Referenced by MediaWiki\SpecialPage\SpecialPageFactory\capturePath(), MediaWiki\Specials\SpecialPageLanguage\changePageLanguage(), MediaWiki\MediaWikiEntryPoint\commitMainTransaction(), MediaWiki\Rest\EntryPoint\doSetup(), ParserOptions\newFromContext(), ChangesList\newFromContext(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), DeleteAction\tempDelete(), and HTMLFileCache\useFileCache().
MediaWiki\Context\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 MediaWiki\Context\ContextSource, MediaWiki\Context\DerivativeContext, and MediaWiki\Context\RequestContext.