MediaWiki  master
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(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getActionName ()
 Get the action name for the current web request. More...
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object. More...
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens. More...
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 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 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 209 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()

ContextSource::getAuthority ( )
Since
1.36
Returns
Authority

Implements IContextSource.

Reimplemented in DerivativeContext.

Definition at line 155 of file ContextSource.php.

Referenced by LogEventsList\__construct(), UploadForm\__construct(), HistoryPager\__construct(), ImageHistoryList\beginImageHistoryList(), SkinTemplate\buildLoginData(), SkinTemplate\buildPersonalUrls(), UsersPager\canSeeHideuser(), DifferenceEngine\deletedLink(), HistoryPager\doBatchLookups(), ApiAMCreateAccount\execute(), ApiBlock\execute(), ApiChangeContentModel\execute(), ApiEditPage\execute(), ApiFileRevert\execute(), ApiImageRotate\execute(), ApiImport\execute(), ApiManageTags\execute(), ApiMove\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryImageInfo\execute(), ApiQueryLogEvents\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetPageLanguage\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiUserrights\execute(), ApiFeedContributions\feedItem(), ProtectedPagesPager\formatValue(), BlockListPager\formatValue(), ImageHistoryPseudoPager\getBody(), ApiQueryLogEvents\getCacheMode(), ApiQueryUserInfo\getCurrentUserInfo(), EnhancedChangesList\getLineData(), DifferenceEngine\getMarkPatrolledLinkInfo(), BlockListPager\getQueryInfo(), DeletedContribsPager\getQueryInfo(), SkinTemplate\getReturnToParam(), DifferenceEngine\getRevisionHeader(), UploadForm\getSourceSection(), HistoryPager\getStartBody(), ImageHistoryList\imageHistoryLine(), ChangesList\insertDiffHist(), DifferenceEngine\loadNewText(), DifferenceEngine\loadText(), ApiMergeHistory\merge(), ApiMove\moveSubpages(), ApiUpload\performUpload(), ApiTag\processIndividual(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), ApiQueryDeletedRevisions\run(), ApiQueryRevisions\run(), DifferenceEngine\setRevisions(), DifferenceEngine\showDiffPage(), and ApiQueryBase\userCanSeeRevDel().

◆ 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(), ApiQuery\__construct(), ApiWatch\__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(), ApiRemoveAuthenticationData\execute(), ApiRollback\execute(), ApiSetPageLanguage\execute(), ApiUpload\execute(), HistoryPager\formatRow(), UsersPager\formatRow(), ApiImport\getAllowedImportSources(), ApiFeedWatchlist\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryLogEvents\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(), 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()

ContextSource::getContext ( )

Get the base IContextSource object.

Since
1.18
Stability: stable
to override
Returns
IContextSource

Definition at line 47 of file ContextSource.php.

References RequestContext\getMain(), and wfDebug().

Referenced by ApiBase\__construct(), UploadForm\__construct(), RevisionItem\__construct(), UsersPager\buildGroupLink(), canUseWikiPage(), DerivativeContext\canUseWikiPage(), CategoryViewer\clearCategoryState(), SpecialUnblock\execute(), ApiChangeContentModel\execute(), ApiComparePages\execute(), ApiEmailUser\execute(), ApiExpandTemplates\execute(), ApiFeedContributions\execute(), ApiHelp\execute(), ApiOptions\execute(), ApiRevisionDelete\execute(), ApiUserrights\execute(), ApiFeedContributions\feedItem(), ChangesList\formatCharacterDifference(), ProtectedPagesPager\formatValue(), DifferenceEngine\generateContentDiffBody(), DifferenceEngine\generateTextDiffBody(), getConfig(), DerivativeContext\getConfig(), FormatMetadata\getExtendedMetadataFromHook(), ApiAMCreateAccount\getFinalDescription(), ApiClientLogin\getFinalDescription(), ApiLinkAccount\getFinalDescription(), EditWatchlistNormalHTMLForm\getLegend(), UsersPager\getPageHeader(), DifferenceEngine\getParserOutput(), ApiOptions\getPreferences(), getRequest(), DerivativeContext\getRequest(), DifferenceEngine\getSlotDiffRenderers(), NewFilesPager\getStartBody(), CategoryPager\getStartForm(), DerivativeContext\getTiming(), getTitle(), DerivativeContext\getTitle(), getWikiPage(), DerivativeContext\getWikiPage(), ChangesList\insertLog(), LogEventsList\logLine(), ApiUpload\performUpload(), SpecialTags\processCreateTagForm(), SpecialTags\processTagForm(), ChangesList\recentChangesFlags(), ApiOptions\resetPreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\saveFormData(), SpecialComparePages\showDiff(), DifferenceEngine\showDiffPage(), LogEventsList\showOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\submitForm(), DifferenceEngine\textDiff(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().

◆ getCsrfTokenSet()

ContextSource::getCsrfTokenSet ( )

Get a repository to obtain and match CSRF tokens.

Returns
CsrfTokenSet
Since
1.37

Implements MediaWiki\Session\CsrfTokenSetProvider.

Definition at line 219 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().

◆ 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()

◆ 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(), OutputPage\checkLastModified(), 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(), ApiQueryStashImageInfo\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(), ApiValidatePassword\execute(), ApiWatch\execute(), ApiQueryRecentChanges\extractRowInfo(), HistoryPager\formatRow(), UsersPager\formatRow(), ProtectedPagesPager\formatValue(), ApiQueryUserInfo\getCurrentUserInfo(), UploadForm\getDescriptionSection(), ApiQueryUserInfo\getLatestContributionTime(), DifferenceEngine\getMarkPatrolledLinkInfo(), PreferencesFormOOUI\getModifiedUser(), UploadForm\getOptionsSection(), ApiQueryUserInfo\getRateLimits(), DifferenceEngine\getRevisionHeader(), ImageHistoryList\getThumbForLine(), ApiOptions\getUserForUpdates(), ImageHistoryList\imageHistoryLine(), ChangesList\insertDateHeader(), ApiUpload\performUpload(), SkinTemplate\prepareQuickTemplate(), ApiTag\processIndividual(), ImportReporter\reportPage(), ApiQueryRecentChanges\run(), ApiUpload\selectUploadModule(), SkinTemplate\setupTemplateContext(), DifferenceEngine\showDiffPage(), HTMLForm\tryAuthorizedSubmit(), 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 197 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(), 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(), AlphabeticPager\getNavigationBar(), 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\reportPage(), Article\showDeletedRevisionHeader(), DifferenceEngine\showDiffPage(), TraditionalImageGallery\toHTML(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().

◆ setContext()


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