MediaWiki REL1_32
MediaWiki\Revision\RevisionRenderer Class Reference

The RevisionRenderer service provides access to rendered output for revisions. More...

Collaboration diagram for MediaWiki\Revision\RevisionRenderer:

Public Member Functions

 __construct (ILoadBalancer $loadBalancer, $wikiId=false)
 
 getRenderedRevision (RevisionRecord $rev, ParserOptions $options=null, User $forUser=null, array $hints=[])
 
 setLogger (LoggerInterface $saveParseLogger)
 

Private Member Functions

 combineSlotOutput (RenderedRevision $rrev, array $hints=[])
 This implements the layout for combining the output of multiple slots.
 
 getSpeculativeRevId ( $dbIndex)
 

Private Attributes

ILoadBalancer $loadBalancer
 
LoggerInterface $saveParseLogger
 
string bool $wikiId
 

Detailed Description

The RevisionRenderer service provides access to rendered output for revisions.

It does so be acting as a factory for RenderedRevision instances, which in turn provide lazy access to ParserOutput objects.

One key responsibility of RevisionRenderer is implementing the layout used to combine the output of multiple slots.

Since
1.32

Definition at line 45 of file RevisionRenderer.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Revision\RevisionRenderer::__construct ( ILoadBalancer $loadBalancer,
$wikiId = false )
Parameters
ILoadBalancer$loadBalancer
bool | string$wikiId

Definition at line 60 of file RevisionRenderer.php.

References MediaWiki\Revision\RevisionRenderer\$loadBalancer, and MediaWiki\Revision\RevisionRenderer\$wikiId.

Member Function Documentation

◆ combineSlotOutput()

MediaWiki\Revision\RevisionRenderer::combineSlotOutput ( RenderedRevision $rrev,
array $hints = [] )
private

This implements the layout for combining the output of multiple slots.

Todo
Use placement hints from SlotRoleHandlers instead of hard-coding the layout.
Parameters
RenderedRevision$rrev
array$hintssee RenderedRevision::getRevisionParserOutput()
Returns
ParserOutput

Definition at line 167 of file RevisionRenderer.php.

References $html, $options, $out, and MediaWiki\Revision\SlotRecord\MAIN.

Referenced by MediaWiki\Revision\RevisionRenderer\getRenderedRevision().

◆ getRenderedRevision()

MediaWiki\Revision\RevisionRenderer::getRenderedRevision ( RevisionRecord $rev,
ParserOptions $options = null,
User $forUser = null,
array $hints = [] )
Parameters
RevisionRecord$rev
ParserOptions | null$options
User | null$forUserUser for privileged access. Default is unprivileged (public) access, unless the 'audience' hint is set to something else RevisionRecord::RAW.
array$hintsHints given as an associative array. Known keys:
  • 'use-master' Use master when rendering for the parser cache during save. Default is to use a replica.
  • 'audience' the audience to use for content access. Default is RevisionRecord::FOR_PUBLIC if $forUser is not set, RevisionRecord::FOR_THIS_USER if $forUser is set. Can be set to RevisionRecord::RAW to disable audience checks.
Returns
RenderedRevision|null The rendered revision, or null if the audience checks fails.

Definition at line 88 of file RevisionRenderer.php.

References $options, $rev, array(), MediaWiki\Revision\RevisionRenderer\combineSlotOutput(), DB_MASTER, DB_REPLICA, MediaWiki\Revision\RevisionRecord\DELETED_TEXT, MediaWiki\Revision\RevisionRecord\FOR_PUBLIC, MediaWiki\Revision\RevisionRecord\FOR_THIS_USER, MediaWiki\Revision\RevisionRenderer\getSpeculativeRevId(), MediaWiki\Revision\RenderedRevision\setSaveParseLogger(), and use.

◆ getSpeculativeRevId()

MediaWiki\Revision\RevisionRenderer::getSpeculativeRevId ( $dbIndex)
private

Definition at line 139 of file RevisionRenderer.php.

References DB_REPLICA.

Referenced by MediaWiki\Revision\RevisionRenderer\getRenderedRevision().

◆ setLogger()

MediaWiki\Revision\RevisionRenderer::setLogger ( LoggerInterface $saveParseLogger)
Parameters
LoggerInterface$saveParseLogger

Definition at line 70 of file RevisionRenderer.php.

References MediaWiki\Revision\RevisionRenderer\$saveParseLogger.

Member Data Documentation

◆ $loadBalancer

ILoadBalancer MediaWiki\Revision\RevisionRenderer::$loadBalancer
private

◆ $saveParseLogger

LoggerInterface MediaWiki\Revision\RevisionRenderer::$saveParseLogger
private

Definition at line 48 of file RevisionRenderer.php.

Referenced by MediaWiki\Revision\RevisionRenderer\setLogger().

◆ $wikiId

string bool MediaWiki\Revision\RevisionRenderer::$wikiId
private

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