Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinit fresh config before flushing cache and immediately save config… #3533

Merged
merged 9 commits into from
Oct 3, 2023
10 changes: 9 additions & 1 deletion app/code/core/Mage/Adminhtml/controllers/CacheController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ public function indexAction()
*/
public function flushAllAction()
{
Mage::dispatchEvent('adminhtml_cache_flush_all');
Mage::app()->getCacheInstance()->banUse('config');
Mage::getConfig()->reinit();
Mage::app()->getCacheInstance()->flush();
colinmollenhour marked this conversation as resolved.
Show resolved Hide resolved
Mage::app()->getCacheInstance()->unbanUse('config');
Mage::getConfig()->saveCache();
Mage::dispatchEvent('adminhtml_cache_flush_all');
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The cache storage has been flushed."));
$this->_redirect('*/*');
}
Expand All @@ -63,7 +67,11 @@ public function flushAllAction()
*/
public function flushSystemAction()
{
Mage::app()->getCacheInstance()->banUse('config');
Mage::getConfig()->reinit();
Mage::app()->cleanCache();
Mage::app()->getCacheInstance()->unbanUse('config');
Mage::getConfig()->saveCache();
Mage::dispatchEvent('adminhtml_cache_flush_system');
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The OpenMage cache storage has been flushed."));
$this->_redirect('*/*');
colinmollenhour marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
12 changes: 12 additions & 0 deletions app/code/core/Mage/Core/Model/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,18 @@ public function banUse($typeCode)
return $this;
}

/**
* Enable cache usage for specific data type
*
* @param string $typeCode
* @return $this
*/
public function unbanUse($typeCode)
{
$this->_allowedCacheOptions[$typeCode] = false;
return $this;
}

/**
* Get cache tags by cache type from configuration
*
Expand Down
Loading