fix: texvccheck is not idempotent

The output of texvccheck is not only "checked" but also
rewritten to another form.
(For example $\R$ is transformed to $\mathbb{R}$.)
But the output might not be a valid input for the thexvccheck
part of texvc, like it happened in for the example given in the bug
description.
See also I599c4390da9b8f36d800f379a33ad5ce90f5096c
Bug: 61012
Change-Id: Iae5e350cb78c0e637e574390c586fbdb8dc38496
This commit is contained in:
Moritz Schubotz 2014-02-07 09:32:23 +01:00 committed by physikerwelt
parent bbccb1fd27
commit ff83048597
2 changed files with 10 additions and 3 deletions

View file

@ -137,7 +137,7 @@ abstract class MathRenderer {
public function getInputHash() {
// TODO: What happens if $tex is empty?
$dbr = wfGetDB( DB_SLAVE );
return $dbr->encodeBlob( pack( "H32", md5( $this->tex ) ) ); # Binary packed, not hex
return $dbr->encodeBlob( pack( "H32", md5( $this->getUserInputTex() ) ) ); # Binary packed, not hex
}
/**
@ -443,5 +443,12 @@ abstract class MathRenderer {
}
}
}
/**
* @return string original tex string specified by the user
*/
public function getUserInputTex(){
return $this->userInputTex;
}
}

View file

@ -110,7 +110,7 @@ class MathTexvc extends MathRenderer {
* @return int|string MW_TEXVC_SUCCESS or error string
*/
public function callTexvc() {
global $wgTexvc, $wgTexvcBackgroundColor, $wgUseSquid, $wgMathCheckFiles, $wgHooks;
global $wgTexvc, $wgTexvcBackgroundColor, $wgHooks;
wfProfileIn( __METHOD__ );
$tmpDir = wfTempDir();
@ -125,7 +125,7 @@ class MathTexvc extends MathRenderer {
$cmd = $wgTexvc . ' ' .
$escapedTmpDir . ' ' .
$escapedTmpDir . ' ' .
wfEscapeShellArg( $this->getTex() ) . ' ' .
wfEscapeShellArg( $this->getUserInputTex() ) . ' ' .
wfEscapeShellArg( 'UTF-8' ) . ' ' .
wfEscapeShellArg( $wgTexvcBackgroundColor );