Merge "Avoid unnecessary database reads"

This commit is contained in:
jenkins-bot 2014-09-10 17:42:33 +00:00 committed by Gerrit Code Review
commit dfdf55b9ce
3 changed files with 5 additions and 6 deletions

View File

@ -182,8 +182,7 @@ class MathLaTeXML extends MathMathML {
$renderer = new MathMathML( $this->getTex() );
$renderer->setMathml( $this->getMathml() );
$renderer->setMode( MW_MATH_LATEXML );
$renderer->setPurge( true );
$res = $renderer->render();
$res = $renderer->render( true );
if ( $res == true ) {
$this->svg = $renderer->getSvg();
} else {

View File

@ -104,7 +104,7 @@ class MathMathML extends MathRenderer {
wfDebugLog( "Math", "Rerendering was requested." );
return true;
} else {
$dbres = $this->readFromDatabase();
$dbres = $this->isInDatabase();
if ( $dbres ) {
if ( $this->isValidMathML( $this->getMathml() ) ) {
wfDebugLog( "Math", "Valid MathML entry found in database." );

View File

@ -387,7 +387,7 @@ class MathTexvc extends MathRenderer {
global $wgMathCheckFiles;
wfProfileIn( __METHOD__ );
if ( $this->readFromDatabase() ) {
if ( $this->isInDatabase() ) {
if ( !$wgMathCheckFiles ) {
// Short-circuit the file existence & migration checks
wfProfileOut( __METHOD__ );
@ -413,8 +413,8 @@ class MathTexvc extends MathRenderer {
return $backend->getFileContents( array( 'src' => $this->getHashPath() . "/" . $this->getHash() . '.png' ) );
}
public function readFromDatabase() {
$return = parent::readFromDatabase();
public function isInDatabase() {
$return = parent::isInDatabase();
if ( $this->hash && $return ) {
return true;
} else {