Deprecate the ParserGetVariableValueVarCache hook

We don't want to expose the internal caching mechanism of the parser.
There are no uses in deployed WMF code:

https://codesearch.wmflabs.org/deployed/?q=ParserGetVariableValueVarCache&i=nope&files=&repos=

Bug: T236813
Change-Id: I1b0a5cf7d32be86a45d7231940360e2bfce7275f
This commit is contained in:
C. Scott Ananian 2020-03-26 17:56:19 -04:00
parent 8ca9f34270
commit 99f6b82995
3 changed files with 5 additions and 3 deletions

View file

@ -697,6 +697,7 @@ because of Phabricator reports.
Use RevisionStore::getFirstRevision instead.
* The Parser::enableOOUI() method has been deprecated. Use
$parser->getOutput()->enableOOUI() instead.
* The ParserGetVariableValueVarCache hook has been deprecated.
* …
=== Other changes in 1.35 ===

View file

@ -2602,8 +2602,8 @@ custom magic word
[&]$parser: Parser object
&$time: actual time (timestamp)
'ParserGetVariableValueVarCache': use this to change the value of the variable
cache or return false to not use it.
'ParserGetVariableValueVarCache': DEPRECATED since 1.35! Use this to
change the value of the variable cache or return false to not use it.
[&]$parser: Parser object
&$varCache: variable cache (array)

View file

@ -2694,7 +2694,8 @@ class Parser {
* expensive to check many times.
*/
if (
Hooks::run( 'ParserGetVariableValueVarCache', [ &$parser, &$this->mVarCache ] ) &&
// Using this hook to override the magic word cache is deprecated.
Hooks::run( 'ParserGetVariableValueVarCache', [ &$parser, &$this->mVarCache ], '1.35' ) &&
isset( $this->mVarCache[$index] )
) {
return $this->mVarCache[$index];