Version Notes
A simple extension to give you valuable insight into how many visits you’re getting to 404 Not Found URLs.
Download this release
Release Info
Developer | Demac Media |
Extension | Demac_CacheSweep |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Demac/CacheSweep/Helper/Data.php +5 -0
- app/code/local/Demac/CacheSweep/Model/Sweeper.php +88 -0
- app/code/local/Demac/CacheSweep/etc/config.xml +82 -0
- app/code/local/Demac/CacheSweep/etc/system.xml +89 -0
- app/design/adminhtml/default/default/layout/demac_cachesweep.xml +9 -0
- app/etc/modules/Demac_CacheSweep.xml +9 -0
- package.xml +20 -0
- skin/adminhtml/default/default/demac_cachesweep/css/cachesweep.css +2 -0
- skin/adminhtml/default/default/demac_cachesweep/images/CacheSweep100x100.png +0 -0
- skin/adminhtml/default/default/demac_cachesweep/images/CacheSweep25x25.png +0 -0
- skin/adminhtml/default/default/demac_cachesweep/images/CacheSweep50x50.png +0 -0
app/code/local/Demac/CacheSweep/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Demac_CacheSweep_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
}
|
app/code/local/Demac/CacheSweep/Model/Sweeper.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Demac Media
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the EULA
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.demacmedia.com/LICENSE-Magento.txt
|
12 |
+
*
|
13 |
+
* @category Demac
|
14 |
+
* @author Allan MacGregor (allan@demacmedia.com)
|
15 |
+
* @package Demac_Sweep
|
16 |
+
* @copyright Copyright (c) 2010-2011 Demac Media (http://www.demacmedia.com)
|
17 |
+
* @license http://www.demacmedia.com/LICENSE-Magento.txt
|
18 |
+
*/
|
19 |
+
class Demac_CacheSweep_Model_Sweeper {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Sweep Old Magento Cache
|
23 |
+
*
|
24 |
+
* @internal param $void
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
public function sweep() {
|
28 |
+
$startTime = time();
|
29 |
+
Mage::app()->getCache()->clean(Zend_Cache::CLEANING_MODE_OLD);
|
30 |
+
$duration = time() - $startTime;
|
31 |
+
Mage::log('[CACHESWEEPER] Sweep Old Cache (duration: '.$duration.')', null, 'demac_cachesweeper.log');
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Sweep Magento Cache
|
36 |
+
*
|
37 |
+
* @see app/code/core/Mage/Adminhtml/controllers/CacheController.php
|
38 |
+
* @return void
|
39 |
+
*/
|
40 |
+
public function sweepSystem() {
|
41 |
+
$startTime = time();
|
42 |
+
Mage::app()->cleanCache();
|
43 |
+
$duration = time() - $startTime;
|
44 |
+
Mage::log('[CACHESWEEPER] Sweep Cache (duration: '.$duration.')', null, 'demac_cachesweeper.log');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Sweep Cache Storage
|
49 |
+
*
|
50 |
+
* @see app/code/core/Mage/Adminhtml/controllers/CacheController.php
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
public function sweepAll() {
|
54 |
+
$startTime = time();
|
55 |
+
Mage::app()->getCacheInstance()->flush();
|
56 |
+
$duration = time() - $startTime;
|
57 |
+
Mage::log('[CACHESWEEPER] Sweep Cache Storage (duration: '.$duration.')', null, 'demac_cachesweeper.log');
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Sweep images
|
62 |
+
*
|
63 |
+
* @see app/code/core/Mage/Adminhtml/controllers/CacheController.php
|
64 |
+
* @return void
|
65 |
+
*/
|
66 |
+
public function sweepImages() {
|
67 |
+
$startTime = time();
|
68 |
+
Mage::getModel('catalog/product_image')->clearCache();
|
69 |
+
Mage::dispatchEvent('clean_catalog_images_cache_after');
|
70 |
+
$duration = time() - $startTime;
|
71 |
+
Mage::log('[CACHESWEEPER] Sweep Images Cache (duration: '.$duration.')', null, 'demac_cachesweeper.log');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Sweep Style
|
76 |
+
*
|
77 |
+
* @see app/code/core/Mage/Adminhtml/controllers/CacheController.php
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
public function sweepStyle() {
|
81 |
+
$startTime = time();
|
82 |
+
Mage::getModel('core/design_package')->cleanMergedJsCss();
|
83 |
+
Mage::dispatchEvent('clean_media_cache_after');
|
84 |
+
$duration = time() - $startTime;
|
85 |
+
Mage::log('[CACHESWEEPER] Sweep Style Files Cache (duration: '.$duration.')', null, 'demac_cachesweeper.log');
|
86 |
+
}
|
87 |
+
|
88 |
+
}
|
app/code/local/Demac/CacheSweep/etc/config.xml
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Demac_CacheSweep>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</Demac_CacheSweep>
|
9 |
+
</modules>
|
10 |
+
|
11 |
+
<default>
|
12 |
+
<cachesweepsection>
|
13 |
+
<cachesweep>
|
14 |
+
<scheduler_cron_expr>30 * * * *</scheduler_cron_expr>
|
15 |
+
</cachesweep>
|
16 |
+
</cachesweepsection>
|
17 |
+
</default>
|
18 |
+
|
19 |
+
<global>
|
20 |
+
<models>
|
21 |
+
<demaccachesweep><class>Demac_CacheSweep_Model</class></demaccachesweep>
|
22 |
+
</models>
|
23 |
+
<helpers>
|
24 |
+
<demaccachesweep><class>Demac_CacheSweep_Helper</class></demaccachesweep>
|
25 |
+
</helpers>
|
26 |
+
</global>
|
27 |
+
|
28 |
+
<adminhtml>
|
29 |
+
<acl>
|
30 |
+
<resources>
|
31 |
+
<admin>
|
32 |
+
<children>
|
33 |
+
<system>
|
34 |
+
<children>
|
35 |
+
<config>
|
36 |
+
<children>
|
37 |
+
<cachesweepsection translate="title" module="demaccachesweep">
|
38 |
+
<title>Demac CacheSweep</title>
|
39 |
+
<sort_order>50</sort_order>
|
40 |
+
</cachesweepsection>
|
41 |
+
</children>
|
42 |
+
</config>
|
43 |
+
</children>
|
44 |
+
</system>
|
45 |
+
</children>
|
46 |
+
</admin>
|
47 |
+
</resources>
|
48 |
+
</acl>
|
49 |
+
<layout>
|
50 |
+
<updates>
|
51 |
+
<demaccachesweep module="demaccachesweep">
|
52 |
+
<file>demac_cachesweep.xml</file>
|
53 |
+
</demaccachesweep>
|
54 |
+
</updates>
|
55 |
+
</layout>
|
56 |
+
</adminhtml>
|
57 |
+
|
58 |
+
<crontab>
|
59 |
+
<jobs>
|
60 |
+
<demaccachesweep>
|
61 |
+
<schedule><config_path>cachesweepsection/cachesweep/scheduler_cron_expr</config_path></schedule>
|
62 |
+
<run><model>demaccachesweep/sweeper::sweep</model></run>
|
63 |
+
</demaccachesweep>
|
64 |
+
<demaccachesweep_sweepall>
|
65 |
+
<schedule><config_path>cachesweepsection/cachesweep/scheduler_cron_expr_sweepall</config_path></schedule>
|
66 |
+
<run><model>demaccachesweep/sweeper::sweepAll</model></run>
|
67 |
+
</demaccachesweep_sweepall>
|
68 |
+
<demaccachesweep_sweepsystem>
|
69 |
+
<schedule><config_path>cachesweepsection/cachesweep/scheduler_cron_expr_sweepsystem</config_path></schedule>
|
70 |
+
<run><model>demaccachesweep/sweeper::sweepSystem</model></run>
|
71 |
+
</demaccachesweep_sweepsystem>
|
72 |
+
<demaccachesweep_sweepimages>
|
73 |
+
<schedule><config_path>cachesweepsection/cachesweep/scheduler_cron_expr_sweepimages</config_path></schedule>
|
74 |
+
<run><model>demaccachesweep/sweeper::sweepImages</model></run>
|
75 |
+
</demaccachesweep_sweepimages>
|
76 |
+
<demaccachesweep_sweepstyle>
|
77 |
+
<schedule><config_path>cachesweepsection/cachesweep/scheduler_cron_expr_sweepstyle</config_path></schedule>
|
78 |
+
<run><model>demaccachesweep/sweeper::sweepStyle</model></run>
|
79 |
+
</demaccachesweep_sweepstyle>
|
80 |
+
</jobs>
|
81 |
+
</crontab>
|
82 |
+
</config>
|
app/code/local/Demac/CacheSweep/etc/system.xml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<cachesweepsection translate="label" module="demaccachesweep">
|
5 |
+
<class>separator-top</class>
|
6 |
+
<label><![CDATA[<span class="cachesweep">CacheSweep Configuration</span>]]></label>
|
7 |
+
<tab>demacall</tab>
|
8 |
+
<class>cache-sweep</class>
|
9 |
+
<sort_order>130</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>0</show_in_website>
|
12 |
+
<show_in_store>0</show_in_store>
|
13 |
+
<groups>
|
14 |
+
<cachesweep translate="label">
|
15 |
+
<label>Cache Sweep</label>
|
16 |
+
<comment>
|
17 |
+
<![CDATA[
|
18 |
+
<div class="cachesweep">
|
19 |
+
|
20 |
+
<h2>Demac Cache Sweeper</h2>
|
21 |
+
<p>
|
22 |
+
The most common configuration for the Magento Cache is to be stored on the filesystem, unfortunately Magento doesn't clean all the cache entries automatically this can
|
23 |
+
eventually lead to a very large cache comprised by several thousands of file. The larger the cache is, the longer will take to Magento to read through all the files.
|
24 |
+
</p>
|
25 |
+
<p>
|
26 |
+
This problem is most commonly experienced at the cart and checkout on store with larger catalogs. Demac Cache Sweeper allows you to periodically clean your cache.
|
27 |
+
<a href="https://wiki.demacmedia.com/cache-sweeper">Check the Documentation</a>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
]]>
|
31 |
+
</comment>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>0</show_in_website>
|
36 |
+
<show_in_store>0</show_in_store>
|
37 |
+
<fields>
|
38 |
+
<scheduler_cron_expr>
|
39 |
+
<label>Sweep old cache</label>
|
40 |
+
<comment>Cron Configuration. (Run every 30 min "30 * * * *")</comment>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>1</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>0</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
</scheduler_cron_expr>
|
47 |
+
<scheduler_cron_expr_sweepall>
|
48 |
+
<label>Sweep Cache Storage</label>
|
49 |
+
<comment>Cron Configuration. (Run every 30 min "30 * * * *")</comment>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>2</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>0</show_in_website>
|
54 |
+
<show_in_store>0</show_in_store>
|
55 |
+
</scheduler_cron_expr_sweepall>
|
56 |
+
<scheduler_cron_expr_sweepsystem>
|
57 |
+
<label>Sweep Magento Cache</label>
|
58 |
+
<comment>Cron Configuration. (Run every 30 min "30 * * * *")</comment>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>3</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>0</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
</scheduler_cron_expr_sweepsystem>
|
65 |
+
<scheduler_cron_expr_sweepimages>
|
66 |
+
<label>Sweep Catalog Images Cache</label>
|
67 |
+
<comment>Cron Configuration. (Run every 30 min "30 * * * *")</comment>
|
68 |
+
<frontend_type>text</frontend_type>
|
69 |
+
<sort_order>4</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>0</show_in_website>
|
72 |
+
<show_in_store>0</show_in_store>
|
73 |
+
</scheduler_cron_expr_sweepimages>
|
74 |
+
<scheduler_cron_expr_sweepstyle>
|
75 |
+
<label>Sweep JavaScript/CSS Cache</label>
|
76 |
+
<comment>Cron Configuration. (Run every 30 min "30 * * * *")</comment>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>5</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>0</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
</scheduler_cron_expr_sweepstyle>
|
83 |
+
|
84 |
+
</fields>
|
85 |
+
</cachesweep>
|
86 |
+
</groups>
|
87 |
+
</cachesweepsection>
|
88 |
+
</sections>
|
89 |
+
</config>
|
app/design/adminhtml/default/default/layout/demac_cachesweep.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addCss"><name>demac_cachesweep/css/cachesweep.css</name></action>
|
6 |
+
|
7 |
+
</reference>
|
8 |
+
</default>
|
9 |
+
</layout>
|
app/etc/modules/Demac_CacheSweep.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Demac_CacheSweep>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Demac_CacheSweep>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Demac_CacheSweep</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Automatic Cache Cleaning and Maintenance.</summary>
|
10 |
+
<description>The most common configuration for the Magento Cache is to be stored on the filesystem, unfortunately Magento doesn't clean all the cache entries automatically this can eventually lead to a very large cache comprised by several thousands of file. The larger the cache is, the longer will take to Magento to read through all the files.
|
11 |
+

|
12 |
+
This problem is most commonly experienced at the cart and checkout on store with larger catalogs. Demac Cache Sweeper allows you to periodically clean your cache.</description>
|
13 |
+
<notes>A simple extension to give you valuable insight into how many visits you’re getting to 404 Not Found URLs.</notes>
|
14 |
+
<authors><author><name>Demac Media</name><user>demacmedia</user><email>mbertulli@demacmedia.com</email></author></authors>
|
15 |
+
<date>2011-11-10</date>
|
16 |
+
<time>21:03:20</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Demac"><dir name="CacheSweep"><dir name="Helper"><file name="Data.php" hash="c3a2e52356800c06a02d6187a5ae4672"/></dir><dir name="Model"><file name="Sweeper.php" hash="3cfcfa5618a3dabc8f9c0264b0ae900a"/></dir><dir name="etc"><file name="config.xml" hash="c337ac881e8d9be5493a441cd90bbcf6"/><file name="system.xml" hash="4e2bc209712fd2aa676b5996ee134d21"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Demac_CacheSweep.xml" hash="679c19b96f3250b78150f7a0c036be7c"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="demac_cachesweep.xml" hash="53f377aba95fa15a17e8fd43c3f0f3df"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="demac_cachesweep"><dir name="css"><file name="cachesweep.css" hash="deb2107d9bf92ece941b3da4cbb97b6c"/></dir><dir name="images"><file name="CacheSweep100x100.png" hash="d366beb8a1500669570cdb576e8cc288"/><file name="CacheSweep25x25.png" hash="aaa266ef6f081ce1a7927fd682bd8324"/><file name="CacheSweep50x50.png" hash="edafe0d2be22864fee06f38204f6c233"/></dir></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Demac_All</name><channel>community</channel><min>5.2.0</min><max>6.0.0</max></package></required></dependencies>
|
20 |
+
</package>
|
skin/adminhtml/default/default/demac_cachesweep/css/cachesweep.css
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
div.cachesweep { background: url(../images/CacheSweep100x100.png) no-repeat transparent; padding-left: 110px; height:180px; max-width:500px; }
|
2 |
+
ul.tabs a.cache-sweep span span.cachesweep { background: url(../images/CacheSweep25x25.png) no-repeat transparent; padding-left: 30px; }
|
skin/adminhtml/default/default/demac_cachesweep/images/CacheSweep100x100.png
ADDED
Binary file
|
skin/adminhtml/default/default/demac_cachesweep/images/CacheSweep25x25.png
ADDED
Binary file
|
skin/adminhtml/default/default/demac_cachesweep/images/CacheSweep50x50.png
ADDED
Binary file
|