Last active
September 16, 2015 09:17
-
-
Save hslatman/9df207719054ea5beadd to your computer and use it in GitHub Desktop.
Clear Magento cache
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
<?php | |
/****************************************************************************************************************** | |
* Source: http://www.emvee-solutions.com/blog/magento-clear-cache-programatically/ | |
* | |
* Clearing the Magento cache programmatically | |
******************************************************************************************************************/ | |
//increase execution time | |
ini_set('max_execution_time', 900); //900 seconds = 15 minutes | |
//require Magento | |
require_once 'app/Mage.php'; | |
$app = Mage::app('admin'); | |
umask(0); | |
//enable Error Reporting | |
error_reporting(E_ALL & ~E_NOTICE); | |
Mage::setIsDeveloperMode(true); | |
try { | |
//CLEAN OVERALL CACHE | |
flush(); | |
Mage::app()->cleanCache(); | |
// CLEAN IMAGE CACHE | |
flush(); | |
Mage::getModel('catalog/product_image')->clearCache(); | |
print 'done'; | |
} | |
catch(Exception $e){ | |
//something went wrong... | |
print($e->getMessage()); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment