Frédéric Wang has submitted this change and it was merged.

Change subject: Avoid calling readFromDatabase in source mode
......................................................................


Avoid calling readFromDatabase in source mode

In source mode there is no database cache,
so we do not need to call readFromDatabase there.

Change-Id: I791eab923f5ed6e0a3e28dbaf49ba1ae8fdb6cdc
---
M MathRenderer.php
M MathSource.php
2 files changed, 10 insertions(+), 1 deletion(-)

Approvals:
  Frédéric Wang: Looks good to me, approved



diff --git a/MathRenderer.php b/MathRenderer.php
index c214a23..6784ff4 100644
--- a/MathRenderer.php
+++ b/MathRenderer.php
@@ -610,7 +610,7 @@
                        // equation was already checked or checking is disabled
                        return true;
                } else {
-                       if( (int) $wgMathDisableTexFilter == MW_MATH_CHECK_NEW 
){
+                       if( (int) $wgMathDisableTexFilter == MW_MATH_CHECK_NEW 
&& $this->mode != MW_MATH_SOURCE ){
                                if( $this->readFromDatabase() ){
                                        return true;
                                }
diff --git a/MathSource.php b/MathSource.php
index 3ad43d6..95340ac 100644
--- a/MathSource.php
+++ b/MathSource.php
@@ -20,6 +20,15 @@
  */
 class MathSource extends MathRenderer {
        /**
+        * @param string $tex
+        * @param array $params
+        */
+       function __construct( $tex = '', $params = array() ) {
+               parent::__construct( $tex, $params );
+               $this->setMode( MW_MATH_SOURCE );
+       }
+
+       /**
         * Renders TeX by outputting it to the browser in a span tag
         *
         * @return string span tag with TeX

-- 
To view, visit https://gerrit.wikimedia.org/r/166189
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I791eab923f5ed6e0a3e28dbaf49ba1ae8fdb6cdc
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: Frédéric Wang <fred.w...@free.fr>
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

Reply via email to