Remove wgMathUseRestBase

Bug: T274436
Change-Id: I0c0311130516646833ef862e047c8f540f40c92a
This commit is contained in:
physikerwelt (Moritz Schubotz) 2021-05-14 14:39:25 +02:00
parent 6117a8eb6d
commit d25dc0fb79
3 changed files with 4 additions and 17 deletions

View file

@ -111,9 +111,6 @@
"MathoidCli": {
"value": false
},
"MathUseRestBase": {
"value": true
},
"MathValidModes": {
"description": "To access this at run-time, use MathRenderer::getValidModes(). Do not use the non-normalized configuration directly.",
"value": [

View file

@ -4,7 +4,6 @@ namespace MediaWiki\Extension\Math;
use DataValues\StringValue;
use InvalidArgumentException;
use MediaWiki\Extension\Math\InputCheck\RestbaseChecker;
use MediaWiki\MediaWikiServices;
use ValueValidators\Error;
use ValueValidators\Result;
@ -26,20 +25,16 @@ class MathValidator implements ValueValidator {
* @throws InvalidArgumentException if not called with a StringValue
*/
public function validate( $value ) {
global $wgMathUseRestBase;
if ( !( $value instanceof StringValue ) ) {
throw new InvalidArgumentException( '$value must be a StringValue' );
}
// get input String from value
$tex = $value->getValue();
if ( $wgMathUseRestBase ) {
$checker = new RestbaseChecker( $tex );
} else {
$checker = MediaWikiServices::getInstance()
->getService( 'Math.CheckerFactory' )
->newMathoidChecker( $tex, 'tex' );
}
if ( $checker->isValid() ) {
return Result::newSuccess();
}

View file

@ -17,11 +17,6 @@ class MathValidatorTest extends MediaWikiTestCase {
private const VADLID_TEX = "\sin x";
private const INVADLID_TEX = "\\notExists";
protected function setUp() : void {
parent::setUp();
$this->setMwGlobals( 'wgMathUseRestBase', false );
}
public function testNotStringValue() {
$validator = new MathValidator();
$this->expectException( InvalidArgumentException::class );