Use RestBase to check input tex rather than texvccheck

* This will increase the performance of tex rendering for all
 rendering modes since no shell access is required anymore.

 Merge with caution. If the connection to restbase fails, rendering
 of new formulae will be completely disabled i.e. broken.

Change-Id: I1982612e8c6a356e3dbdf447724ac82e5968cc77
This commit is contained in:
physikerwelt 2015-11-30 00:14:22 +01:00 committed by Mobrovac
parent f63eaeac23
commit 897afa480b
2 changed files with 20 additions and 1 deletions

View File

@ -572,7 +572,7 @@ abstract class MathRenderer {
return true;
}
}
$checker = new MathInputCheckTexvc( $this->userInputTex );
$checker = new MathInputCheckRestbase( $this->userInputTex );
if ( $checker->isValid() ) {
$this->setTex( $checker->getValidTex() );
$this->texSecure = true;

View File

@ -8,6 +8,25 @@ class MathRendererTest extends MediaWikiTestCase {
const SOME_TEX = "a+b";
const TEXVCCHECK_INPUT = '\forall \epsilon \exist \delta';
const TEXVCCHECK_OUTPUT = '\forall \epsilon \exists \delta '; // be aware of the s at exists
protected static $hasRestbase;
public static function setUpBeforeClass() {
$rbi = new MathRestbaseInterface();
self::$hasRestbase = $rbi->checkBackend( true );
}
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
parent::setUp();
if ( !self::$hasRestbase ) {
$this->markTestSkipped( "Can not connect to Restbase Math interface." );
}
}
/**
* Checks the tex and hash functions
* @covers MathRenderer::getTex()