From e5097e6145c527a525d63575048f400c0022ce7d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 27 Jun 2019 16:40:10 -0700 Subject: [PATCH] Use "vary-revision-sha1" over "vary-revision" in getContentInternal() These allows for some chance of avoiding extra save parses. Also add wfDebug() call to mention the vary-* flag. Bug: T226432 Depends-on: Idcd30a3fa3f7012dac76ce8bbf46625453ae331f Change-Id: Id3bc207382aac90bd63df2d83d6334aae9b2477d --- includes/engines/LuaCommon/TitleLibrary.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/engines/LuaCommon/TitleLibrary.php b/includes/engines/LuaCommon/TitleLibrary.php index 108a67c9..6a53bc49 100644 --- a/includes/engines/LuaCommon/TitleLibrary.php +++ b/includes/engines/LuaCommon/TitleLibrary.php @@ -274,11 +274,16 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase { $this->getParser()->getOutput()->addTemplate( $title, $title->getArticleID(), $title->getLatestRevID() ); - if ( $title->equals( $this->getTitle() ) ) { - $this->getParser()->getOutput()->setFlag( 'vary-revision' ); - } $rev = $this->getParser()->fetchCurrentRevisionOfTitle( $title ); + + if ( $title->equals( $this->getTitle() ) ) { + $parserOutput = $this->getParser()->getOutput(); + $parserOutput->setFlag( 'vary-revision-sha1' ); + $parserOutput->setRevisionUsedSha1Base36( $rev ? $rev->getSha1() : '' ); + wfDebug( __METHOD__ . ": set vary-revision-sha1 for '$title'" ); + } + return $rev ? $rev->getContent() : null; }