Tim Starling has submitted this change and it was merged.

Change subject: Write cache unless there *is* a cache hit:
......................................................................


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
---
M Math.hooks.php
M MathTexvc.php
2 files changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Tim Starling: Verified; Looks good to me, approved
  jenkins-bot: Checked



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 @@
                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 @@
                        if ( $result != MW_TEXVC_SUCCESS ) {
                                return $result;
                        }
-                       $this->writeCache();
                }
                return $this->doHTMLRender();
        }
@@ -276,7 +275,8 @@
         */
        public function writeCache() {
                global $wgUseSquid;
-               if ( !$this->isRecall() ) {
+               // If cache hit, don't write anything.
+               if ( $this->isRecall() ) {
                        return;
                }
                $this->writeDBEntry();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6b387795304ff15c960fcf0f5354a9ac939e1212
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Peachey88 <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to