Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Magento Hotfixes
diff --git a/magento/app/code/core/Mage/Cms/Block/Block.php b/magento/app/code/core/Mage/Cms/Block/Block.php
index 75aab46..3693349 100644
--- a/magento/app/code/core/Mage/Cms/Block/Block.php
+++ b/magento/app/code/core/Mage/Cms/Block/Block.php
@@ -72,4 +72,19 @@ class Mage_Cms_Block_Block extends Mage_Core_Block_Abstract
}
return $html;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheKeyInfo()
+ {
+ $info = parent::getCacheKeyInfo();
+ $blockId = $this->getBlockId();
+
+ if ($blockId) {
+ $info[] = 'CMSBLOCK_' . $blockId;
+ }
+
+ return $info;
+ }
}
diff --git a/magento/app/code/core/Mage/Cms/Block/Page.php b/magento/app/code/core/Mage/Cms/Block/Page.php
index 364ec3a..aafdad0 100644
--- a/magento/app/code/core/Mage/Cms/Block/Page.php
+++ b/magento/app/code/core/Mage/Cms/Block/Page.php
@@ -102,4 +102,19 @@ class Mage_Cms_Block_Page extends Mage_Core_Block_Abstract
$html = $this->getMessagesBlock()->toHtml() . $html;
return $html;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheKeyInfo()
+ {
+ $info = parent::getCacheKeyInfo();
+ $pageId = $this->getPageId();
+
+ if ($pageId) {
+ $info[] = 'CMSPAGE_' . $pageId;
+ }
+
+ return $info;
+ }
}
diff --git a/magento/app/code/core/Mage/Cms/Block/Widget/Block.php b/magento/app/code/core/Mage/Cms/Block/Widget/Block.php
index eaa3921..b7a16cf 100644
--- a/magento/app/code/core/Mage/Cms/Block/Widget/Block.php
+++ b/magento/app/code/core/Mage/Cms/Block/Widget/Block.php
@@ -88,4 +88,19 @@ class Mage_Cms_Block_Widget_Block extends Mage_Core_Block_Template implements Ma
unset(self::$_widgetUsageMap[$blockHash]);
return $this;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheKeyInfo()
+ {
+ $info = parent::getCacheKeyInfo();
+ $blockId = $this->getBlockId();
+
+ if ($blockId) {
+ $info[] = 'CMSBLOCK_' . $blockId;
+ }
+
+ return $info;
+ }
}
diff --git a/magento/app/code/core/Mage/Core/Block/Abstract.php b/magento/app/code/core/Mage/Core/Block/Abstract.php
index 2c332b2..8995a35 100644
--- a/magento/app/code/core/Mage/Core/Block/Abstract.php
+++ b/magento/app/code/core/Mage/Core/Block/Abstract.php
@@ -1276,8 +1276,18 @@ abstract class Mage_Core_Block_Abstract extends Varien_Object
*/
public function getCacheKeyInfo()
{
+ $actionName = '__STANDALONE__';
+
+ if ($action = $this->getAction()) {
+ $actionName = $action->getFullActionName();
+ }
+
return array(
- $this->getNameInLayout()
+ $this->getNameInLayout(),
+ get_class($this),
+ 'STORE_' . Mage::app()->getStore()->getCode(),
+ $this->getLayout()->getArea(),
+ $actionName
);
}
diff --git a/magento/app/code/core/Mage/Cms/Block/Page.php b/magento/app/code/core/Mage/Cms/Block/Page.php
index 364ec3a..aafdad0 100644
--- a/magento/app/code/core/Mage/Cms/Block/Page.php
+++ b/magento/app/code/core/Mage/Cms/Block/Page.php
@@ -102,4 +102,19 @@
$html = $this->getMessagesBlock()->toHtml() . $html;
return $html;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheKeyInfo()
+ {
+ $info = parent::getCacheKeyInfo();
+ $pageId = $this->getPageId();
+
+ if ($pageId) {
+ $info[] = 'CMSPAGE_' . $pageId;
+ }
+
+ return $info;
+ }
}
diff --git a/magento/app/code/core/Mage/Core/Block/Abstract.php b/magento/app/code/core/Mage/Core/Block/Abstract.php
index 2c332b2..8995a35 100644
--- a/magento/app/code/core/Mage/Core/Block/Abstract.php
+++ b/magento/app/code/core/Mage/Core/Block/Abstract.php
@@ -1276,8 +1276,18 @@
*/
public function getCacheKeyInfo()
{
+ $actionName = '__STANDALONE__';
+
+ if ($action = $this->getAction()) {
+ $actionName = $action->getFullActionName();
+ }
+
return array(
- $this->getNameInLayout()
+ $this->getNameInLayout(),
+ get_class($this),
+ 'STORE_' . Mage::app()->getStore()->getCode(),
+ $this->getLayout()->getArea(),
+ $actionName
);
}
@BassemN
Copy link

BassemN commented Jan 19, 2016

Hi,
I have caching issue with Magento 1.9.2.2. Please advise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment