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
This commit is contained in:
parent
30b05e1072
commit
c537eb1868
1 changed files with 12 additions and 0 deletions
|
|
@ -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 ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue