Always cache magic word expansions

The existing magic word API (including hooks) gives implementers direct
access to $parser->mVarCache and full control of caching.  Simplify the
implementation (prior to moving the magic word implementations out of
Parser.php) by always caching built-in magic words in $parser->mVarCache.

The cases which were skipping the cache don't vary anyway.

This behavior change is split from the rest of the refactoring in
I68fb1e786374e445b7df047934c532d7e10b8e94 to allow it to be deployed
separately, just in case there was some strange reason this would
cause regressions in practice.

Bug: T236813
Change-Id: I34a0d9a37e41c854c801d546427fc8cd0fe39dc4
This commit is contained in:
C. Scott Ananian 2020-03-26 17:22:04 -04:00
parent fa5c5b1ad9
commit 063445581c

View file

@ -2989,21 +2989,29 @@ class Parser {
$value = SpecialVersion::getVersion();
break;
case 'articlepath':
return $this->svcOptions->get( 'ArticlePath' );
$value = $this->svcOptions->get( 'ArticlePath' );
break;
case 'sitename':
return $this->svcOptions->get( 'Sitename' );
$value = $this->svcOptions->get( 'Sitename' );
break;
case 'server':
return $this->svcOptions->get( 'Server' );
$value = $this->svcOptions->get( 'Server' );
break;
case 'servername':
return $this->svcOptions->get( 'ServerName' );
$value = $this->svcOptions->get( 'ServerName' );
break;
case 'scriptpath':
return $this->svcOptions->get( 'ScriptPath' );
$value = $this->svcOptions->get( 'ScriptPath' );
break;
case 'stylepath':
return $this->svcOptions->get( 'StylePath' );
$value = $this->svcOptions->get( 'StylePath' );
break;
case 'directionmark':
return $pageLang->getDirMark();
$value = $pageLang->getDirMark();
break;
case 'contentlanguage':
return $this->svcOptions->get( 'LanguageCode' );
$value = $this->svcOptions->get( 'LanguageCode' );
break;
case 'pagelanguage':
$value = $pageLang->getCode();
break;