MediaWiki master
MediaWiki\Revision\RenderedRevision Class Reference

RenderedRevision represents the rendered representation of a revision. More...

Inherits MediaWiki\Revision\SlotRenderingProvider.

Collaboration diagram for MediaWiki\Revision\RenderedRevision:

Public Member Functions

 __construct (RevisionRecord $revision, ParserOptions $options, ContentRenderer $contentRenderer, callable $combineOutput, $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null)
 
 getOptions ()
 
 getRevision ()
 
 getRevisionParserOutput (array $hints=[])
 
 getSlotParserOutput ( $role, array $hints=[])
 
 isContentDeleted ()
 
 setRevisionParserOutput (ParserOutput $output)
 Sets a ParserOutput to be returned by getRevisionParserOutput().
 
 setSaveParseLogger (LoggerInterface $saveParseLogger)
 
 updateRevision (RevisionRecord $rev)
 Updates the RevisionRecord after the revision has been saved.
 

Detailed Description

RenderedRevision represents the rendered representation of a revision.

It acts as a lazy provider of ParserOutput objects for the revision's individual slots, as well as a combined ParserOutput of all slots.

Since
1.32

Definition at line 45 of file RenderedRevision.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Revision\RenderedRevision::__construct ( RevisionRecord $revision,
ParserOptions $options,
ContentRenderer $contentRenderer,
callable $combineOutput,
$audience = RevisionRecord::FOR_PUBLIC,
Authority $performer = null )
Note
Application logic should not instantiate RenderedRevision instances directly, but should use a RevisionRenderer instead.
Parameters
RevisionRecord$revisionThe revision to render. The content for rendering will be taken from this RevisionRecord. However, if the RevisionRecord is not complete according isReadyForInsertion(), but a revision ID is known, the parser may load the revision from the database if it needs revision meta data to handle magic words like {{REVISIONUSER}}.
ParserOptions$options
ContentRenderer$contentRenderer
callable$combineOutputCallback for combining slot output into revision output. Signature: function ( RenderedRevision $this ): ParserOutput.
int$audienceUse RevisionRecord::FOR_PUBLIC, FOR_THIS_USER, or RAW.
Authority | null$performerRequired if $audience is FOR_THIS_USER.

Definition at line 109 of file RenderedRevision.php.

References MediaWiki\Revision\RevisionRecord\FOR_THIS_USER.

Member Function Documentation

◆ getOptions()

MediaWiki\Revision\RenderedRevision::getOptions ( )
Returns
ParserOptions

Definition at line 159 of file RenderedRevision.php.

◆ getRevision()

MediaWiki\Revision\RenderedRevision::getRevision ( )
Returns
RevisionRecord

Definition at line 152 of file RenderedRevision.php.

◆ getRevisionParserOutput()

MediaWiki\Revision\RenderedRevision::getRevisionParserOutput ( array $hints = [])
Parameters
array$hintsHints given as an associative array. Known keys:
  • 'generate-html' => bool: Whether the caller is interested in output HTML (as opposed to just meta-data). Default is to generate HTML.
Returns
ParserOutput

Definition at line 193 of file RenderedRevision.php.

◆ getSlotParserOutput()

MediaWiki\Revision\RenderedRevision::getSlotParserOutput ( $role,
array $hints = [] )
Parameters
string$role
array$hintsHints given as an associative array. Known keys:
  • 'generate-html' => bool: Whether the caller is interested in output HTML (as opposed to just meta-data). Default is to generate HTML.
Exceptions
SuppressedDataExceptionif the content is not accessible for the audience specified in the constructor.
Returns
ParserOutput

Implements MediaWiki\Revision\SlotRenderingProvider.

Definition at line 223 of file RenderedRevision.php.

◆ isContentDeleted()

MediaWiki\Revision\RenderedRevision::isContentDeleted ( )
Returns
bool Whether the revision's content has been hidden from unprivileged users.

Definition at line 145 of file RenderedRevision.php.

References MediaWiki\Revision\RevisionRecord\DELETED_TEXT.

◆ setRevisionParserOutput()

MediaWiki\Revision\RenderedRevision::setRevisionParserOutput ( ParserOutput $output)

Sets a ParserOutput to be returned by getRevisionParserOutput().

Note
For internal use by RevisionRenderer only! This method may be modified or removed without notice per the deprecation policy.
Access: internal
Parameters
ParserOutput$output

Definition at line 173 of file RenderedRevision.php.

References MediaWiki\Revision\SlotRecord\MAIN.

◆ setSaveParseLogger()

MediaWiki\Revision\RenderedRevision::setSaveParseLogger ( LoggerInterface $saveParseLogger)
Parameters
LoggerInterface$saveParseLogger

Definition at line 138 of file RenderedRevision.php.

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

◆ updateRevision()

MediaWiki\Revision\RenderedRevision::updateRevision ( RevisionRecord $rev)

Updates the RevisionRecord after the revision has been saved.

This can be used to discard and cached ParserOutput so parser functions like {{REVISIONTIMESTAMP}} or {{REVISIONID}} are re-evaluated.

Note
There should be no need to call this for null-edits.
Parameters
RevisionRecord$rev

Definition at line 277 of file RenderedRevision.php.

References MediaWiki\Revision\RevisionRecord\getId(), and MediaWiki\Revision\RevisionRecord\getSlots().


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