From aa8a0eaf19b88e28bd15d5eb03ca8a9831e40866 Mon Sep 17 00:00:00 2001 From: Matthew Flaschen Date: Tue, 12 Mar 2013 00:38:45 -0400 Subject: [PATCH] Write cache unless there *is* a cache hit: Moves writeCache call back to hooks (changed in 9ba4ef269d9ea1adc016cbc83e58aef1be45b6f9) and makes it unconditional, so only one part of the code decides whether to write to the cache. Bug: 45973 Change-Id: I6b387795304ff15c960fcf0f5354a9ac939e1212 --- Math.hooks.php | 1 + MathTexvc.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Math.hooks.php b/Math.hooks.php index f8e4656..a70da28 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -55,6 +55,7 @@ class MathHooks { if ( $wgUseMathJax && $mode == MW_MATH_MATHJAX ) { $parser->getOutput()->addModules( array( 'ext.math.mathjax.enabler' ) ); } + $renderer->writeCache(); return $wgContLang->armourMath( $renderedMath ); } diff --git a/MathTexvc.php b/MathTexvc.php index 8b4f877..25f456a 100644 --- a/MathTexvc.php +++ b/MathTexvc.php @@ -34,7 +34,6 @@ class MathTexvc extends MathRenderer { if ( $result != MW_TEXVC_SUCCESS ) { return $result; } - $this->writeCache(); } return $this->doHTMLRender(); } @@ -276,7 +275,8 @@ class MathTexvc extends MathRenderer { */ public function writeCache() { global $wgUseSquid; - if ( !$this->isRecall() ) { + // If cache hit, don't write anything. + if ( $this->isRecall() ) { return; } $this->writeDBEntry();