MediaWiki REL1_37
MediaWiki\Page\ParserOutputAccess Class Reference

Service for getting rendered output of a given page. More...

Collaboration diagram for MediaWiki\Page\ParserOutputAccess:

Public Member Functions

 __construct (ParserCache $primaryCache, RevisionOutputCache $secondaryCache, RevisionLookup $revisionLookup, RevisionRenderer $revisionRenderer, IBufferingStatsdDataFactory $statsDataFactory, ILBFactory $lbFactory, LoggerSpi $loggerSpi, WikiPageFactory $wikiPageFactory, TitleFormatter $titleFormatter)
 
 getCachedParserOutput (PageRecord $page, ParserOptions $parserOptions, ?RevisionRecord $revision=null, int $options=0)
 Returns the rendered output for the given page if it is present in the cache.
 
 getParserOutput (PageRecord $page, ParserOptions $parserOptions, ?RevisionRecord $revision=null, int $options=0)
 Returns the rendered output for the given page.
 

Private Member Functions

 checkPreconditions (PageRecord $page, ?RevisionRecord $revision=null, int $options=0)
 
 newPoolWorkArticleView (PageRecord $page, ParserOptions $parserOptions, RevisionRecord $revision, int $options)
 
 shouldUseCache (PageRecord $page, ParserOptions $parserOptions, ?RevisionRecord $rev)
 Use a cache?
 

Private Attributes

ILBFactory $lbFactory
 
LoggerSpi $loggerSpi
 
ParserCache $primaryCache
 
RevisionLookup $revisionLookup
 
RevisionRenderer $revisionRenderer
 
RevisionOutputCache $secondaryCache
 
IBufferingStatsdDataFactory $statsDataFactory
 
TitleFormatter $titleFormatter
 
WikiPageFactory $wikiPageFactory
 

Detailed Description

Service for getting rendered output of a given page.

This is a high level service, encapsulating concerns like caching and stampede protection via PoolCounter.

Since
1.36
Stability: unstable
Extensions should use WikiPage::getParserOutput until this class has settled down.

Definition at line 50 of file ParserOutputAccess.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\ParserOutputAccess::__construct ( ParserCache  $primaryCache,
RevisionOutputCache  $secondaryCache,
RevisionLookup  $revisionLookup,
RevisionRenderer  $revisionRenderer,
IBufferingStatsdDataFactory  $statsDataFactory,
ILBFactory  $lbFactory,
LoggerSpi  $loggerSpi,
WikiPageFactory  $wikiPageFactory,
TitleFormatter  $titleFormatter 
)

Member Function Documentation

◆ checkPreconditions()

MediaWiki\Page\ParserOutputAccess::checkPreconditions ( PageRecord  $page,
?RevisionRecord  $revision = null,
int  $options = 0 
)
private
Parameters
PageRecord$page
RevisionRecord | null$revision
int$options
Returns
Status|null

Definition at line 325 of file ParserOutputAccess.php.

◆ getCachedParserOutput()

MediaWiki\Page\ParserOutputAccess::getCachedParserOutput ( PageRecord  $page,
ParserOptions  $parserOptions,
?RevisionRecord  $revision = null,
int  $options = 0 
)

Returns the rendered output for the given page if it is present in the cache.

Parameters
PageRecord$page
ParserOptions$parserOptions
RevisionRecord | null$revision
int$optionsBitfield using the OPT_XXX constants
Returns
ParserOutput|null

Definition at line 201 of file ParserOutputAccess.php.

◆ getParserOutput()

MediaWiki\Page\ParserOutputAccess::getParserOutput ( PageRecord  $page,
ParserOptions  $parserOptions,
?RevisionRecord  $revision = null,
int  $options = 0 
)

Returns the rendered output for the given page.

Caching and concurrency control is applied.

Parameters
PageRecord$page
ParserOptions$parserOptions
RevisionRecord | null$revision
int$optionsBitfield using the OPT_XXX constants
Returns
Status containing a ParserOutput is no error occurred. Well known errors and warnings include the following messages:
  • 'view-pool-dirty-output' (warning) The output is dirty (from a stale cache entry).
  • 'view-pool-contention' (warning) Dirty output was returned immediately instead of waiting to acquire a work lock (when "fast stale" mode is enabled in PoolCounter).
  • 'view-pool-timeout' (warning) Dirty output was returned after failing to acquire a work lock (got QUEUE_FULL or TIMEOUT from PoolCounter).
  • 'pool-queuefull' (error) unable to acquire work lock, and no cached content found.
  • 'pool-timeout' (error) unable to acquire work lock, and no cached content found.
  • 'pool-servererror' (error) PoolCounterWork failed due to a lock service error.
  • 'pool-unknownerror' (error) PoolCounterWork failed for an unknown reason.
  • 'nopagetext' (error) The page does not exist

Definition at line 245 of file ParserOutputAccess.php.

◆ newPoolWorkArticleView()

MediaWiki\Page\ParserOutputAccess::newPoolWorkArticleView ( PageRecord  $page,
ParserOptions  $parserOptions,
RevisionRecord  $revision,
int  $options 
)
private
Parameters
PageRecord$page
ParserOptions$parserOptions
RevisionRecord$revision
int$options
Returns
PoolWorkArticleView

Definition at line 370 of file ParserOutputAccess.php.

References CACHE_NONE.

◆ shouldUseCache()

MediaWiki\Page\ParserOutputAccess::shouldUseCache ( PageRecord  $page,
ParserOptions  $parserOptions,
?RevisionRecord  $rev 
)
private

Use a cache?

Parameters
PageRecord$page
ParserOptions$parserOptionsParserOptions to check
RevisionRecord | null$rev
Returns
string One of the CACHE_XXX constants.

Definition at line 159 of file ParserOutputAccess.php.

References MediaWiki\Revision\RevisionRecord\audienceCan(), CACHE_NONE, MediaWiki\Page\PageIdentity\exists(), MediaWiki\Revision\RevisionRecord\getId(), and MediaWiki\Page\PageRecord\getLatest().

Member Data Documentation

◆ $lbFactory

ILBFactory MediaWiki\Page\ParserOutputAccess::$lbFactory
private

◆ $loggerSpi

LoggerSpi MediaWiki\Page\ParserOutputAccess::$loggerSpi
private

◆ $primaryCache

ParserCache MediaWiki\Page\ParserOutputAccess::$primaryCache
private
Initial value:
=
private const CACHE_SECONDARY 'secondary'

Definition at line 89 of file ParserOutputAccess.php.

Referenced by MediaWiki\Page\ParserOutputAccess\__construct().

◆ $revisionLookup

RevisionLookup MediaWiki\Page\ParserOutputAccess::$revisionLookup
private

◆ $revisionRenderer

RevisionRenderer MediaWiki\Page\ParserOutputAccess::$revisionRenderer
private

◆ $secondaryCache

RevisionOutputCache MediaWiki\Page\ParserOutputAccess::$secondaryCache
private

◆ $statsDataFactory

IBufferingStatsdDataFactory MediaWiki\Page\ParserOutputAccess::$statsDataFactory
private

◆ $titleFormatter

TitleFormatter MediaWiki\Page\ParserOutputAccess::$titleFormatter
private

◆ $wikiPageFactory

WikiPageFactory MediaWiki\Page\ParserOutputAccess::$wikiPageFactory
private

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