Created
March 3, 2017 16:16
-
-
Save piotrekkaminski/fd8540edb2f20937c3c1d6ab6ac593d4 to your computer and use it in GitHub Desktop.
MPERF-7817: First static block cached is always shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 58721d4cfd3ac47617af97f2670b54398f3e886f Mon Sep 17 00:00:00 2001 | |
From: Mykola Palamar <[email protected]> | |
Date: Fri, 10 Jul 2015 19:30:25 +0300 | |
Subject: [PATCH] Fixed MPERF-7464: CMS static block loads content of another | |
block saved to blocks HTML output cache | |
--- | |
app/code/core/Mage/Cms/Block/Block.php | 20 ++++++++++++++++++++ | |
app/code/core/Mage/Cms/Block/Widget/Block.php | 16 ++++++++++++++++ | |
2 files changed, 36 insertions(+) | |
diff --git a/app/code/core/Mage/Cms/Block/Block.php b/app/code/core/Mage/Cms/Block/Block.php | |
index bc81de3..a0dce44 100755 | |
--- a/app/code/core/Mage/Cms/Block/Block.php | |
+++ b/app/code/core/Mage/Cms/Block/Block.php | |
@@ -72,4 +72,24 @@ protected function _toHtml() | |
} | |
return $html; | |
} | |
+ | |
+ /** | |
+ * Retrieve values of properties that unambiguously identify unique content | |
+ * | |
+ * @return array | |
+ */ | |
+ public function getCacheKeyInfo() | |
+ { | |
+ $blockId = $this->getBlockId(); | |
+ if ($blockId) { | |
+ $result = array( | |
+ 'CMS_BLOCK', | |
+ $blockId, | |
+ Mage::app()->getStore()->getCode(), | |
+ ); | |
+ } else { | |
+ $result = parent::getCacheKeyInfo(); | |
+ } | |
+ return $result; | |
+ } | |
} | |
diff --git a/app/code/core/Mage/Cms/Block/Widget/Block.php b/app/code/core/Mage/Cms/Block/Widget/Block.php | |
index 2352be7..df1b332 100644 | |
--- a/app/code/core/Mage/Cms/Block/Widget/Block.php | |
+++ b/app/code/core/Mage/Cms/Block/Widget/Block.php | |
@@ -82,10 +82,26 @@ protected function _beforeToHtml() | |
$helper = Mage::helper('cms'); | |
$processor = $helper->getBlockTemplateProcessor(); | |
$this->setText($processor->filter($block->getContent())); | |
+ $this->addModelTags($block); | |
} | |
} | |
unset(self::$_widgetUsageMap[$blockHash]); | |
return $this; | |
} | |
+ | |
+ /** | |
+ * Retrieve values of properties that unambiguously identify unique content | |
+ * | |
+ * @return array | |
+ */ | |
+ public function getCacheKeyInfo() | |
+ { | |
+ $result = parent::getCacheKeyInfo(); | |
+ $blockId = $this->getBlockId(); | |
+ if ($blockId) { | |
+ $result[] = $blockId; | |
+ } | |
+ return $result; | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment