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, PageLookup $pageLookup)
 
 checkAccess ()
 
 constructMetadata ()
 
 getContent ()
 
 getETag ()
 Returns an ETag representing a page's source. More...
 
 getLastModified ()
 
 getPage ()
 
 getParamSettings ()
 
 getRole ()
 
 getTargetRevision ()
 Returns the target revision. More...
 
 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
 
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 26 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 270 of file PageContentHelper.php.

◆ constructMetadata()

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

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 214 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 127 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 176 of file PageContentHelper.php.

◆ getLastModified()

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

Definition at line 190 of file PageContentHelper.php.

◆ getPage()

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

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 90 of file PageContentHelper.php.

◆ getParamSettings()

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

Reimplemented in MediaWiki\Rest\Handler\RevisionContentHelper.

Definition at line 240 of file PageContentHelper.php.

◆ getRole()

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

Definition at line 119 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 106 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 83 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 207 of file PageContentHelper.php.

◆ init()

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

Definition at line 75 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 165 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 255 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 42 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 51 of file PageContentHelper.php.

◆ $parameters

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

Definition at line 45 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 48 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 27 of file PageContentHelper.php.


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