From: Aaron Schulz Date: Fri, 12 Apr 2019 23:54:31 +0000 (-0700) Subject: Add vary-revision-exist flag to handle {{REVISIONID}} and parser cache X-Git-Tag: 1.34.0-rc.0~2018^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=5e6d9340cb81d0040cbeb2371a83e884db90cd68;p=lhc%2Fweb%2Fwiklou.git Add vary-revision-exist flag to handle {{REVISIONID}} and parser cache Follow-up to c537eb186862b3 Bug: T220854 Change-Id: Idc19cc29764a38e3671ca1dea158bd5fb46eaf4d --- diff --git a/includes/Revision/RenderedRevision.php b/includes/Revision/RenderedRevision.php index 094105aae8..d3e5938c86 100644 --- a/includes/Revision/RenderedRevision.php +++ b/includes/Revision/RenderedRevision.php @@ -395,6 +395,14 @@ class RenderedRevision implements SlotRenderingProvider { "$method: Prepared output has vary-revision-id with wrong ID...\n" ); return true; + } elseif ( $out->getFlag( 'vary-revision-exists' ) ) { + // If {{REVISIONID}} resolved to '', it now needs to resolve to '-'. + // Note that edit stashing always uses '-', which can be used for both + // edit filter checks and canonical parser cache. + $this->saveParseLogger->info( + "$method: Prepared output has vary-revision-exists...\n" + ); + return true; } else { // NOTE: In the original fix for T135261, the output was discarded if 'vary-user' was // set for a null-edit. The reason was that the original rendering in that case was diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 9ff731d801..91de550fad 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2607,7 +2607,13 @@ class Parser { // @TODO: disallow this word on all namespaces $this->nsInfo->isContent( $this->mTitle->getNamespace() ) ) { - return $this->mRevisionId ? '-' : ''; + if ( $this->mRevisionId ) { + return '-'; + } else { + $this->mOutput->setFlag( 'vary-revision-exists' ); + + return ''; + } }; $pageLang = $this->getFunctionLang();