Version Notes
First release of module.
Download this release
Release Info
Developer | Magento Core Team |
Extension | JRD_ClearCache |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/JRD/ClearCache/Helper/Data.php +5 -0
- app/code/community/JRD/ClearCache/Model/Observer.php +16 -0
- app/code/community/JRD/ClearCache/controllers/IndexController.php +28 -0
- app/code/community/JRD/ClearCache/etc/config.xml +43 -0
- app/etc/modules/JRD_ClearCache.xml +9 -0
- package.xml +18 -0
app/code/community/JRD/ClearCache/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class JRD_ClearCache_Helper_Data extends Mage_Core_Helper_Data {
|
4 |
+
|
5 |
+
}
|
app/code/community/JRD/ClearCache/Model/Observer.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class JRD_ClearCache_Model_Observer {
|
4 |
+
|
5 |
+
public function addButton($observer) {
|
6 |
+
$block = $observer->getEvent()->getBlock();
|
7 |
+
if(get_class($block) == 'Mage_Adminhtml_Block_Cache') {
|
8 |
+
$button = $block->addButton('clearcache', array(
|
9 |
+
'label' => Mage::helper('clearcache')->__('Clear cache folder'),
|
10 |
+
'onclick' => 'confirmSetLocation(\'' . Mage::helper('clearcache')->__('Do You really want to remove var/cache folder?') . '\',\'' . Mage::helper("adminhtml")->getUrl('clearcache') . '\')',
|
11 |
+
'class' => 'delete'
|
12 |
+
));
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/JRD/ClearCache/controllers/IndexController.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class JRD_ClearCache_IndexController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction() {
|
7 |
+
$dirPath = Mage::getBaseDir() . '/var/cache/';
|
8 |
+
if (!is_dir($dirPath)) {
|
9 |
+
Mage::getSingleton('adminhtml/session')->addError('Failed :(');
|
10 |
+
} else {
|
11 |
+
$this->deleteDir($dirPath);
|
12 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('var/cache folder removed successfully');
|
13 |
+
}
|
14 |
+
$this->_redirectReferer();
|
15 |
+
}
|
16 |
+
|
17 |
+
public static function deleteDir($dirPath) {
|
18 |
+
$files = glob($dirPath . '*', GLOB_MARK);
|
19 |
+
foreach($files as $file) {
|
20 |
+
if (is_dir($file)) {
|
21 |
+
self::deleteDir($file);
|
22 |
+
} else {
|
23 |
+
unlink($file);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
// rmdir($dirPath);
|
27 |
+
}
|
28 |
+
}
|
app/code/community/JRD/ClearCache/etc/config.xml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<JRD_ClearCache>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</JRD_ClearCache>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<clearcache>
|
11 |
+
<class>JRD_ClearCache_Model</class>
|
12 |
+
</clearcache>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<clearcache>
|
16 |
+
<class>JRD_ClearCache_Helper</class>
|
17 |
+
</clearcache>
|
18 |
+
</helpers>
|
19 |
+
</global>
|
20 |
+
<adminhtml>
|
21 |
+
<events>
|
22 |
+
<core_block_abstract_prepare_layout_before>
|
23 |
+
<observers>
|
24 |
+
<clearcache_core_block_abstract_prepare_layout_before>
|
25 |
+
<class>clearcache/observer</class>
|
26 |
+
<method>addButton</method>
|
27 |
+
</clearcache_core_block_abstract_prepare_layout_before>
|
28 |
+
</observers>
|
29 |
+
</core_block_abstract_prepare_layout_before>
|
30 |
+
</events>
|
31 |
+
</adminhtml>
|
32 |
+
<admin>
|
33 |
+
<routers>
|
34 |
+
<clearcache>
|
35 |
+
<use>admin</use>
|
36 |
+
<args>
|
37 |
+
<module>JRD_ClearCache</module>
|
38 |
+
<frontName>clearcache</frontName>
|
39 |
+
</args>
|
40 |
+
</clearcache>
|
41 |
+
</routers>
|
42 |
+
</admin>
|
43 |
+
</config>
|
app/etc/modules/JRD_ClearCache.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<JRD_ClearCache>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</JRD_ClearCache>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>JRD_ClearCache</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Additional button added to Cache Management that can physically removes files from var/cache folder.</summary>
|
10 |
+
<description>This module adds new button to Cache Management admin area that physically removes files from var/cache folder.</description>
|
11 |
+
<notes>First release of module.</notes>
|
12 |
+
<authors><author><name>JRD</name><user>auto-converted</user><email>poczta@kamilbrorkowski.pl</email></author></authors>
|
13 |
+
<date>2013-05-25</date>
|
14 |
+
<time>20:55:34</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="JRD"><dir name="ClearCache"><dir name="Helper"><file name="Data.php" hash="2106d45bd384ece4d4fc9d99d8d68b12"/></dir><dir name="Model"><file name="Observer.php" hash="afd82de783269c0eab3f581841407596"/></dir><dir name="controllers"><file name="IndexController.php" hash="176939398d002ea86c703b9fdfc58607"/></dir><dir name="etc"><file name="config.xml" hash="8c8f22415092795e29cbd9ab5e50bf04"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="JRD_ClearCache.xml" hash="fc17da3b08673c898ad8bff1b3f7a93e"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|