MediaWiki REL1_41
ContextSource Class Reference

The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and provide accessors to it. More...

Inherits IContextSource.

Inherited by ApiBase, ApiModuleManager, ChangesList, DerivativeContext, DifferenceEngine, FormatMetadata, HTMLForm, ImageGalleryBase, ImageHistoryList, ImportReporter, LogEventsList, LoginHelper, MediaWiki\Category\CategoryViewer, MediaWiki\Output\OutputPage, MediaWiki\Pager\IndexPager, RevisionListBase, and Skin.

Collaboration diagram for ContextSource:

Public Member Functions

 canUseWikiPage ()
 Check whether a WikiPage object can be get 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 ()
 
 getContext ()
 Get the base IContextSource object.
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens.
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Detailed Description

The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and provide accessors to it.

Stability: stable
to extend
Since
1.18
Author
Happy-melon

Definition at line 38 of file ContextSource.php.

Member Function Documentation

◆ canUseWikiPage()

ContextSource::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.

Since
1.19
Stability: stable
to override
Returns
bool

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 108 of file ContextSource.php.

References getContext().

◆ exportSession()

ContextSource::exportSession ( )

Export the resolved user IP, HTTP headers, user ID, and session ID.

The result will be reasonably sized to allow for serialization.

Since
1.21
Stability: stable
to override
Returns
array

Implements IContextSource.

Definition at line 214 of file ContextSource.php.

References getContext().

Referenced by ApiUpload\performUpload().

◆ getActionName()

ContextSource::getActionName ( )

Get the action name for the current web request.

Since
1.38
Stability: stable
to override
Returns
string

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 133 of file ContextSource.php.

References getActionName().

Referenced by getActionName().

◆ getAuthority()

ContextSource::getAuthority ( )

◆ getConfig()

ContextSource::getConfig ( )
Since
1.23
Stability: stable
to override
Returns
Config

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 77 of file ContextSource.php.

References getContext().

