MediaWiki REL1_37
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, PageLookup $pageLookup)
 
 checkAccess ()
 
 constructMetadata ()
 
 getContent ()
 
 getETag ()
 Returns an ETag representing a page's source.
 
 getLastModified ()
 
 getPage ()
 
 getParamSettings ()
 
 getRole ()
 
 getTargetRevision ()
 Returns the target revision.
 
 getTitleText ()
 
 hasContent ()
 Checks whether content exists.
 
 init (Authority $authority, array $parameters)
 
 isAccessible ()
 
 setCacheControl (ResponseInterface $response, int $expiry=null)
 Sets the 'Cache-Control' header no more then provided $expiry.
 

Protected Attributes

Authority null $authority = null
 
Config $config
 
PageLookup $pageLookup
 
ExistingPageRecord false null $pageRecord = false
 
string[] $parameters = null
 
RevisionLookup $revisionLookup
 
RevisionRecord false null $targetRevision = false
 
TitleFormatter $titleFormatter
 

Private Attributes

const MAX_AGE_200 = 5
 

Detailed Description

Access: internal
for use by core REST infrastructure

Definition at line 25 of file PageContentHelper.php.

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ checkAccess()

MediaWiki\Rest\Handler\PageContentHelper::checkAccess ( )
Exceptions
LocalizedHttpExceptionif the content is not accessible

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 267 of file PageContentHelper.php.

◆ constructMetadata()

MediaWiki\Rest\Handler\PageContentHelper::constructMetadata ( )
Returns
array

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 213 of file PageContentHelper.php.

◆ getContent()

MediaWiki\Rest\Handler\PageContentHelper::getContent ( )
Returns
TextContent
Exceptions
LocalizedHttpExceptionslot content is not TextContent or RevisionRecord/Slot is inaccessible

Definition at line 126 of file PageContentHelper.php.

◆ 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 175 of file PageContentHelper.php.

◆ getLastModified()

MediaWiki\Rest\Handler\PageContentHelper::getLastModified ( )
Returns
string|null

Definition at line 189 of file PageContentHelper.php.

◆ getPage()

MediaWiki\Rest\Handler\PageContentHelper::getPage ( )
Returns
ExistingPageRecord|null

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 89 of file PageContentHelper.php.

◆ getParamSettings()

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

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 237 of file PageContentHelper.php.

◆ getRole()

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

Definition at line 118 of file PageContentHelper.php.

◆ getTargetRevision()

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

Returns the target revision.

No permission checks are applied.

Returns
RevisionRecord|null latest revision or null if unable to retrieve revision

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 105 of file PageContentHelper.php.

◆ getTitleText()

MediaWiki\Rest\Handler\PageContentHelper::getTitleText ( )
Returns
string|null title text or null if unable to retrieve title

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 82 of file PageContentHelper.php.

◆ 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 206 of file PageContentHelper.php.

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

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 164 of file PageContentHelper.php.

◆ 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 252 of file PageContentHelper.php.

References 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

◆ $pageLookup

PageLookup MediaWiki\Rest\Handler\PageContentHelper::$pageLookup
protected

◆ $pageRecord

ExistingPageRecord false null MediaWiki\Rest\Handler\PageContentHelper::$pageRecord = false
protected

Definition at line 50 of file PageContentHelper.php.

◆ $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 false null MediaWiki\Rest\Handler\PageContentHelper::$targetRevision = false
protected

Definition at line 47 of file PageContentHelper.php.

◆ $titleFormatter

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

◆ MAX_AGE_200

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

Definition at line 26 of file PageContentHelper.php.


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