Merge "Disable expensive {{REVISIONID}} magic word in miser mode"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 2 Apr 2019 20:24:25 +0000 (20:24 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 2 Apr 2019 20:24:25 +0000 (20:24 +0000)
includes/parser/Parser.php

index 0440e89..a1a784b 100644 (file)
@@ -2587,6 +2587,18 @@ class Parser {
                $ts = wfTimestamp( TS_UNIX, $this->mOptions->getTimestamp() );
                Hooks::run( 'ParserGetVariableValueTs', [ &$parser, &$ts ] );
 
+               // In miser mode, disable words that always cause double-parses on page save (T137900)
+               static $slowRevWords = [ 'revisionid' => true ]; // @TODO: 'revisiontimestamp'
+               if (
+                       isset( $slowRevWords[$index] ) &&
+                       $this->siteConfig->get( 'MiserMode' ) &&
+                       !$this->mOptions->getInterfaceMessage() &&
+                       // @TODO: disallow this word on all namespaces
+                       MWNamespace::isContent( $this->mTitle->getNamespace() )
+               ) {
+                       return $this->mRevisionId ? '-' : '';
+               };
+
                $pageLang = $this->getFunctionLang();
 
                switch ( $index ) {