MediaWiki REL1_35
|
RenderedRevision represents the rendered representation of a revision. More...
Public Member Functions | |
__construct (Title $title, RevisionRecord $revision, ParserOptions $options, callable $combineOutput, $audience=RevisionRecord::FOR_PUBLIC, User $forUser=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. | |
Private Member Functions | |
getSlotParserOutputUncached (Content $content, $withHtml) | |
outputVariesOnRevisionMetaData (ParserOutput $out, $actualPageId, $actualRevId, $actualRevTimestamp) | |
pruneRevisionSensitiveOutput ( $actualPageId, $actualRevId, $actualRevTimestamp) | |
Prune any output that depends on the revision ID. | |
setRevisionInternal (RevisionRecord $revision) | |
Private Attributes | |
int | $audience = RevisionRecord::FOR_PUBLIC |
Audience to check when accessing content. | |
callable | $combineOutput |
Callback for combining slot output into revision output. | |
User null | $forUser = null |
The user to use for audience checks during content access. | |
ParserOptions | $options |
RevisionRecord | $revision |
ParserOutput null | $revisionOutput = null |
The combined ParserOutput for the revision, initialized lazily by getRevisionParserOutput(). | |
LoggerInterface | $saveParseLogger |
For profiling ParserOutput re-use. | |
ParserOutput[] | $slotsOutput = [] |
The ParserOutput for each slot, initialized lazily by getSlotParserOutput(). | |
Title | $title |
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.
Definition at line 43 of file RenderedRevision.php.
MediaWiki\Revision\RenderedRevision::__construct | ( | Title | $title, |
RevisionRecord | $revision, | ||
ParserOptions | $options, | ||
callable | $combineOutput, | ||
$audience = RevisionRecord::FOR_PUBLIC , |
|||
User | $forUser = null |
||
) |
Title | $title | |
RevisionRecord | $revision | The 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 | |
callable | $combineOutput | Callback for combining slot output into revision output. Signature: function ( RenderedRevision $this ): ParserOutput. |
int | $audience | Use RevisionRecord::FOR_PUBLIC, FOR_THIS_USER, or RAW. |
User | null | $forUser | Required if $audience is FOR_THIS_USER. |
Definition at line 107 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\$audience, MediaWiki\Revision\RenderedRevision\$combineOutput, MediaWiki\Revision\RenderedRevision\$forUser, MediaWiki\Revision\RenderedRevision\$options, MediaWiki\Revision\RenderedRevision\$title, MediaWiki\Revision\RevisionRecord\FOR_THIS_USER, and MediaWiki\Revision\RenderedRevision\setRevisionInternal().
MediaWiki\Revision\RenderedRevision::getOptions | ( | ) |
Definition at line 157 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\$options.
Referenced by MediaWiki\Revision\RevisionRenderer\combineSlotOutput().
MediaWiki\Revision\RenderedRevision::getRevision | ( | ) |
Definition at line 150 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\$revision.
Referenced by MediaWiki\Revision\RevisionRenderer\combineSlotOutput().
MediaWiki\Revision\RenderedRevision::getRevisionParserOutput | ( | array | $hints = [] | ) |
array | $hints | Hints given as an associative array. Known keys:
|
Definition at line 191 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\$revisionOutput.
MediaWiki\Revision\RenderedRevision::getSlotParserOutput | ( | $role, | |
array | $hints = [] |
||
) |
string | $role | |
array | $hints | Hints given as an associative array. Known keys:
|
SuppressedDataException | if the content is not accessible for the audience specified in the constructor. |
Implements MediaWiki\Revision\SlotRenderingProvider.
Definition at line 221 of file RenderedRevision.php.
References $content, and MediaWiki\Revision\RenderedRevision\getSlotParserOutputUncached().
Referenced by MediaWiki\Revision\RevisionRenderer\combineSlotOutput().
|
private |
Content | $content | |
bool | $withHtml |
Definition at line 261 of file RenderedRevision.php.
References $content.
Referenced by MediaWiki\Revision\RenderedRevision\getSlotParserOutput().
MediaWiki\Revision\RenderedRevision::isContentDeleted | ( | ) |
Definition at line 143 of file RenderedRevision.php.
References MediaWiki\Revision\RevisionRecord\DELETED_TEXT.
|
private |
ParserOutput | $out | |
int | bool | $actualPageId | The actual page id, to check the used speculative page ID against; false, to not purge on vary-page-id; true, to purge on vary-page-id unconditionally. |
int | bool | $actualRevId | The actual rev id, to check the used speculative rev ID against,; false, to not purge on vary-revision-id; true, to purge on vary-revision-id unconditionally. |
string | bool | $actualRevTimestamp | The actual rev timestamp, to check against the parser output revision timestamp; false, to not purge on vary-revision-timestamp; true, to purge on vary-revision-timestamp unconditionally. |
Definition at line 409 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\$saveParseLogger, ParserOutput\getFlag(), ParserOutput\getRevisionTimestampUsed(), ParserOutput\getRevisionUsedSha1Base36(), ParserOutput\getSpeculativePageIdUsed(), and ParserOutput\getSpeculativeRevIdUsed().
Referenced by MediaWiki\Revision\RenderedRevision\pruneRevisionSensitiveOutput().
|
private |
Prune any output that depends on the revision ID.
int | bool | $actualPageId | The actual page id, to check the used speculative page ID against; false, to not purge on vary-page-id; true, to purge on vary-page-id unconditionally. |
int | bool | $actualRevId | The actual rev id, to check the used speculative rev ID against,; false, to not purge on vary-revision-id; true, to purge on vary-revision-id unconditionally. |
string | bool | $actualRevTimestamp | The actual rev timestamp, to check against the parser output revision timestamp; false, to not purge on vary-revision-timestamp; true, to purge on vary-revision-timestamp unconditionally. |
Definition at line 315 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData().
Referenced by MediaWiki\Revision\RenderedRevision\updateRevision().
|
private |
RevisionRecord | $revision |
Definition at line 348 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\$revision, MediaWiki\Revision\RenderedRevision\$title, and Title\equals().
Referenced by MediaWiki\Revision\RenderedRevision\__construct(), and MediaWiki\Revision\RenderedRevision\updateRevision().
MediaWiki\Revision\RenderedRevision::setRevisionParserOutput | ( | ParserOutput | $output | ) |
Sets a ParserOutput to be returned by getRevisionParserOutput().
Definition at line 171 of file RenderedRevision.php.
References MediaWiki\Revision\SlotRecord\MAIN.
MediaWiki\Revision\RenderedRevision::setSaveParseLogger | ( | LoggerInterface | $saveParseLogger | ) |
LoggerInterface | $saveParseLogger |
Definition at line 136 of file RenderedRevision.php.
References MediaWiki\Revision\RenderedRevision\$saveParseLogger.
Referenced by MediaWiki\Revision\RevisionRenderer\getRenderedRevision().
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.
RevisionRecord | $rev |
Definition at line 279 of file RenderedRevision.php.
References MediaWiki\Revision\RevisionRecord\getId(), MediaWiki\Revision\RevisionRecord\getSlots(), MediaWiki\Revision\RenderedRevision\pruneRevisionSensitiveOutput(), and MediaWiki\Revision\RenderedRevision\setRevisionInternal().
|
private |
Audience to check when accessing content.
Definition at line 61 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\__construct().
|
private |
Callback for combining slot output into revision output.
Signature: function ( RenderedRevision $this ): ParserOutput.
Definition at line 84 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\__construct().
|
private |
The user to use for audience checks during content access.
Definition at line 66 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\__construct().
|
private |
Definition at line 56 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\__construct(), and MediaWiki\Revision\RenderedRevision\getOptions().
|
private |
Definition at line 51 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\getRevision(), and MediaWiki\Revision\RenderedRevision\setRevisionInternal().
|
private |
The combined ParserOutput for the revision, initialized lazily by getRevisionParserOutput().
Definition at line 72 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\getRevisionParserOutput().
|
private |
For profiling ParserOutput re-use.
Definition at line 89 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData(), and MediaWiki\Revision\RenderedRevision\setSaveParseLogger().
|
private |
The ParserOutput for each slot, initialized lazily by getSlotParserOutput().
Definition at line 78 of file RenderedRevision.php.
|
private |
Definition at line 48 of file RenderedRevision.php.
Referenced by MediaWiki\Revision\RenderedRevision\__construct(), and MediaWiki\Revision\RenderedRevision\setRevisionInternal().