MediaWiki REL1_39
ContextSource Class Reference

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

Inheritance diagram for ContextSource:
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 ()
 
 getStats ()
 
 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

Definition at line 33 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 103 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 221 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 128 of file ContextSource.php.

◆ getAuthority()

◆ getConfig()

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

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 72 of file ContextSource.php.

References getContext().

Referenced by ApiMain\__construct(), HTMLForm\__construct(), ImageGalleryBase\__construct(), ApiBlock\__construct(), ApiQuery\__construct(), ApiEditPage\__construct(), ApiUpload\__construct(), ApiMove\__construct(), ApiDelete\__construct(), ApiRollback\__construct(), ApiWatch\__construct(), ApiProtect\__construct(), ApiUndelete\__construct(), ApiQueryQueryPage\__construct(), ActiveUsersPager\__construct(), UploadForm\addUploadJS(), ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendFileExtensions(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInstalledLibraries(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendProtocols(), ApiQuerySiteinfo\appendRestrictions(), ApiQuerySiteinfo\appendRightsInfo(), ApiQuerySiteinfo\appendSubscribedHooks(), ApiQuerySiteinfo\appendUploadDialog(), ApiQuerySiteinfo\appendUserGroups(), 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(), HistoryPager\formatRow(), 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(), ImageListPager\getFieldNames(), LogPager\getFilterParams(), SkinTemplate\getFooterIcons(), CategoryViewer\getHTML(), HTMLButtonField\getInputHTML(), EnhancedChangesList\getLineData(), DifferenceEngine\getMarkPatrolledLinkInfo(), ApiPageSet\getPageTableFields(), ActiveUsersPager\getQueryInfo(), LogPager\getQueryInfo(), ApiQueryUserInfo\getRateLimits(), UploadForm\getSourceSection(), SkinFallback\getTemplateData(), ApiFormatBase\initPrinter(), ApiLogin\isDeprecated(), ImageListPager\isFieldSortable(), ApiQueryImageInfo\mergeThumbParams(), SkinTemplate\prepareQuickTemplate(), 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 231 of file ContextSource.php.

◆ getLanguage()

◆ getOutput()

◆ getRequest()

◆ getSkin()

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

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 173 of file ContextSource.php.

References getContext().

Referenced by DifferenceEngine\renderNewRevision().

◆ getStats()

ContextSource::getStats ( )
Deprecated
since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected). Hard deprecated since 1.39.
Since
1.25
Returns
IBufferingStatsdDataFactory

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 193 of file ContextSource.php.

References wfDeprecated().

◆ getTiming()

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

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 182 of file ContextSource.php.

References getContext().

◆ getTitle()

ContextSource::getTitle ( )
Since
1.18
Stability: stable
to override
Returns
Title|null

Implements IContextSource.

Reimplemented in DerivativeContext, DifferenceEngine, HTMLForm, ImageHistoryPseudoPager, AllMessagesTablePager, ImageListPager, and ProtectedTitlesPager.

Definition at line 90 of file ContextSource.php.

References getContext().

Referenced by TablePager\getNavigationBar().

◆ getUser()

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

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 147 of file ContextSource.php.

References getContext().

Referenced by ImageHistoryPseudoPager\__construct(), IndexPager\__construct(), 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(), ApiPurge\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(), ProtectedPagesPager\formatValue(), ApiQueryUserInfo\getCurrentUserInfo(), UploadForm\getDescriptionSection(), ApiQueryUserInfo\getLatestContributionTime(), UploadForm\getOptionsSection(), ApiQueryUserInfo\getRateLimits(), ApiUpload\performUpload(), ApiTag\processIndividual(), ImportReporter\reportPage(), 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 117 of file ContextSource.php.

References getContext().

Referenced by 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 209 of file ContextSource.php.

References getContext().

Referenced by UploadForm\__construct(), ContribsPager\__construct(), DeletedContribsPager\__construct(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendSkins(), ImageHistoryList\beginImageHistoryList(), SkinTemplate\buildLoginData(), SkinTemplate\buildPersonalUrls(), ApiUpload\checkPermissions(), ImportReporter\close(), ApiFormatBase\closePrinter(), FormatMetadata\collapseContactInfo(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiEditPage\execute(), ApiFeedContributions\execute(), ApiFeedWatchlist\execute(), ApiImageRotate\execute(), ApiOptions\execute(), ApiQueryAllMessages\execute(), ApiQueryTags\execute(), ApiFeedContributions\feedItemDesc(), CategoryPager\formatRow(), ActiveUsersPager\formatRow(), UsersPager\formatRow(), AllMessagesTablePager\formatValue(), ProtectedPagesPager\formatValue(), BlockListPager\formatValue(), OOUIHTMLForm\getButtons(), VFormHTMLForm\getButtons(), DifferenceEngine\getDiff(), EnhancedChangesList\getDiffHistLinks(), HistoryPager\getEmptyBody(), TablePager\getEmptyBody(), UploadForm\getExtensionsMessage(), AllMessagesTablePager\getFieldNames(), BlockListPager\getFieldNames(), ImageListPager\getFieldNames(), ProtectedPagesPager\getFieldNames(), CategoryViewer\getHTML(), EditWatchlistNormalHTMLForm\getLegend(), EnhancedChangesList\getLineData(), EnhancedChangesList\getLogText(), TablePager\getNavigationBar(), UsersPager\getPageHeader(), DifferenceEngine\getRevisionHeader(), UploadForm\getSourceSection(), HistoryPager\getStartBody(), AllMessagesTablePager\getStartBody(), SkinMustache\getTemplateData(), ImageHistoryList\getThumbForLine(), ApiUpload\handleStashException(), ImageHistoryList\imageHistoryLine(), ChangesList\insertLog(), DifferenceEngine\localiseLineNumbers(), FormatMetadata\makeFormattedData(), DifferenceEngine\markPatrolledLink(), ImageListPager\outputUserDoesNotExist(), 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: