mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-28 01:10:09 +00:00
Catch misconfiguration of math default option
If the LocalSettings.php has invalid settings for $wgDefaultUserOptions['math'] and $wgValidMathModes the user prefrences pages displays an error. This commit catches this error and selects the first rendering option availible. Bug: 64844 Change-Id: I1e3c468c0dc92378f7dc7b7d81fb4693e70f6b6f
This commit is contained in:
parent
7bcf886644
commit
bb9edf4f7a
|
@ -141,7 +141,7 @@ class MathHooks {
|
|||
* @return Boolean: true
|
||||
*/
|
||||
static function onGetPreferences( $user, &$defaultPreferences ) {
|
||||
global $wgUseMathJax;
|
||||
global $wgUseMathJax, $wgMathValidModes, $wgDefaultUserOptions;
|
||||
$defaultPreferences['math'] = array(
|
||||
'type' => 'radio',
|
||||
'options' => array_flip( self::getMathNames() ),
|
||||
|
@ -155,6 +155,13 @@ class MathHooks {
|
|||
'section' => 'rendering/math',
|
||||
);
|
||||
}
|
||||
// If the default option is not in the valid options the
|
||||
// user interface throws an exception (BUG 64844)
|
||||
if ( ! in_array( $wgDefaultUserOptions['math'] , $wgMathValidModes ) ){
|
||||
wfDebugLog( 'Math', "Warning: Misconfiguration \$wgDefaultUserOptions['math'] is not in \$wgMathValidModes. Please check your LocalSetting.php file.");
|
||||
// Display the checkbox in the first option.
|
||||
$wgDefaultUserOptions['math'] = $wgMathValidModes[0];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue