jenkins-bot has submitted this change and it was merged. Change subject: Catch misconfiguration of math default option ......................................................................
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 --- M Math.hooks.php 1 file changed, 8 insertions(+), 1 deletion(-) Approvals: TheDJ: Looks good to me, approved jenkins-bot: Verified diff --git a/Math.hooks.php b/Math.hooks.php index cf20545..87d669e 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -141,7 +141,7 @@ * @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 @@ '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; } -- To view, visit https://gerrit.wikimedia.org/r/131439 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1e3c468c0dc92378f7dc7b7d81fb4693e70f6b6f Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Physikerwelt <w...@physikerwelt.de> Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de> Gerrit-Reviewer: TheDJ <hartman.w...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits