From 27e7791309b2e34d333903a121a6afbfe24b83ab Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 11 Oct 2018 10:39:05 -0700 Subject: [PATCH] Split out getSlotParserOutputUncached() method for the sake of profiling Change-Id: I553dba13486982b4530d290c84dc1f53b4df6ff9 --- includes/Revision/RenderedRevision.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/includes/Revision/RenderedRevision.php b/includes/Revision/RenderedRevision.php index 9cb20e0c01..6eee3c4cf6 100644 --- a/includes/Revision/RenderedRevision.php +++ b/includes/Revision/RenderedRevision.php @@ -31,6 +31,7 @@ use Psr\Log\NullLogger; use Revision; use Title; use User; +use Content; use Wikimedia\Assert\Assert; /** @@ -207,12 +208,7 @@ class RenderedRevision implements SlotRenderingProvider { 'Access to the content has been suppressed for this audience' ); } else { - $output = $content->getParserOutput( - $this->title, - $this->revision->getId(), - $this->options, - $withHtml - ); + $output = $this->getSlotParserOutputUncached( $content, $withHtml ); if ( $withHtml && !$output->hasText() ) { throw new LogicException( @@ -232,6 +228,21 @@ class RenderedRevision implements SlotRenderingProvider { return $this->slotsOutput[$role]; } + /** + * @note This method exist to make duplicate parses easier to see during profiling + * @param Content $content + * @param bool $withHtml + * @return ParserOutput + */ + private function getSlotParserOutputUncached( Content $content, $withHtml ) { + return $content->getParserOutput( + $this->title, + $this->revision->getId(), + $this->options, + $withHtml + ); + } + /** * 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}} -- 2.20.1