Recentchanges optimization: avoid a lot of senseless parsing of link text coming...
[lhc/web/wiklou.git] / texvc.phtml
index 7f5e1a0..7f427d8 100644 (file)
@@ -13,7 +13,7 @@ print ">";
 <?php
 print "<form method=\"post\" action=\"{$wgServer}{$wgScriptPath}/texvc_cgi.phtml\">"
 ?>
-<textarea name='math' rows='10' cols='80'><?
+<textarea name='math' rows='10' cols='80'><?php
        global $math;
        $math = preg_replace ("/\\\\\\\\/", '\\', $math);
        print $math;
@@ -28,7 +28,7 @@ function xlinkToMathImage ( $tex, $outputhash )
 function texvc_cgi_renderMath( $tex )
 {
        global $wgMathDirectory, $wgTmpDirectory, $wgInputEncoding;
-       $dbr =& wfGetDB( DB_READ );
+       $dbr =& wfGetDB( DB_SLAVE );
        $mf   = wfMsg( "math_failure" );
        $munk = wfMsg( "math_unknown_error" );
 
@@ -42,7 +42,7 @@ function texvc_cgi_renderMath( $tex )
        $md5_sql = pack("H32", $md5);
 
        $mathTable = $dbr->tableName( 'math' );
-       $rpage = $dbr->getArray( 'math', array('math_outputhash','math_html_conservativeness','math_html','math_mathml'),
+       $rpage = $dbr->selectRow( 'math', array('math_outputhash','math_html_conservativeness','math_html','math_mathml'),
          array( 'math_inputhash' => $md5_sql ) );
        
        if ( $rpage === false )
@@ -113,8 +113,8 @@ function texvc_cgi_renderMath( $tex )
                $outmd5_sql = pack("H32", $outmd5);
                
                # Someone may have inserted the same hash since the SELECT, but that's no big deal, just ignore errors
-               $dbw =& wfGetDB( DB_WRITE );
-               $dbw->insertArray( 'math', 
+               $dbw =& wfGetDB( DB_MASTER );
+               $dbw->insert( 'math', 
                  array( 
                    'math_inputhash' => $md5_sql, 
                        'math_outputhash' => $outmd5_sql,
@@ -126,7 +126,6 @@ function texvc_cgi_renderMath( $tex )
                
 // we don't really care if it fails
        } else {
-               $rpage = $dbr->fetchObject ( $res );
                $outmd5 = unpack ("H32md5", $rpage->math_outputhash);
                $outmd5 = $outmd5 ['md5'];
                $outhtml = $rpage->math_html;