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
This commit is contained in:
Aaron Schulz 2019-06-27 16:40:10 -07:00 committed by jenkins-bot
parent 9309269892
commit e5097e6145

View file

@ -274,11 +274,16 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase {
$this->getParser()->getOutput()->addTemplate( $this->getParser()->getOutput()->addTemplate(
$title, $title->getArticleID(), $title->getLatestRevID() $title, $title->getArticleID(), $title->getLatestRevID()
); );
if ( $title->equals( $this->getTitle() ) ) {
$this->getParser()->getOutput()->setFlag( 'vary-revision' );
}
$rev = $this->getParser()->fetchCurrentRevisionOfTitle( $title ); $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; return $rev ? $rev->getContent() : null;
} }