mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
Do proper pre-pack processing for $this->hash.
Output hash calcuation sometimes fails because of Texvc failure for example, and $this->hash remains ''. At this time inserting null as outputhash into database is improper, because that column is NOT NULL. With this patch an empty string '' is inserted instead, and the if-check is modified to avoid cases where ->hash exists but evaluates as null (for example when it's '0000000000...' though it's extremely rare). Change-Id: I852859f4b151b777c11b743faaed61dfc2c029a7
This commit is contained in:
parent
aa8a0eaf19
commit
20192a1ab8
|
@ -154,10 +154,10 @@ abstract class MathRenderer {
|
||||||
# Now save it back to the DB:
|
# Now save it back to the DB:
|
||||||
if ( !wfReadOnly() ) {
|
if ( !wfReadOnly() ) {
|
||||||
$dbw = wfGetDB( DB_MASTER );
|
$dbw = wfGetDB( DB_MASTER );
|
||||||
if ( $this->hash ) {
|
if ( $this->hash !== '' ) {
|
||||||
$outmd5_sql = $dbw->encodeBlob( pack( 'H32', $this->hash ) );
|
$outmd5_sql = $dbw->encodeBlob( pack( 'H32', $this->hash ) );
|
||||||
} else {
|
} else {
|
||||||
$outmd5_sql = null;
|
$outmd5_sql = '';
|
||||||
}
|
}
|
||||||
wfDebugLog( "Math", 'store entry for $' . $this->tex . '$ in database (hash:' . $this->getInputHash() . ')\n' );
|
wfDebugLog( "Math", 'store entry for $' . $this->tex . '$ in database (hash:' . $this->getInputHash() . ')\n' );
|
||||||
$dbw->replace(
|
$dbw->replace(
|
||||||
|
|
Loading…
Reference in a new issue