MediaWiki  1.34.0
Revision\RevisionRenderer Class Reference

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

Collaboration diagram for Revision\RevisionRenderer:

Public Member Functions

 __construct (ILoadBalancer $loadBalancer, SlotRoleRegistry $roleRegistry, $dbDomain=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. More...
 
 getSpeculativePageId ( $dbIndex)
 
 getSpeculativeRevId ( $dbIndex)
 

Private Attributes

string bool $dbDomain
 
ILoadBalancer $loadBalancer
 
SlotRoleRegistry $roleRegistery
 
LoggerInterface $saveParseLogger
 

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()

Revision\RevisionRenderer::__construct ( ILoadBalancer  $loadBalancer,
SlotRoleRegistry  $roleRegistry,
  $dbDomain = false 
)
Parameters
ILoadBalancer$loadBalancer
SlotRoleRegistry$roleRegistry
bool | string$dbDomainDB domain of the relevant wiki or false for the current one

Definition at line 64 of file RevisionRenderer.php.

References Revision\RevisionRenderer\$dbDomain, and Revision\RevisionRenderer\$loadBalancer.

Member Function Documentation

◆ combineSlotOutput()

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 207 of file RevisionRenderer.php.

References Revision\RenderedRevision\getOptions(), Revision\RenderedRevision\getRevision(), Revision\RenderedRevision\getSlotParserOutput(), and Revision\SlotRecord\MAIN.

Referenced by Revision\RevisionRenderer\getRenderedRevision().

◆ getRenderedRevision()

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.
  • 'known-revision-output' a combined ParserOutput for the revision, perhaps from some cache. the caller is responsible for ensuring that the ParserOutput indeed matched the $rev and $options. This mechanism is intended as a temporary stop-gap, for the time until caches have been changed to store RenderedRevision states instead of ParserOutput objects. -param array{use-master?:bool,audience?:int,known-revision-output?:ParserOutput} $hints
Returns
RenderedRevision|null The rendered revision, or null if the audience checks fails.

Definition at line 102 of file RevisionRenderer.php.

References Revision\RevisionRenderer\$dbDomain, $title, Revision\RevisionRecord\audienceCan(), Revision\RevisionRenderer\combineSlotOutput(), DB_MASTER, DB_REPLICA, Revision\RevisionRecord\DELETED_TEXT, Revision\RevisionRecord\FOR_PUBLIC, Revision\RevisionRecord\FOR_THIS_USER, Revision\RevisionRecord\getId(), Revision\RevisionRecord\getPageAsLinkTarget(), Revision\RevisionRenderer\getSpeculativePageId(), Revision\RevisionRenderer\getSpeculativeRevId(), Revision\RevisionRecord\getTimestamp(), Revision\RevisionRecord\getWikiId(), ParserOptions\newCanonical(), Title\newFromLinkTarget(), and Revision\RenderedRevision\setSaveParseLogger().

Referenced by RefreshLinksJob\getParserOutput().

◆ getSpeculativePageId()

Revision\RevisionRenderer::getSpeculativePageId (   $dbIndex)
private

Definition at line 182 of file RevisionRenderer.php.

Referenced by Revision\RevisionRenderer\getRenderedRevision().

◆ getSpeculativeRevId()

Revision\RevisionRenderer::getSpeculativeRevId (   $dbIndex)
private

Definition at line 167 of file RevisionRenderer.php.

Referenced by Revision\RevisionRenderer\getRenderedRevision().

◆ setLogger()

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

Definition at line 78 of file RevisionRenderer.php.

References Revision\RevisionRenderer\$saveParseLogger.

Member Data Documentation

◆ $dbDomain

string bool Revision\RevisionRenderer::$dbDomain
private

◆ $loadBalancer

ILoadBalancer Revision\RevisionRenderer::$loadBalancer
private

Definition at line 51 of file RevisionRenderer.php.

Referenced by Revision\RevisionRenderer\__construct().

◆ $roleRegistery

SlotRoleRegistry Revision\RevisionRenderer::$roleRegistery
private

Definition at line 54 of file RevisionRenderer.php.

◆ $saveParseLogger

LoggerInterface Revision\RevisionRenderer::$saveParseLogger
private

Definition at line 48 of file RevisionRenderer.php.

Referenced by Revision\RevisionRenderer\setLogger().


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