<?php
/**
* Contain everything related to <math> </math> parsing
+ * @package MediaWiki
*/
/**
* rendering form is picked and returned.
*
* by Tomasz Wegrzanowski, with additions by Brion Vibber (2003, 2004)
+ *
+ * @package MediaWiki
*/
class MathRenderer {
var $mode = MW_MATH_MODERN;
function render() {
global $wgMathDirectory, $wgTmpDirectory, $wgInputEncoding;
global $wgTexvc;
+ $fname = 'MathRenderer::render';
if( $this->mode == MW_MATH_SOURCE ) {
# No need to render or parse anything more!
$this->conservativeness = 0;
$this->mathml = NULL;
} else if ($retval == 'X') {
- $outhtml = NULL;
+ $this->html = NULL;
$this->mathml = substr ($contents, 33);
$this->conservativeness = 0;
} else if ($retval == '+') {
- $this->outhtml = NULL;
+ $this->html = NULL;
$this->mathml = NULL;
$this->conservativeness = 0;
} else {
}
# Now save it back to the DB:
- $outmd5_sql = pack('H32', $this->hash);
-
- $md5_sql = pack('H32', $this->md5); # Binary packed, not hex
+ if ( !wfReadOnly() ) {
+ $outmd5_sql = pack('H32', $this->hash);
- $dbw =& wfGetDB( DB_MASTER );
- $dbw->replace( 'math', array( 'math_inputhash' ),
- array(
- 'math_inputhash' => $md5_sql,
- 'math_outputhash' => $outmd5_sql,
- 'math_html_conservativeness' => $this->conservativeness,
- 'math_html' => $outhtml,
- 'math_mathml' => $mathml,
- ), $fname, array( 'IGNORE' )
- );
+ $md5_sql = pack('H32', $this->md5); # Binary packed, not hex
+
+ $dbw =& wfGetDB( DB_MASTER );
+ $dbw->replace( 'math', array( 'math_inputhash' ),
+ array(
+ 'math_inputhash' => $md5_sql,
+ 'math_outputhash' => $outmd5_sql,
+ 'math_html_conservativeness' => $this->conservativeness,
+ 'math_html' => $this->html,
+ 'math_mathml' => $this->mathml,
+ ), $fname, array( 'IGNORE' )
+ );
+ }
}
$this->md5 = md5( $this->tex );
$dbr =& wfGetDB( DB_SLAVE );
- $rpage = $dbr->getArray( 'math',
+ $rpage = $dbr->selectRow( 'math',
array( 'math_outputhash','math_html_conservativeness','math_html','math_mathml' ),
array( 'math_inputhash' => pack("H32", $this->md5)), # Binary packed, not hex
$fname