Referenced by ApiMain\__construct(), HTMLForm\__construct(), ImageGalleryBase\__construct(), ApiBlock\__construct(), ApiUnblock\__construct(), ApiQuery\__construct(), ApiEditPage\__construct(), ApiUpload\__construct(), ApiMove\__construct(), ApiDelete\__construct(), ApiRollback\__construct(), ApiUserrights\__construct(), ApiWatch\__construct(), ApiProtect\__construct(), ApiUndelete\__construct(), ApiQueryQueryPage\__construct(), MediaWiki\Pager\HistoryPager\__construct(), MediaWiki\Pager\ActiveUsersPager\__construct(), UploadForm\addUploadJS(), ApiQuerySiteinfo\appendAutoCreateTempUser(), ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendFileExtensions(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInstalledLibraries(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendProtocols(), ApiQuerySiteinfo\appendRestrictions(), ApiQuerySiteinfo\appendRightsInfo(), ApiQuerySiteinfo\appendUploadDialog(), ApiQuerySiteinfo\appendUserGroups(), MediaWiki\Output\OutputPage\checkLastModified(), ApiUpload\checkVerification(), DifferenceEngine\debug(), ApiBlock\execute(), ApiEditPage\execute(), ApiEmailUser\execute(), ApiFeedContributions\execute(), ApiFeedRecentChanges\execute(), ApiFeedWatchlist\execute(), ApiLogin\execute(), ApiOpenSearch\execute(), ApiQueryAllUsers\execute(), ApiQueryAuthManagerInfo\execute(), ApiQueryBlocks\execute(), ApiQueryFileRepoInfo\execute(), ApiQueryLangLinks\execute(), ApiQueryLogEvents\execute(), ApiQueryUserContribs\execute(), ApiQueryUsers\execute(), ApiRemoveAuthenticationData\execute(), ApiRollback\execute(), ApiSetPageLanguage\execute(), ApiUpload\execute(), MediaWiki\Pager\UsersPager\formatRow(), ApiImport\getAllowedImportSources(), ApiFeedWatchlist\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiBlock\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllRevisions\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryUserContribs\getAllowedParams(), ApiResetPassword\getAllowedParams(), ApiQuerySiteinfo\getCacheMode(), ApiQueryUserInfo\getCurrentUserInfo(), UploadForm\getDescriptionSection(), ApiResetPassword\getExamplesMessages(), ApiLogin\getExtendedDescription(), ApiSetPageLanguage\getExtendedDescription(), UploadForm\getExtensionsMessage(), MediaWiki\Pager\ImageListPager\getFieldNames(), MediaWiki\Pager\LogPager\getFilterParams(), MediaWiki\Category\CategoryViewer\getHTML(), EnhancedChangesList\getLineData(), DifferenceEngine\getMarkPatrolledLinkInfo(), ApiPageSet\getPageTableFields(), MediaWiki\Pager\ActiveUsersPager\getQueryInfo(), MediaWiki\Pager\LogPager\getQueryInfo(), ApiQueryUserInfo\getRateLimits(), UploadForm\getSourceSection(), SkinFallback\getTemplateData(), DifferenceEngine\getTextDiffer(), ApiFormatBase\initPrinter(), ApiLogin\isDeprecated(), MediaWiki\Pager\ImageListPager\isFieldSortable(), ApiQueryImageInfo\mergeThumbParams(), SkinTemplate\prepareQuickTemplate(), MediaWiki\Pager\ContribsPager\reallyDoQuery(), EnhancedChangesList\recentChangesBlockGroup(), EnhancedChangesList\recentChangesBlockLine(), ChangesList\recentChangesFlags(), ApiQueryInfo\requestExtraData(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), HTMLForm\setDisplayFormat(), SkinTemplate\setupTemplate(), LogEventsList\showOptions(), LoginHelper\showReturnToPage(), TraditionalImageGallery\toHTML(), and SkinTemplate\useCombinedLoginLink().

◆ getContext()

◆ getCsrfTokenSet()

ContextSource::getCsrfTokenSet ( )

Get a repository to obtain and match CSRF tokens.

Returns
CsrfTokenSet
Since
1.37

Implements MediaWiki\Session\CsrfTokenSetProvider.

Definition at line 224 of file ContextSource.php.

◆ getLanguage()

ContextSource::getLanguage ( )

◆ getOutput()

ContextSource::getOutput ( )

◆ getRequest()

◆ getSkin()

ContextSource::getSkin ( )
Since
1.18
Stability: stable
to override
Returns
Skin

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 178 of file ContextSource.php.

References getContext().

◆ getTiming()

ContextSource::getTiming ( )
Since
1.27
Stability: stable
to override
Returns
Timing

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 187 of file ContextSource.php.

References getContext().

◆ getTitle()

◆ getUser()

ContextSource::getUser ( )
Stability: stable
to override
Since
1.18
Stability: stable
to override
Returns
User

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 152 of file ContextSource.php.

References getContext().

Referenced by ImageHistoryPseudoPager\__construct(), MediaWiki\Pager\HistoryPager\__construct(), MediaWiki\Pager\IndexPager\__construct(), MediaWiki\Output\OutputPage\checkLastModified(), MediaWiki\Specials\SpecialUnblock\execute(), ApiAcquireTempUserName\execute(), ApiBlock\execute(), ApiChangeAuthenticationData\execute(), ApiCheckToken\execute(), ApiClearHasMsg\execute(), ApiCSPReport\execute(), ApiDelete\execute(), ApiEditPage\execute(), ApiEmailUser\execute(), ApiLinkAccount\execute(), ApiLogout\execute(), ApiMove\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiQueryAuthManagerInfo\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryTokens\execute(), ApiRemoveAuthenticationData\execute(), ApiResetPassword\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetNotificationTimestamp\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiWatch\execute(), MediaWiki\Pager\MergeHistoryPager\formatRow(), MediaWiki\Pager\NewPagesPager\formatRow(), MediaWiki\Pager\ProtectedTitlesPager\formatRow(), MediaWiki\Pager\UsersPager\formatRow(), MediaWiki\Pager\ProtectedPagesPager\formatValue(), ApiQueryUserInfo\getCurrentUserInfo(), ApiQueryUserInfo\getLatestContributionTime(), ApiQueryUserInfo\getRateLimits(), ApiUpload\performUpload(), ApiTag\processIndividual(), ApiUpload\selectUploadModule(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().

◆ getWikiPage()

ContextSource::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.

Since
1.19
Stability: stable
to override
Returns
WikiPage

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 122 of file ContextSource.php.

References getContext().

Referenced by MediaWiki\Pager\HistoryPager\formatRow(), MediaWiki\Pager\HistoryPager\getQueryInfo(), and DifferenceEngine\renderNewRevision().

◆ msg()

ContextSource::msg ( $key,
$params )

Get a Message object with context set Parameters are the same as wfMessage()

Since
1.18
Stability: stable
to override
Parameters
string | string[] | MessageSpecifier$keyMessage key, or array of keys, or a MessageSpecifier.
mixed...$params
Returns
Message

Implements MessageLocalizer.

Reimplemented in DerivativeContext.

Definition at line 202 of file ContextSource.php.

References getContext().

Referenced by UploadForm\__construct(), MediaWiki\Pager\ContribsPager\__construct(), MediaWiki\Pager\DeletedContribsPager\__construct(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendSkins(), ImageHistoryList\beginImageHistoryList(), SkinTemplate\buildLoginData(), SkinTemplate\buildPersonalUrls(), ApiUpload\checkPermissions(), ImportReporter\close(), ApiFormatBase\closePrinter(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiEditPage\execute(), ApiFeedContributions\execute(), ApiFeedWatchlist\execute(), ApiImageRotate\execute(), ApiOptions\execute(), ApiQueryAllMessages\execute(), ApiQueryTags\execute(), ApiFeedContributions\feedItemDesc(), MediaWiki\Pager\CategoryPager\formatRow(), MediaWiki\Pager\ActiveUsersPager\formatRow(), MediaWiki\Pager\MergeHistoryPager\formatRow(), MediaWiki\Pager\NewPagesPager\formatRow(), MediaWiki\Pager\ProtectedTitlesPager\formatRow(), MediaWiki\Pager\UsersPager\formatRow(), MediaWiki\Pager\AllMessagesTablePager\formatValue(), MediaWiki\Pager\ProtectedPagesPager\formatValue(), MediaWiki\Pager\BlockListPager\formatValue(), ImageHistoryPseudoPager\getBody(), OOUIHTMLForm\getButtons(), DifferenceEngine\getDiff(), EnhancedChangesList\getDiffHistLinks(), MediaWiki\Pager\HistoryPager\getEmptyBody(), MediaWiki\Pager\TablePager\getEmptyBody(), UploadForm\getExtensionsMessage(), MediaWiki\Pager\AllMessagesTablePager\getFieldNames(), MediaWiki\Pager\BlockListPager\getFieldNames(), MediaWiki\Pager\ImageListPager\getFieldNames(), MediaWiki\Pager\ProtectedPagesPager\getFieldNames(), MediaWiki\Category\CategoryViewer\getHTML(), EditWatchlistNormalHTMLForm\getLegend(), EnhancedChangesList\getLineData(), EnhancedChangesList\getLogText(), MediaWiki\Pager\TablePager\getNavigationBar(), MediaWiki\Pager\UsersPager\getPageHeader(), DifferenceEngine\getRevisionHeader(), UploadForm\getSourceSection(), MediaWiki\Pager\HistoryPager\getStartBody(), MediaWiki\Pager\AllMessagesTablePager\getStartBody(), SkinMustache\getTemplateData(), ImageHistoryList\getThumbForLine(), ApiUpload\handleStashException(), ImageHistoryList\imageHistoryLine(), ChangesList\insertLog(), DifferenceEngine\localiseLineNumbers(), FormatMetadata\makeFormattedData(), DifferenceEngine\markPatrolledLink(), MediaWiki\Pager\ImageListPager\outputUserDoesNotExist(), MediaWiki\Pager\AllMessagesTablePager\reallyDoQuery(), EnhancedChangesList\recentChangesBlockGroup(), ImportReporter\reportNotice(), ImportReporter\reportPage(), Article\showDeletedRevisionHeader(), DifferenceEngine\showDiffPage(), TraditionalImageGallery\toHTML(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().

◆ setContext()


The documentation for this class was generated from the following file: