Buric_Apc - Version 2.0.0.0

Version Notes

No admin theme modifications (observer method injects HTML).

Download this release

Release Info

Developer Zvonimir Burić
Extension Buric_Apc
Version 2.0.0.0
Comparing to
See all releases


Code changes from version 1.0.0.0 to 2.0.0.0

app/code/community/Buric/Apc/Model/Observer.php CHANGED
@@ -12,4 +12,33 @@ class Buric_Apc_Model_Observer {
12
  public function clearApc() {
13
  return apc_clear_cache() && apc_clear_cache('user') && apc_clear_cache('opcode');
14
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
12
  public function clearApc() {
13
  return apc_clear_cache() && apc_clear_cache('user') && apc_clear_cache('opcode');
14
  }
15
+
16
+ public function injectHtml(Varien_Event_Observer $observer) {
17
+ $block = $observer->getBlock();
18
+
19
+ if($block instanceof Mage_Adminhtml_Block_Cache_Additional) {
20
+ $transport = $observer->getTransport();
21
+
22
+ $insert =
23
+ '<tr>
24
+ <td class="scope-label">
25
+ <button onclick="setLocation(\'' . Mage::helper('adminhtml')->getUrl('adminhtml/clearapc/index') . '\')" type="button" class="scalable">
26
+ <span>' . Mage::helper('adminhtml')->__('Flush APC Cache') . '</span>
27
+ </button>
28
+ </td>
29
+ <td class="scope-label">' . Mage::helper('adminhtml')->__('APC user and system cache.') . '</td>
30
+ </tr>';
31
+
32
+ $dom = new DOMDocument();
33
+
34
+ $dom->loadHTML($transport->getHtml());
35
+
36
+ $td = $dom->createDocumentFragment();
37
+ $td->appendXML($insert);
38
+
39
+ $dom->getElementsByTagName('table')->item(1)->insertBefore($td, $dom->getElementsByTagName('table')->item(1)->firstChild);
40
+
41
+ $transport->setHtml($dom->saveHTML());
42
+ }
43
+ }
44
  }
app/code/community/Buric/Apc/etc/config.xml CHANGED
@@ -43,6 +43,15 @@
43
  </buric_apc>
44
  </observers>
45
  </controller_action_postdispatch_adminhtml_cache_flushSystem>
 
 
 
 
 
 
 
 
 
46
  </events>
47
  </adminhtml>
48
  </config>
43
  </buric_apc>
44
  </observers>
45
  </controller_action_postdispatch_adminhtml_cache_flushSystem>
46
+ <core_block_abstract_to_html_after>
47
+ <observers>
48
+ <buric_apc>
49
+ <type>singleton</type>
50
+ <class>buric_apc/observer</class>
51
+ <method>injectHtml</method>
52
+ </buric_apc>
53
+ </observers>
54
+ </core_block_abstract_to_html_after>
55
  </events>
56
  </adminhtml>
57
  </config>
app/design/adminhtml/default/default/template/system/cache/additional.phtml DELETED
@@ -1,37 +0,0 @@
1
- <br/>
2
- <div class="content-header">
3
- <table cellspacing="0">
4
- <tr>
5
- <td><h3><?php echo Mage::helper('adminhtml')->__('Additional Cache Management') ?></h3></td><td class="form-buttons"></td>
6
- </tr>
7
- </table>
8
- </div>
9
- <table class="form-list">
10
- <tr>
11
- <td class="scope-label">
12
- <button onclick="setLocation('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/clearapc/index')?>')" type="button" class="scalable">
13
- <span><?php echo Mage::helper('adminhtml')->__('Flush APC Cache') ?></span>
14
- </button>
15
- </td>
16
- <td class="scope-label">
17
- <?php echo Mage::helper('adminhtml')->__('APC user and system cache.')?>
18
- </td>
19
- </tr>
20
- <tr>
21
- <td class="scope-label">
22
- <button onclick="setLocation('<?php echo $this->getCleanImagesUrl()?>')" type="button" class="scalable"><span><?php echo Mage::helper('adminhtml')->__('Flush Catalog Images Cache') ?></span></button>
23
- </td>
24
- <td class="scope-label">
25
- <?php echo Mage::helper('adminhtml')->__('Pregenerated product images files.')?>
26
- </td>
27
- </tr>
28
- <tr>
29
- <td class="scope-label">
30
- <button onclick="setLocation('<?php echo $this->getCleanMediaUrl()?>')" type="button" class="scalable"><span><?php echo Mage::helper('adminhtml')->__('Flush JavaScript/CSS Cache') ?></span></button>
31
- </td>
32
- <td class="scope-label">
33
- <?php echo Mage::helper('adminhtml')->__('Themes JavaScript and CSS files combined to one file.')?>
34
- </td>
35
- </tr>
36
- </table>
37
- <?php echo $this->getChildHtml(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,22 +1,29 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Buric_Apc</name>
4
- <version>1.0.0.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Clear the APC cache from Cache management section in Magento admin panel.</summary>
10
- <description>A button in the Cache management section in Magento admin panel. Clicking on the button clears APC cache.&#xD;
 
 
 
 
 
 
 
11
  &lt;br /&gt;&#xD;
12
  &lt;img src="http://inchoo.net/wp-content/uploads/2013/02/Cache-Management-System-Magento-Admin.png" /&gt;&#xD;
13
  &lt;hr /&gt;&#xD;
14
  &lt;a href="https://github.com/buric/Inchoo_Apc"&gt;GitHub Repository&lt;/a&gt;</description>
15
- <notes>Initial</notes>
16
  <authors><author><name>Zvonimir Buri&#x107;</name><user>buric</user><email>zvonimir.buric@gmail.com</email></author></authors>
17
- <date>2014-03-04</date>
18
- <time>11:46:34</time>
19
- <contents><target name="magecommunity"><dir name="Buric"><dir name="Apc"><dir name="Model"><file name="Observer.php" hash="d488e59645b9540fd460b9db3fb85689"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ClearapcController.php" hash="a3804ae5ca022f47ad0d8e0578a3b249"/></dir></dir><dir name="etc"><file name="config.xml" hash="1afbc321e15cc05998a21346972462bd"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Buric_Apc.xml" hash="24095e61df9748e32487da144b2610b0"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="system"><dir name="cache"><file name="additional.phtml" hash="41ce6026425d351c5927bb30f61043c0"/></dir></dir></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Buric_Apc</name>
4
+ <version>2.0.0.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Clear the APC cache from Cache management section in Magento admin panel.</summary>
10
+ <description>This extension adds the "Flush APC Cache" button in the Cache management section in Magento admin.&#xD;
11
+ &#xD;
12
+ When user clicks on the button, whole APC cache is cleared (user cache + opcode cache).&#xD;
13
+ &#xD;
14
+ User is warned if there is no APC installed at the server.&#xD;
15
+ &#xD;
16
+ From version 2.0.0.0 there is no admin theme modifications (observer method injects HTML).&#xD;
17
+ &#xD;
18
  &lt;br /&gt;&#xD;
19
  &lt;img src="http://inchoo.net/wp-content/uploads/2013/02/Cache-Management-System-Magento-Admin.png" /&gt;&#xD;
20
  &lt;hr /&gt;&#xD;
21
  &lt;a href="https://github.com/buric/Inchoo_Apc"&gt;GitHub Repository&lt;/a&gt;</description>
22
+ <notes>No admin theme modifications (observer method injects HTML).</notes>
23
  <authors><author><name>Zvonimir Buri&#x107;</name><user>buric</user><email>zvonimir.buric@gmail.com</email></author></authors>
24
+ <date>2014-03-05</date>
25
+ <time>09:51:51</time>
26
+ <contents><target name="magecommunity"><dir name="Buric"><dir name="Apc"><dir name="Model"><file name="Observer.php" hash="7650fccd3d75666379b44892d6710815"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ClearapcController.php" hash="a3804ae5ca022f47ad0d8e0578a3b249"/></dir></dir><dir name="etc"><file name="config.xml" hash="ac471e04150f8e23beee941af34a4b87"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Buric_Apc.xml" hash="24095e61df9748e32487da144b2610b0"/></dir></target></contents>
27
  <compatible/>
28
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
29
  </package>