Index: trunk/phase3/maintenance/refreshLinks.php |
— | — | @@ -66,8 +66,8 @@ |
67 | 67 | $dbr = wfGetDB( DB_SLAVE ); |
68 | 68 | $start = intval( $start ); |
69 | 69 | |
70 | | - # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway) |
71 | | - $wgUser->setOption( 'math', MW_MATH_SOURCE ); |
| 70 | + // Give extensions a chance to optimize settings |
| 71 | + wfRunHooks( 'MaintenanceRefreshLinksInit', array( $this ) ); |
72 | 72 | |
73 | 73 | # Don't generate extension images (e.g. Timeline) |
74 | 74 | $wgParser->clearTagHooks(); |
Index: trunk/phase3/includes/Defines.php |
— | — | @@ -96,17 +96,6 @@ |
97 | 97 | ); |
98 | 98 | |
99 | 99 | /**@{ |
100 | | - * Maths constants |
101 | | - */ |
102 | | -define( 'MW_MATH_PNG', 0 ); |
103 | | -define( 'MW_MATH_SIMPLE', 1 ); |
104 | | -define( 'MW_MATH_HTML', 2 ); |
105 | | -define( 'MW_MATH_SOURCE', 3 ); |
106 | | -define( 'MW_MATH_MODERN', 4 ); |
107 | | -define( 'MW_MATH_MATHML', 5 ); |
108 | | -/**@}*/ |
109 | | - |
110 | | -/**@{ |
111 | 100 | * Cache type |
112 | 101 | */ |
113 | 102 | define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works |
Index: trunk/phase3/includes/LocalisationCache.php |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | * All item keys |
83 | 83 | */ |
84 | 84 | static public $allKeys = array( |
85 | | - 'fallback', 'namespaceNames', 'mathNames', 'bookstoreList', |
| 85 | + 'fallback', 'namespaceNames', 'bookstoreList', |
86 | 86 | 'magicWords', 'messages', 'rtl', 'capitalizeAllNouns', 'digitTransformTable', |
87 | 87 | 'separatorTransformTable', 'fallback8bitEncoding', 'linkPrefixExtension', |
88 | 88 | 'defaultUserOptionOverrides', 'linkTrail', 'namespaceAliases', |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | * Keys for items which consist of associative arrays, which may be merged |
96 | 96 | * by a fallback sequence. |
97 | 97 | */ |
98 | | - static public $mergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames', |
| 98 | + static public $mergeableMapKeys = array( 'messages', 'namespaceNames', |
99 | 99 | 'dateFormats', 'defaultUserOptionOverrides', 'imageFiles', |
100 | 100 | 'preloadedMessages', |
101 | 101 | ); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -122,18 +122,6 @@ |
123 | 123 | $namespaceGenderAliases = array(); |
124 | 124 | |
125 | 125 | /** |
126 | | - * Deprecated, use the message array |
127 | | - */ |
128 | | -$mathNames = array( |
129 | | - MW_MATH_PNG => 'mw_math_png', |
130 | | - MW_MATH_SIMPLE => 'mw_math_simple', |
131 | | - MW_MATH_HTML => 'mw_math_html', |
132 | | - MW_MATH_SOURCE => 'mw_math_source', |
133 | | - MW_MATH_MODERN => 'mw_math_modern', |
134 | | - MW_MATH_MATHML => 'mw_math_mathml' |
135 | | -); |
136 | | - |
137 | | -/** |
138 | 126 | * A list of date format preference keys which can be selected in user |
139 | 127 | * preferences. New preference keys can be added, provided they are supported |
140 | 128 | * by the language class's timeanddate(). Only the 5 keys listed below are |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -495,10 +495,6 @@ |
496 | 496 | ); |
497 | 497 | } |
498 | 498 | |
499 | | - function getMathNames() { |
500 | | - return self::$dataCache->getItem( $this->mCode, 'mathNames' ); |
501 | | - } |
502 | | - |
503 | 499 | function getDatePreferences() { |
504 | 500 | return self::$dataCache->getItem( $this->mCode, 'datePreferences' ); |
505 | 501 | } |
Index: trunk/extensions/Math/Math.php |
— | — | @@ -26,6 +26,17 @@ |
27 | 27 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Math', |
28 | 28 | ); |
29 | 29 | |
| 30 | +/**@{ |
| 31 | + * Maths constants |
| 32 | + */ |
| 33 | +define( 'MW_MATH_PNG', 0 ); |
| 34 | +define( 'MW_MATH_SIMPLE', 1 ); |
| 35 | +define( 'MW_MATH_HTML', 2 ); |
| 36 | +define( 'MW_MATH_SOURCE', 3 ); |
| 37 | +define( 'MW_MATH_MODERN', 4 ); |
| 38 | +define( 'MW_MATH_MATHML', 5 ); |
| 39 | +/**@}*/ |
| 40 | + |
30 | 41 | /** For back-compat */ |
31 | 42 | $wgUseTeX = true; |
32 | 43 | |
Index: trunk/extensions/Math/Math.hooks.php |
— | — | @@ -60,10 +60,41 @@ |
61 | 61 | global $wgLang; |
62 | 62 | $defaultPreferences['math'] = array( |
63 | 63 | 'type' => 'radio', |
64 | | - 'options' => array_flip( array_map( 'wfMsgHtml', $wgLang->getMathNames() ) ), |
| 64 | + 'options' => array_flip( array_map( 'wfMsgHtml', self::getMathNames() ) ), |
65 | 65 | 'label' => ' ', |
66 | 66 | 'section' => 'rendering/math', |
67 | 67 | ); |
68 | 68 | return true; |
69 | 69 | } |
| 70 | + |
| 71 | + /** |
| 72 | + * List of message keys for the various math output settings. |
| 73 | + * |
| 74 | + * @return array of strings |
| 75 | + */ |
| 76 | + private static function getMathNames() { |
| 77 | + return array( |
| 78 | + MW_MATH_PNG => 'mw_math_png', |
| 79 | + MW_MATH_SIMPLE => 'mw_math_simple', |
| 80 | + MW_MATH_HTML => 'mw_math_html', |
| 81 | + MW_MATH_SOURCE => 'mw_math_source', |
| 82 | + MW_MATH_MODERN => 'mw_math_modern', |
| 83 | + MW_MATH_MATHML => 'mw_math_mathml' |
| 84 | + ); |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * MaintenanceRefreshLinksInit handler; optimize settings for refreshLinks batch job. |
| 89 | + * |
| 90 | + * @param Maintenance $maint |
| 91 | + * @return boolean hook return code |
| 92 | + */ |
| 93 | + static function onMaintenanceRefreshLinksInit( $maint ) { |
| 94 | + global $wgUser; |
| 95 | + |
| 96 | + # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway) |
| 97 | + $wgUser->setOption( 'math', MW_MATH_SOURCE ); |
| 98 | + |
| 99 | + return true; |
| 100 | + } |
70 | 101 | } |