MediaWiki 1.42.1
MediaWiki\Page\ParserOutputAccess Class Reference

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

Public Member Functions

 __construct (ParserCacheFactory $parserCacheFactory, RevisionLookup $revisionLookup, RevisionRenderer $revisionRenderer, IBufferingStatsdDataFactory $statsDataFactory, ILBFactory $lbFactory, ChronologyProtector $chronologyProtector, 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.
 

Public Attributes

const OPT_FOR_ARTICLE_VIEW = 16
 Apply page view semantics.
 
const PARSOID_PCACHE_NAME = 'parsoid-' . ParserCacheFactory::DEFAULT_NAME
 
const PARSOID_RCACHE_NAME = 'parsoid-' . ParserCacheFactory::DEFAULT_RCACHE_NAME
 

Protected Member Functions

 newPoolWorkArticleView (PageRecord $page, ParserOptions $parserOptions, RevisionRecord $revision, int $options)
 

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

Definition at line 53 of file ParserOutputAccess.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\ParserOutputAccess::__construct ( ParserCacheFactory $parserCacheFactory,
RevisionLookup $revisionLookup,
RevisionRenderer $revisionRenderer,
IBufferingStatsdDataFactory $statsDataFactory,
ILBFactory $lbFactory,
ChronologyProtector $chronologyProtector,
LoggerSpi $loggerSpi,
WikiPageFactory $wikiPageFactory,
TitleFormatter $titleFormatter )
Parameters
ParserCacheFactory$parserCacheFactory
RevisionLookup$revisionLookup
RevisionRenderer$revisionRenderer
IBufferingStatsdDataFactory$statsDataFactory
ILBFactory$lbFactory
ChronologyProtector$chronologyProtector
LoggerSpi$loggerSpi
WikiPageFactory$wikiPageFactory
TitleFormatter$titleFormatter

Definition at line 158 of file ParserOutputAccess.php.

Member Function Documentation

◆ 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 231 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 if 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 289 of file ParserOutputAccess.php.

◆ newPoolWorkArticleView()

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

Definition at line 453 of file ParserOutputAccess.php.

References MediaWiki\Revision\RevisionRecord\getId().

Member Data Documentation

◆ OPT_FOR_ARTICLE_VIEW

const MediaWiki\Page\ParserOutputAccess::OPT_FOR_ARTICLE_VIEW = 16

Apply page view semantics.

This relaxes some guarantees, specifically:

  • Use PoolCounter for stampede protection, causing the request to block until another process has finished rendering the content.
  • Allow stale parser output to be returned to prevent long waits for slow renders.
  • Allow cacheable placeholder output to be returned when PoolCounter fails to obtain a lock. See the PoolCounterConf setting for details.
See also
Bug T352837
Since
1.42

Definition at line 105 of file ParserOutputAccess.php.

◆ PARSOID_PCACHE_NAME

const MediaWiki\Page\ParserOutputAccess::PARSOID_PCACHE_NAME = 'parsoid-' . ParserCacheFactory::DEFAULT_NAME
Access: internal

Definition at line 56 of file ParserOutputAccess.php.

◆ PARSOID_RCACHE_NAME

const MediaWiki\Page\ParserOutputAccess::PARSOID_RCACHE_NAME = 'parsoid-' . ParserCacheFactory::DEFAULT_RCACHE_NAME
Access: internal

Definition at line 59 of file ParserOutputAccess.php.


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