Magento with clear/warming up/reload the cache file

Clear/warming up/reload the cache
Last updated on

This file will help you clear/warming up/reload your Magento cache and you also can use it to fix error “front controller reached 100 router match iterations”, please copy code and save it as a .php file then upload it to root directory and run by: http://yourdomain.com/name-of-file.php :

$path = getenv("MAGE_PATH");
if (!file_exists($path)) {
$path = dirname(__FILE__) . '/app/Mage.php';
}
require_once($path);
$caches = array();
foreach (Mage::app()->useCache() as $type => $status) {
if ($type == 'config') {
$status = 1;
}
$caches[$type] = $status;
}
Mage::app()->saveUseCache($caches);
Mage::reset();
if (!Mage::app()->useCache('config')) {
die("Config cache needs to be enabled.");
}
/*** Clear the cache ***/
Mage::app()->getCacheInstance()->clean();
Mage::app()->getCacheInstance()->flush();
Mage::app()->getCache()->clean();
Mage::reset();
/*** Warming up the cache ***/
Mage::app();
Mage::reset();
Mage::app()->getCacheInstance()->remove('config_global');
Mage::app()->init(Mage_Core_Model_App::ADMIN_STORE_ID, 'store');
echo "Done\n";

    2 Comments

  1. It’s exhausting to find knowledgeable folks on this topic, but you sound like you realize what you’re speaking about! Thanks

    Reply


Post a Comment

Please keep in mind that all comments are read and moderation.
Your email address WILL NOT be published. Please DO NOT use keywords in the Real Name field. Thank you !

Stablehost coupons - The best hosting in 2018


Categories