From 3564b7cfe82f5b1fc4e0bc813b707737bc6f44a9 Mon Sep 17 00:00:00 2001 From: "physikerwelt (Moritz Schubotz)" Date: Sat, 11 Oct 2014 16:04:18 +0200 Subject: [PATCH] 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 --- MathRenderer.php | 2 +- MathSource.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/MathRenderer.php b/MathRenderer.php index c214a23..6784ff4 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -610,7 +610,7 @@ abstract class MathRenderer { // 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 @@ -19,6 +19,15 @@ * @ingroup Parser */ 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 *