Merge "Remove redundant ExtensionRegistry callback"

This commit is contained in:
jenkins-bot 2021-02-18 21:51:29 +00:00 committed by Gerrit Code Review
commit 92cc03d300
3 changed files with 8 additions and 12 deletions

View file

@ -11,7 +11,6 @@
"url": "https://www.mediawiki.org/wiki/Extension:Math",
"descriptionmsg": "math-desc",
"license-name": "GPL-2.0-or-later",
"callback": "MathHooks::registerExtension",
"type": "parserhook",
"requires": {
"MediaWiki": ">= 1.35.0"
@ -95,6 +94,7 @@
}
},
"MathDisableTexFilter": {
"description": "To access this at run-time, use MathRenderer::getDisableTexFilter(). Do not use the non-normalized configuration directly.",
"value": "new"
},
"MathEnableExperimentalInputFormats": {
@ -122,6 +122,7 @@
"value": false
},
"MathValidModes": {
"description": "To access this at run-time, use MathRenderer::getValidModes(). Do not use the non-normalized configuration directly.",
"value": [
"png",
"source",

View file

@ -252,7 +252,8 @@ class MathHooks {
if ( !in_array( $mode, $validModes ) ) {
LoggerFactory::getInstance( 'Math' )->error( 'Misconfiguration: ' .
"\$wgDefaultUserOptions['math'] is not in [ " . implode( ', ', $validModes ) . " ].\n" .
"Please check your LocalSetting.php file." );
"Please check your LocalSettings.php file."
);
// Display the checkbox in the first option.
$wgDefaultUserOptions['math'] = $validModes[0];
}
@ -368,16 +369,6 @@ class MathHooks {
return true;
}
public static function registerExtension() {
global $wgDefaultUserOptions, $wgMathValidModes, $wgMathDisableTexFilter;
$wgMathValidModes = MathRenderer::getValidModes();
if ( $wgMathDisableTexFilter === true ) { // ensure backwards compatibility
$wgMathDisableTexFilter = 'never';
}
$wgMathDisableTexFilter = MathRenderer::getDisableTexFilter();
$wgDefaultUserOptions['math'] = self::mathModeToString( $wgDefaultUserOptions['math'] );
}
/**
* Callback function for the <ce> parser hook.
*

View file

@ -716,6 +716,10 @@ abstract class MathRenderer {
public static function getDisableTexFilter() {
global $wgMathDisableTexFilter;
if ( $wgMathDisableTexFilter === true ) {
// ensure backwards compatibility
$wgMathDisableTexFilter = 'never';
}
return MathHooks::mathCheckToString( $wgMathDisableTexFilter );
}