From 2f30217d9672816da4ceb36bdb0f8540f9629741 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Sat, 20 Apr 2019 20:20:35 +0100 Subject: [PATCH 1/2] Enable Adminhtml controller This was introduced in https://github.com/nexcess/magento-turpentine/pull/817, but this conflicted with the existing controller. This conflict was identified in https://github.com/nexcess/magento-turpentine/issues/821 and resolved in https://github.com/nexcess/magento-turpentine/pull/823 by removing this line. Without this line, the overridden controller is not used (and therefore the protection it adds is not being applied). This change reintroduces the required configuration in a non-conflicting way. --- app/code/community/Nexcessnet/Turpentine/etc/config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/community/Nexcessnet/Turpentine/etc/config.xml b/app/code/community/Nexcessnet/Turpentine/etc/config.xml index 1de6007f7..0ebbaf874 100644 --- a/app/code/community/Nexcessnet/Turpentine/etc/config.xml +++ b/app/code/community/Nexcessnet/Turpentine/etc/config.xml @@ -497,6 +497,7 @@ Nexcessnet_Turpentine + Nexcessnet_Turpentine_Adminhtml From 16d88aec975f4ff62c4cb6e362bf70953380fd99 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Sat, 20 Apr 2019 20:25:42 +0100 Subject: [PATCH 2/2] Force-disable full_page when conflict detected --- .../controllers/Adminhtml/CacheController.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/code/community/Nexcessnet/Turpentine/controllers/Adminhtml/CacheController.php b/app/code/community/Nexcessnet/Turpentine/controllers/Adminhtml/CacheController.php index 9beb94935..bbeb7116b 100644 --- a/app/code/community/Nexcessnet/Turpentine/controllers/Adminhtml/CacheController.php +++ b/app/code/community/Nexcessnet/Turpentine/controllers/Adminhtml/CacheController.php @@ -8,6 +8,27 @@ class Nexcessnet_Turpentine_Adminhtml_CacheController extends Mage_Adminhtml_CacheController { + public function indexAction() + { + $allTypes = Mage::app()->useCache(); + + $turpentineEnabled = ($allTypes['turpentine_pages'] == 1) || ($allTypes['turpentine_esi_blocks'] == 1); + $fullPageEnabled = (array_key_exists('full_page', $allTypes)) && ($allTypes['full_page'] == 1); + + if ($fullPageEnabled && $turpentineEnabled) { + $allTypes['full_page'] = 0; + Mage::app()->saveUseCache($allTypes); + + Mage::getSingleton('core/session')->addWarning( + Mage::helper('adminhtml')->__('Both Varnish and Full Page caches were enabled. Full Page cache has now been disabled.') + ); + + $this->_redirect('*/*'); + return; + } + + parent::indexAction(); + } /** * Mass action for cache enabeling