NewsModules_ClearCache - Version 0.1.0

Version Notes

Automatically clears the cache and images' cache

Download this release

Release Info

Developer Alessandro Lioce
Extension NewsModules_ClearCache
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/NewsModules/ClearCache/Model/Observer.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class NewsModules_ClearCache_Model_Observer
3
+ {
4
+ public function refreshCache()
5
+ {
6
+ try
7
+ {
8
+ $allTypes = Mage::app()->useCache();
9
+ foreach($allTypes as $type => $void)
10
+ {
11
+ Mage::app()->getCacheInstance()->cleanType($type);
12
+ }
13
+ }
14
+ catch (Exception $e)
15
+ {
16
+ Mage::log($e->getMessage(), NULL, 'clearcache.log');
17
+ }
18
+ return $this;
19
+ }
20
+
21
+ public function refreshImages()
22
+ {
23
+ try
24
+ {
25
+ Mage::getModel('catalog/product_image')->clearCache();
26
+ }
27
+ catch (Exception $e)
28
+ {
29
+ Mage::log($e->getMessage(), NULL, 'clearcache.log');
30
+ }
31
+ return $this;
32
+ }
33
+ }
app/code/community/NewsModules/ClearCache/etc/config.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <NewsModules_ClearCache>
5
+ <version>0.1.0</version>
6
+ </NewsModules_ClearCache>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <clearcache>
11
+ <class>NewsModules_ClearCache_Model</class>
12
+ </clearcache>
13
+ </models>
14
+ </global>
15
+ <crontab>
16
+ <jobs>
17
+ <newsmodules_clearcache>
18
+ <schedule>
19
+ <cron_expr>0 1 * * *</cron_expr>
20
+ </schedule>
21
+ <run>
22
+ <model>clearcache/observer::refreshCache</model>
23
+ </run>
24
+ </newsmodules_clearcache>
25
+ <newsmodules_clearcache_images>
26
+ <schedule>
27
+ <cron_expr>0 2 1 * *</cron_expr>
28
+ </schedule>
29
+ <run>
30
+ <model>clearcache/observer::refreshImages</model>
31
+ </run>
32
+ </newsmodules_clearcache_images>
33
+ </jobs>
34
+ </crontab>
35
+ </config>
app/etc/modules/NewsModules_ClearCache.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <NewsModules_ClearCache>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </NewsModules_ClearCache>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>NewsModules_ClearCache</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Automatically clears the cache and images' cache</summary>
10
+ <description>Automatically clears the cache and images' cache</description>
11
+ <notes>Automatically clears the cache and images' cache</notes>
12
+ <authors><author><name>Alessandro Lioce</name><user>alioce</user><email>a.lioce@ne-ws.it</email></author></authors>
13
+ <date>2014-06-09</date>
14
+ <time>16:02:42</time>
15
+ <contents><target name="magecommunity"><dir name="NewsModules"><dir name="ClearCache"><dir name="Model"><file name="Observer.php" hash="56ab17d06448c6caccce05b4d2ec061e"/></dir><dir name="etc"><file name="config.xml" hash="7bfbe2523b1927e609bf09b946c52074"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NewsModules_ClearCache.xml" hash="217ceb8f8740e326b1785394f40330f5"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.13</min><max>5.4.29</max></php></required></dependencies>
18
+ </package>