Followup to r85706 and friends: now that Math messages have been moved to extension, move out the settings list and constants.

* MW_MATH_* constants are now defined in Math extension
* Language::getMathNames() is removed
* mathNames section in message files is removed
* A hardcoded preference override in refreshLinks moved to MaintenanceRefreshLinksInit hook
This commit is contained in:
Brion Vibber 2011-04-09 19:57:35 +00:00
parent 23fbd97858
commit 9a767a671a
2 changed files with 43 additions and 1 deletions

View File

@ -60,10 +60,41 @@ class MathHooks {
global $wgLang;
$defaultPreferences['math'] = array(
'type' => 'radio',
'options' => array_flip( array_map( 'wfMsgHtml', $wgLang->getMathNames() ) ),
'options' => array_flip( array_map( 'wfMsgHtml', self::getMathNames() ) ),
'label' => ' ',
'section' => 'rendering/math',
);
return true;
}
/**
* List of message keys for the various math output settings.
*
* @return array of strings
*/
private static function getMathNames() {
return array(
MW_MATH_PNG => 'mw_math_png',
MW_MATH_SIMPLE => 'mw_math_simple',
MW_MATH_HTML => 'mw_math_html',
MW_MATH_SOURCE => 'mw_math_source',
MW_MATH_MODERN => 'mw_math_modern',
MW_MATH_MATHML => 'mw_math_mathml'
);
}
/**
* MaintenanceRefreshLinksInit handler; optimize settings for refreshLinks batch job.
*
* @param Maintenance $maint
* @return boolean hook return code
*/
static function onMaintenanceRefreshLinksInit( $maint ) {
global $wgUser;
# Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway)
$wgUser->setOption( 'math', MW_MATH_SOURCE );
return true;
}
}

View File

@ -26,6 +26,17 @@ $wgExtensionCredits['parserhook'][] = array(
'url' => 'http://www.mediawiki.org/wiki/Extension:Math',
);
/**@{
* Maths constants
*/
define( 'MW_MATH_PNG', 0 );
define( 'MW_MATH_SIMPLE', 1 );
define( 'MW_MATH_HTML', 2 );
define( 'MW_MATH_SOURCE', 3 );
define( 'MW_MATH_MODERN', 4 );
define( 'MW_MATH_MATHML', 5 );
/**@}*/
/** For back-compat */
$wgUseTeX = true;