From: Aaron Schulz Date: Thu, 16 Jun 2016 20:01:38 +0000 (-0700) Subject: Disable expensive {{REVISIONID}} magic word in miser mode X-Git-Tag: 1.34.0-rc.0~2192^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=c537eb186862b38c2e5153fbfa300660f7896ac3;p=lhc%2Fweb%2Fwiklou.git Disable expensive {{REVISIONID}} magic word in miser mode This only applies to content namespaces for now since the cost of vary-revision-id is much less of a concern. The potential to harm page save time is far worse than what use they have, which is almost entirely just hacks to check for preview mode. These have nothing to do with the actual revision ID nor timestamp itself. They simply check whether the value is the empty string. Since this magic word still only returns an empty string in preview mode, such checks will keep working. Bug: T137900 Depends-on: I1809354055513a5b9d9589e2d6acda7579af76e2 Change-Id: Ieff8423ae3804b42d264f630e1a029199abf5976 --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 0fe456df09..b0c4bf9c1a 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2592,6 +2592,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 ) {