mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 07:34:22 +00:00
Remove redundant ExtensionRegistry callback
This additional hook does not seem to be needed. - wgMathValidModes: All access to this information already uses getValidModes() and thus there is no need to write this back to the input variable (use outside the extension is not supported and it is already not used as cache either). - wgMathDisableTexFilter: All access already uses getDisableTexFilter() Move the last bit of logic there instead. - wgDefaultUserOptions: Duplicate of this already exists in the onGetPreferences hook higher up. This seems almost too easy, so I suspect someone tried this before and intentionally didn't finish it because of some non-obvious issue. See T189966 for related perf anaysis. Change-Id: I4d7fdf6fcae3d44a37bf80d9c72fff2b4361f0c9
This commit is contained in:
parent
7780424504
commit
2308e436ce
|
@ -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",
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -714,6 +714,10 @@ abstract class MathRenderer {
|
|||
|
||||
public static function getDisableTexFilter() {
|
||||
global $wgMathDisableTexFilter;
|
||||
if ( $wgMathDisableTexFilter === true ) {
|
||||
// ensure backwards compatibility
|
||||
$wgMathDisableTexFilter = 'never';
|
||||
}
|
||||
return MathHooks::mathCheckToString( $wgMathDisableTexFilter );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue