diff --git a/includes/Revision/RenderedRevision.php b/includes/Revision/RenderedRevision.php index 1a27271232e..aba514ca6ed 100644 --- a/includes/Revision/RenderedRevision.php +++ b/includes/Revision/RenderedRevision.php @@ -259,12 +259,16 @@ class RenderedRevision implements SlotRenderingProvider { * @return ParserOutput */ private function getSlotParserOutputUncached( Content $content, $withHtml ) { - return $content->getParserOutput( + $parserOutput = $content->getParserOutput( $this->title, $this->revision->getId(), $this->options, $withHtml ); + // Save the rev_id and timestamp so that we don't have to load the revision row on view + $parserOutput->setCacheRevisionId( $this->revision->getId() ); + $parserOutput->setTimestamp( $this->revision->getTimestamp() ); + return $parserOutput; } /** diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 2a2360793e9..1d28fb42aa4 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -497,9 +497,6 @@ class ParserCache { $metadata->getUsedOptions() ); - // Save the timestamp so that we don't have to load the revision row on view - $parserOutput->setTimestamp( $wikiPage->getTimestamp() ); - $msg = "Saved in parser cache with key $parserOutputKey" . " and timestamp $cacheTime" . " and revision id $revId."; diff --git a/tests/phpunit/includes/Revision/RevisionRendererTest.php b/tests/phpunit/includes/Revision/RevisionRendererTest.php index cb3a780886e..b6c669f338e 100644 --- a/tests/phpunit/includes/Revision/RevisionRendererTest.php +++ b/tests/phpunit/includes/Revision/RevisionRendererTest.php @@ -385,7 +385,12 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase { $this->assertSame( $rev, $rr->getRevision() ); $this->assertSame( $options, $rr->getOptions() ); - $html = $rr->getRevisionParserOutput()->getText(); + $parserOutput = $rr->getRevisionParserOutput(); + // Assert parser output recorded timestamp and parsed rev_id + $this->assertSame( $rev->getId(), $parserOutput->getCacheRevisionId() ); + $this->assertSame( $rev->getTimestamp(), $parserOutput->getTimestamp() ); + + $html = $parserOutput->getText(); // Suppressed content should be visible in raw mode $this->assertStringContainsString( 'page:' . __CLASS__, $html );