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:
Marius Hoch 2016-01-12 21:21:46 +01:00
parent 9625dbc8e5
commit d955be7eca
2 changed files with 15 additions and 2 deletions

View file

@ -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 ) {

View file

@ -110,6 +110,7 @@
"source", "source",
"mathml" "mathml"
], ],
"MathEnableWikibaseDataType": true,
"Texvc": false, "Texvc": false,
"TexvcBackgroundColor": "transparent" "TexvcBackgroundColor": "transparent"
}, },