mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-28 01:10:09 +00:00
Introduce a "MathEnableWikibaseDataType" config
Set to true per default. In order to be able to switch it off in production for a coordinated deployment. Change-Id: I520b2ff1ae6dc3bad4b6067f0b673821d3c01cb4
This commit is contained in:
parent
9625dbc8e5
commit
d955be7eca
|
@ -3,14 +3,20 @@
|
||||||
use ValueFormatters\FormatterOptions;
|
use ValueFormatters\FormatterOptions;
|
||||||
use ValueParsers\StringParser;
|
use ValueParsers\StringParser;
|
||||||
use Wikibase\Repo\Parsers\WikibaseStringValueNormalizer;
|
use Wikibase\Repo\Parsers\WikibaseStringValueNormalizer;
|
||||||
use Wikibase\Repo\Validators\CompositeValidator;
|
|
||||||
use Wikibase\Repo\WikibaseRepo;
|
use Wikibase\Repo\WikibaseRepo;
|
||||||
|
|
||||||
class MathWikidataHook {
|
class MathWikidataHook {
|
||||||
/*
|
|
||||||
|
/**
|
||||||
* Add Datatype "Math" to the Wikibase Repository
|
* Add Datatype "Math" to the Wikibase Repository
|
||||||
*/
|
*/
|
||||||
public static function onWikibaseRepoDataTypes( array &$dataTypeDefinitions ) {
|
public static function onWikibaseRepoDataTypes( array &$dataTypeDefinitions ) {
|
||||||
|
global $wgMathEnableWikibaseDataType;
|
||||||
|
|
||||||
|
if ( !$wgMathEnableWikibaseDataType ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$dataTypeDefinitions['PT:math'] = array(
|
$dataTypeDefinitions['PT:math'] = array(
|
||||||
'value-type' => 'string',
|
'value-type' => 'string',
|
||||||
'validator-factory-callback' => function() {
|
'validator-factory-callback' => function() {
|
||||||
|
@ -42,6 +48,12 @@ class MathWikidataHook {
|
||||||
* Add Datatype "Math" to the Wikibase Client
|
* Add Datatype "Math" to the Wikibase Client
|
||||||
*/
|
*/
|
||||||
public static function onWikibaseClientDataTypes( array &$dataTypeDefinitions ) {
|
public static function onWikibaseClientDataTypes( array &$dataTypeDefinitions ) {
|
||||||
|
global $wgMathEnableWikibaseDataType;
|
||||||
|
|
||||||
|
if ( !$wgMathEnableWikibaseDataType ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$dataTypeDefinitions['PT:math'] = array(
|
$dataTypeDefinitions['PT:math'] = array(
|
||||||
'value-type' => 'string',
|
'value-type' => 'string',
|
||||||
'formatter-factory-callback' => function( $format, FormatterOptions $options ) {
|
'formatter-factory-callback' => function( $format, FormatterOptions $options ) {
|
||||||
|
|
|
@ -110,6 +110,7 @@
|
||||||
"source",
|
"source",
|
||||||
"mathml"
|
"mathml"
|
||||||
],
|
],
|
||||||
|
"MathEnableWikibaseDataType": true,
|
||||||
"Texvc": false,
|
"Texvc": false,
|
||||||
"TexvcBackgroundColor": "transparent"
|
"TexvcBackgroundColor": "transparent"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue