1: <?php
2: /*
3:
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * or OpenGPL v3 license (GNU Public License V3.0)
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://opensource.org/licenses/osl-3.0.php
12: * or
13: * http://www.gnu.org/licenses/gpl-3.0.txt
14: * If you did not receive a copy of the license and are unable to
15: * obtain it through the world-wide-web, please send an email
16: * to info@e-abi.ee so we can send you a copy immediately.
17: *
18: * DISCLAIMER
19: *
20: * Do not edit or add to this file if you wish to upgrade this module to newer
21: * versions in the future.
22: *
23: * @category Eabi
24: * @package Eabi_Dpd
25: * @copyright Copyright (c) 2014 Aktsiamaailm LLC (http://en.e-abi.ee/)
26: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
27: * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU Public License V3.0
28: * @author Matis Halmann
29: *
30:
31: */
32:
33: /**
34: * <p>Removes old livehandler from app/local folder</p>
35: *
36: * @author matishalmann
37: */
38: class Eabi_Livehandler_Adminhtml_RemoveController extends Mage_Adminhtml_Controller_Action {
39: protected function _initAction() {
40: return $this;
41: }
42:
43: public function removeAction() {
44: $result = array('status' => 'failed');
45: if ($this->getRequest()->isPost() && $this->getRequest()->getPost('remove') == 'true') {
46: $dirName = Mage::getBaseDir('code').'/local/Eabi/Livehandler';
47: if (is_dir($dirName) && file_exists($dirName.'/etc/config.xml')) {
48: $directory = new Varien_Io_File();
49: $deleteResult = $directory->rmdir($dirName, true);
50: if ($deleteResult) {
51: $result['status'] = 'success';
52: }
53: }
54:
55: }
56: $this->getResponse()->setRawHeader('Content-type: application/json');
57: $this->getResponse()->setBody(json_encode($result));
58: return;
59: }
60:
61: /**
62: *
63: * @return Eabi_Livehandler_Helper_Data
64: */
65: protected function _getEabi() {
66: return Mage::helper('eabi');
67: }
68:
69:
70: }
71:
72:
73: