MediaWiki  master
MediaWiki\Rest\Handler\PageContentHelper Class Reference
Inheritance diagram for MediaWiki\Rest\Handler\PageContentHelper:
Collaboration diagram for MediaWiki\Rest\Handler\PageContentHelper:

Public Member Functions

 __construct (Config $config, RevisionLookup $revisionLookup, TitleFormatter $titleFormatter, TitleFactory $titleFactory)
 
 checkAccess ()
 
 constructMetadata ()
 
 getContent ()
 
 getETag ()
 Returns an ETag representing a page's source. More...
 
 getLastModified ()
 
 getParamSettings ()
 
 getRole ()
 
 getTargetRevision ()
 Returns the target revision. More...
 
 getTitle ()
 
 getTitleText ()
 
 hasContent ()
 Checks whether content exists. More...
 
 init (Authority $authority, array $parameters)
 
 isAccessible ()
 
 setCacheControl (ResponseInterface $response, int $expiry=null)
 Sets the 'Cache-Control' header no more then provided $expiry. More...
 

Protected Attributes

Authority null $authority = null
 
Config $config
 
string[] $parameters = null
 
RevisionLookup $revisionLookup
 
RevisionRecord bool null $targetRevision = null
 
TitleFactory $titleFactory
 
TitleFormatter $titleFormatter
 
Title bool null $titleObject = null
 

Private Attributes

const MAX_AGE_200 = 5
 

Detailed Description

Since
1.36

Definition at line 25 of file PageContentHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Handler\PageContentHelper::__construct ( Config  $config,
RevisionLookup  $revisionLookup,
TitleFormatter  $titleFormatter,
TitleFactory  $titleFactory 
)

Member Function Documentation

◆ checkAccess()

◆ constructMetadata()

◆ getContent()

◆ getETag()

MediaWiki\Rest\Handler\PageContentHelper::getETag ( )

Returns an ETag representing a page's source.

The ETag assumes a page's source has changed if the latest revision of a page has been made private, un-readable for another reason, or a newer revision exists.

Returns
string|null

Definition at line 174 of file PageContentHelper.php.

References MediaWiki\Rest\Handler\PageContentHelper\getTargetRevision(), and MediaWiki\Rest\Handler\PageContentHelper\isAccessible().

◆ getLastModified()

MediaWiki\Rest\Handler\PageContentHelper::getLastModified ( )

◆ getParamSettings()

MediaWiki\Rest\Handler\PageContentHelper::getParamSettings ( )
Returns
array[]

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 235 of file PageContentHelper.php.

References MediaWiki\Rest\Handler\PARAM_SOURCE.

◆ getRole()

MediaWiki\Rest\Handler\PageContentHelper::getRole ( )

◆ getTargetRevision()

MediaWiki\Rest\Handler\PageContentHelper::getTargetRevision ( )

◆ getTitle()

◆ getTitleText()

MediaWiki\Rest\Handler\PageContentHelper::getTitleText ( )

◆ hasContent()

MediaWiki\Rest\Handler\PageContentHelper::hasContent ( )

Checks whether content exists.

Permission checks are not considered.

Returns
bool

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 205 of file PageContentHelper.php.

References $title, and MediaWiki\Rest\Handler\PageContentHelper\getTitle().

Referenced by MediaWiki\Rest\Handler\PageContentHelper\checkAccess().

◆ init()

MediaWiki\Rest\Handler\PageContentHelper::init ( Authority  $authority,
array  $parameters 
)
Parameters
Authority$authority
string[]$parametersvalidated parameters

Definition at line 74 of file PageContentHelper.php.

References MediaWiki\Rest\Handler\PageContentHelper\$authority, and MediaWiki\Rest\Handler\PageContentHelper\$parameters.

◆ isAccessible()

MediaWiki\Rest\Handler\PageContentHelper::isAccessible ( )

◆ setCacheControl()

MediaWiki\Rest\Handler\PageContentHelper::setCacheControl ( ResponseInterface  $response,
int  $expiry = null 
)

Sets the 'Cache-Control' header no more then provided $expiry.

Parameters
ResponseInterface$response
int | null$expiry

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 250 of file PageContentHelper.php.

References MediaWiki\Rest\Handler\PageContentHelper\MAX_AGE_200, and MediaWiki\Rest\ResponseInterface\setHeader().

Member Data Documentation

◆ $authority

Authority null MediaWiki\Rest\Handler\PageContentHelper::$authority = null
protected

Definition at line 41 of file PageContentHelper.php.

Referenced by MediaWiki\Rest\Handler\PageContentHelper\init().

◆ $config

Config MediaWiki\Rest\Handler\PageContentHelper::$config
protected

◆ $parameters

string [] MediaWiki\Rest\Handler\PageContentHelper::$parameters = null
protected

Definition at line 44 of file PageContentHelper.php.

Referenced by MediaWiki\Rest\Handler\PageContentHelper\init().

◆ $revisionLookup

RevisionLookup MediaWiki\Rest\Handler\PageContentHelper::$revisionLookup
protected

◆ $targetRevision

RevisionRecord bool null MediaWiki\Rest\Handler\PageContentHelper::$targetRevision = null
protected

◆ $titleFactory

TitleFactory MediaWiki\Rest\Handler\PageContentHelper::$titleFactory
protected

◆ $titleFormatter

TitleFormatter MediaWiki\Rest\Handler\PageContentHelper::$titleFormatter
protected

◆ $titleObject

Title bool null MediaWiki\Rest\Handler\PageContentHelper::$titleObject = null
protected

◆ MAX_AGE_200

const MediaWiki\Rest\Handler\PageContentHelper::MAX_AGE_200 = 5
private

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