I need a simple script which will refresh each element of the Magento cache. I'm running 1.3.2.3 and can not upgrade
Example Cron Job Script to Refresh Memo Cache: (Script Amartinez in Magento Forum Run via Cron job php file:
00 one 0 * * * * * * One route / var / www /html/magento/cron_refresh_cache.php a & gt; a /var/log/cron_refresh_cache.log
# ! / Usr / Bin / php & lt ;? Php / ** * cron_refresh_cache.php * * @ Copyright (C) 2009 Tniecle [at] gmail.com * @license http://opensource.org/licenses/osl- 3.0.php Open Software License (OSA) 3.0) * / (! $ _ Server [["HTTP_USER_AGENT"]) or die ("nothing to do \ n"); // run through local browser usage ($ _SERVER ["SERVER_ADDR"] = = $ _SERVER [ "REMOTE_ADDR"]) need_once 'app / Mage.php'; Umask (0); Dana :: app ( "default"), is // if error mage this line :: app (Dana: : Change app () - & gt; GetStore (); $ Ver = Dana :: getVersion (); $ UserModel = Dana :: MillModel ('Admin / User'); $ User Models - & gt; SetUserId (0); Dana :: getSingleton ('Admin / Session') - & gt; SetUser ($ userModel); "Refresh cache ... echo ... \ n"; Dana :: Application () - & gt; CleanCache (); $ Enabled = array (); Foreach (Angle :: Assistant ('Core') -> GetCacheTypes () $ type = & gt; $ as label) {$ enabled $ type = = 1; } Dana :: App () - & gt; Save Eusclock ($ enabled); Refresh_cache (); // call refresh function function refact_catch () {$ this - & gt; Notify ('Refresh Cash'); Try (Dana :: Milensiglitn ( 'catalog / URL') - & gt; RefreshRewrites (); $ this - & gt; Notify ( "Catalog writing was successfully refreshed, 'blank');} catch (Exception $ E) {$ this -> Notify ($ e -> get message (), 'warning')}} Try {Dana :: getSingleton ('list / index') -> Rebuild ( ); $ This -> notify ('index indices were created successfully', 'blank');} catch (exception $ e) {$ this -> indicate ($ e -> get message (), 'Warning');} {$ Flag = Mage :: getModel ( 'catalogindex / catalog_index_flag') - & gt; loadSelf (); if ($ flag - & gt; getState () == Mage_CatalogIndex_Model_Catalog_Index_Flag :: STATE_RUNNING) {$ kill = Mage :: Milmodel ( 'catalogindex / catalog_index_kill_flag' ) - & gt; LoadSelf (); $ hit - & gt; Setflagdeta ($ flag - & gt; GetFlagData ()) - & gt; save ();} $ flag - & gt; Setstet (Mage_CatalogIndex_Model_Catalog_Index_Flag :: STATE_QUEUED) - & Gt; Save (); Dana: Meet Sissing ('Catandax / Index') - & gt; PlainReindex (); $ This - & gt; Notify ('layered navigation index was successfully refreshed', 'blank'); } Hold (exception $ E) {$ this -> Inform ($ e - & gt; get message (), 'warning'); } {Mage :: getModel ('catalog / product_image') - & gt; clear cache(); $ This - & gt; Notify ('Image cache cleared successfully', 'blank'); } Hold (exception $ E) {$ this -> Inform ($ e - & gt; get message (), 'warning'); } {Try the Maths :: Millimeter ('katalus search / full text) - & gt; RebuildIndex (); $ This - & gt; Notify ('search index was successfully rebuilt', 'blank'); } Hold (exception $ E) {$ this -> Inform ($ e - & gt; get message (), 'warning'); } Try (Dana :: Milenchington ('Catalogogallery / Stock_States') -> Rebuild (); $ - -> (Notify 'CatalogInventory Stock Status was Rebuilded', 'Empty');} (Exception $ E) {$ this -> Notify ($ e -> get message (), 'Warning')}} Try {Dana :: getResourceModel ('catalog / category_flat') -> Rebuild (); $ - -> Inform ('flat catalog class was created successfully', 'blank');} catch (exception $ e) {$ this -> indicating ($ E -> Get Message (), 'Warning') Try} {{Dana :: getResourceModel ('catalog / product_flat_indexer') -> Rebuild (); $ this - & gt; Notify (' Flat catalog product was successfully created, 'empty');} catch (exception $ e) {$ this -> indicate ($ e -> get message (), 'warning');}}? & Gt;
Comments
Post a Comment