jenkins-bot has submitted this change and it was merged. Change subject: Avoid unnecessary database reads ......................................................................
Avoid unnecessary database reads Use the cached function isInDatabase rather than readFromDatabase to avoid unnecessary read operations on the database. Currently, readFromDatabase is usually called only once during instance livetime. But after I455b41c8b8d918f4c34f6c115194d227a8394e0a has bben merged chances are that it's called twice. Change-Id: I6434195ad1d323a578a8fdca1b4555e11ab30a15 --- M MathLaTeXML.php M MathMathML.php M MathTexvc.php 3 files changed, 5 insertions(+), 6 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/MathLaTeXML.php b/MathLaTeXML.php index b30a820..4915058 100644 --- a/MathLaTeXML.php +++ b/MathLaTeXML.php @@ -182,8 +182,7 @@ $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 { diff --git a/MathMathML.php b/MathMathML.php index 82eea5e..3d1a931 100644 --- a/MathMathML.php +++ b/MathMathML.php @@ -104,7 +104,7 @@ 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." ); diff --git a/MathTexvc.php b/MathTexvc.php index f5e4f61..057007c 100644 --- a/MathTexvc.php +++ b/MathTexvc.php @@ -387,7 +387,7 @@ 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 @@ 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 { -- To view, visit https://gerrit.wikimedia.org/r/158846 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6434195ad1d323a578a8fdca1b4555e11ab30a15 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Physikerwelt <w...@physikerwelt.de> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: CSteipp <cste...@wikimedia.org> Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits