Created
June 24, 2018 07:32
-
-
Save CajuCLC/b4e3e3034bba23ad923cec13192df9f0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| /** | |
| * Clear cache via CLI | |
| * | |
| * @category MageBR | |
| * @author Eric Cavalcanti <cajuclc@gmail.com> | |
| * @license MageBR License | |
| * @link https://www.magebr.com | |
| */ | |
| echo "Start Cleaning all caches at ... " . date("Y-m-d H:i:s") . "\n\n"; | |
| ini_set("display_errors", 1); | |
| require 'app/Mage.php'; | |
| Mage::app('admin')->setUseSessionInUrl(false); | |
| Mage::getConfig()->init(); | |
| $types = Mage::app()->getCacheInstance()->getTypes(); | |
| try { | |
| echo "Cleaning data cache... \n"; | |
| flush(); | |
| foreach ($types as $type => $data) { | |
| echo "Removing $type ... "; | |
| echo Mage::app()->getCacheInstance()->clean($data["tags"]) ? "Cache was cleared!" : "Something bad happened!"; | |
| echo "\n"; | |
| } | |
| } catch (exception $e) { | |
| die("[ERROR:" . $e->getMessage() . "]"); | |
| } | |
| echo "\n"; | |
| try { | |
| echo "Cleaning stored cache... "; | |
| flush(); | |
| echo Mage::app()->getCacheInstance()->clean() ? "Cache was cleared!" : "Something bad happened!"; | |
| echo "\n\n"; | |
| } catch (exception $e) { | |
| die("[ERROR:" . $e->getMessage() . "]"); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment