Skip to content

Commit

Permalink
Fix vardefine and vardefineecho
Browse files Browse the repository at this point in the history
In Variables commit 919e398,[1] they changed the functions for
vardefine and vardefineecho. This patch uses the new ones if available,
and falls back to the older ones if not.

Miraheze Bug: https://issue-tracker.miraheze.org/T12369

[1]: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/Variables/+/919e398a752fce9d9e11c17b6dd08cb7969aaf65%5E%21/
  • Loading branch information
BlankEclair committed Jul 23, 2024
1 parent dced585 commit d26bc7c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/ScribuntoLuaLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,25 @@ public function fnVarFinal() {
public function fnVardefine() {
$params = func_get_args();
$parser = $this->getParser();
return [ ExtVariables::pf_vardefine( $parser, ...$params ) ];
if ( method_exists( 'ExtVariables', 'pfObj_vardefine' ) ) {
return [ ExtVariables::pfObj_vardefine(
$parser, $parser->getPreprocessor()->newFrame(), $params
) ];
} else {
return [ ExtVariables::pf_vardefine( $parser, ...$params ) ];
}
}

public function fnVardefineecho() {
$params = func_get_args();
$parser = $this->getParser();
return [ ExtVariables::pf_vardefineecho( $parser, ...$params ) ];
if ( method_exists( 'ExtVariables', 'pfObj_vardefineecho' ) ) {
return [ ExtVariables::pfObj_vardefineecho(
$parser, $parser->getPreprocessor()->newFrame(), $params
) ];
} else {
return [ ExtVariables::pf_vardefineecho( $parser, ...$params ) ];
}
}

public function fnVarexists() {
Expand Down

0 comments on commit d26bc7c

Please sign in to comment.