MageBackup_MageBackupFree - Version 1.0.0

Version Notes

Version 1.0.0

Download this release

Release Info

Developer Magento Core Team
Extension MageBackup_MageBackupFree
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (32) hide show
  1. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup.php +23 -0
  2. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit.php +40 -0
  3. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit/Form.php +28 -0
  4. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit/Tab/General.php +66 -0
  5. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit/Tabs.php +32 -0
  6. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Grid.php +116 -0
  7. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Renderer/Download.php +26 -0
  8. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Renderer/Duration.php +24 -0
  9. app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Renderer/Size.php +26 -0
  10. app/code/community/MageBackup/MageBackupFree/Block/Magebackupfree.php +23 -0
  11. app/code/community/MageBackup/MageBackupFree/Helper/Data.php +60 -0
  12. app/code/community/MageBackup/MageBackupFree/Model/Backup.php +103 -0
  13. app/code/community/MageBackup/MageBackupFree/Model/Backup/Backup.php +72 -0
  14. app/code/community/MageBackup/MageBackupFree/Model/Backup/Db.php +43 -0
  15. app/code/community/MageBackup/MageBackupFree/Model/Backup/File.php +79 -0
  16. app/code/community/MageBackup/MageBackupFree/Model/Config.php +62 -0
  17. app/code/community/MageBackup/MageBackupFree/Model/Config/Backuptype.php +28 -0
  18. app/code/community/MageBackup/MageBackupFree/Model/Config/Cron/Frequency.php +40 -0
  19. app/code/community/MageBackup/MageBackupFree/Model/Config/Cron/Hour.php +24 -0
  20. app/code/community/MageBackup/MageBackupFree/Model/Config/File.php +36 -0
  21. app/code/community/MageBackup/MageBackupFree/Model/Mysql4/Backup.php +19 -0
  22. app/code/community/MageBackup/MageBackupFree/Model/Mysql4/Backup/Collection.php +19 -0
  23. app/code/community/MageBackup/MageBackupFree/Model/Status.php +24 -0
  24. app/code/community/MageBackup/MageBackupFree/controllers/Adminhtml/Magebackupfree/BackupController.php +215 -0
  25. app/code/community/MageBackup/MageBackupFree/etc/adminhtml.xml +61 -0
  26. app/code/community/MageBackup/MageBackupFree/etc/config.xml +111 -0
  27. app/code/community/MageBackup/MageBackupFree/etc/system.xml +209 -0
  28. app/code/community/MageBackup/MageBackupFree/sql/magebackupfree_setup/mysql4-install-1.0.0.php +35 -0
  29. app/design/adminhtml/default/default/layout/magebackupfree.xml +15 -0
  30. app/etc/modules/MageBackup_MageBackupFree.xml +16 -0
  31. app/locale/en_US/MageBackup_MageBackupFree.csv +31 -0
  32. package.xml +18 -0
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup Adminhtml block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup extends Mage_Adminhtml_Block_Widget_Grid_Container {
15
+
16
+ public function __construct() {
17
+ $this->_controller = 'adminhtml_backup';
18
+ $this->_blockGroup = 'magebackupfree';
19
+ $this->_headerText = Mage::helper('magebackupfree')->__('Manage Backups');
20
+ $this->_addButtonLabel = Mage::helper('magebackupfree')->__('Add New Backup');
21
+ parent::__construct();
22
+ }
23
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup Adminhtml edit block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
15
+
16
+ public function __construct() {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'id';
20
+ $this->_blockGroup = 'magebackupfree';
21
+ $this->_controller = 'adminhtml_backup';
22
+
23
+ if (Mage::registry('backup') && Mage::registry('backup')->getId()) {
24
+ $this->_updateButton('save', 'label', Mage::helper('magebackupfree')->__('Save'));
25
+ } else {
26
+ $this->_updateButton('save', 'label', Mage::helper('magebackupfree')->__('Backup Now'));
27
+ $this->_updateButton('save', 'onclick', "toggleSelectsUnderBlock($('loading-mask'), true); $('loading-mask').show(); editForm.submit();");
28
+ }
29
+
30
+ $this->_updateButton('delete', 'label', Mage::helper('magebackupfree')->__('Delete Backup'));
31
+ }
32
+
33
+ public function getHeaderText() {
34
+ if (Mage::registry('backup') && Mage::registry('backup')->getId()) {
35
+ return Mage::helper('magebackupfree')->__("Edit Backup '%s'", $this->htmlEscape(Mage::registry('backup')->getName()));
36
+ } else {
37
+ return Mage::helper('magebackupfree')->__('Add New Backup');
38
+ }
39
+ }
40
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit/Form.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Mage Backup Free Adminhtml edit form block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
15
+
16
+ protected function _prepareForm() {
17
+ $form = new Varien_Data_Form(array(
18
+ 'id' => 'edit_form',
19
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
20
+ 'method' => 'post',
21
+ ));
22
+
23
+ $form->setUseContainer(true);
24
+ $this->setForm($form);
25
+
26
+ return parent::_prepareForm();
27
+ }
28
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit/Tab/General.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Mage Backup Free Adminhtml form block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form {
15
+
16
+ protected function _prepareForm() {
17
+ /** @var $model MageBackup_MageBackupFree_Model_Backup */
18
+ $model = Mage::registry('backup');
19
+
20
+ $form = new Varien_Data_Form();
21
+ $this->setForm($form);
22
+
23
+ $fieldset = $form->addFieldset('backup_form', array(
24
+ 'legend' => Mage::helper('magebackupfree')->__('Backup Information'),
25
+ 'class' => 'fieldset-wide',
26
+ ));
27
+
28
+ $fieldset->addField('name', 'text', array(
29
+ 'label' => Mage::helper('magebackupfree')->__('Backup Description'),
30
+ 'class' => 'required-entry',
31
+ 'required' => true,
32
+ 'name' => 'name',
33
+ ));
34
+
35
+ $fieldset->addField('description', 'editor', array(
36
+ 'name' => 'description',
37
+ 'label' => Mage::helper('magebackupfree')->__('Backup Comment'),
38
+ 'title' => Mage::helper('magebackupfree')->__('Backup Comment'),
39
+ 'style' => 'width: 98%; height: 200px;',
40
+ 'wysiwyg' => false,
41
+ 'required' => false,
42
+ ));
43
+
44
+ if ($model->getId()) {
45
+ // $logs_fieldset = $form->addFieldset('backup_logs', array(
46
+ // 'legend' => Mage::helper('magebackupfree')->__('Backup Logs'),
47
+ // 'class' => 'fieldset-wide',
48
+ // ));
49
+ //
50
+ // $logs_fieldset->addField('logs', 'editor', array(
51
+ // 'name' => 'logs',
52
+ // 'label' => Mage::helper('magebackupfree')->__('Backup Logs'),
53
+ // 'title' => Mage::helper('magebackupfree')->__('Backup Logs'),
54
+ // 'style' => 'width: 98%; height: 400px;',
55
+ // 'wysiwyg' => false,
56
+ // 'required' => false,
57
+ // ));
58
+ } else {
59
+ $model->setName(Mage::helper('magebackupfree')->__('Backup taken on %s', date('r')));
60
+ }
61
+
62
+ $form->setValues($model->getData());
63
+
64
+ return parent::_prepareForm();
65
+ }
66
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Edit/Tabs.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Mage Backup Free Adminhtml left menu
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
15
+
16
+ public function __construct() {
17
+ parent::__construct();
18
+ $this->setId('backup_tabs');
19
+ $this->setDestElementId('edit_form');
20
+ $this->setTitle(Mage::helper('magebackupfree')->__('Backup Information'));
21
+ }
22
+
23
+ protected function _beforeToHtml() {
24
+ $this->addTab('form_section', array(
25
+ 'label' => Mage::helper('magebackupfree')->__('General'),
26
+ 'title' => Mage::helper('magebackupfree')->__('General'),
27
+ 'content' => $this->getLayout()->createBlock('magebackupfree/adminhtml_backup_edit_tab_general')->toHtml(),
28
+ ));
29
+
30
+ return parent::_beforeToHtml();
31
+ }
32
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup Adminhtml grid block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Grid extends Mage_Adminhtml_Block_Widget_Grid {
15
+
16
+ public function __construct() {
17
+ parent::__construct();
18
+ $this->setId('backupGrid');
19
+ $this->setDefaultSort('backup_id');
20
+ $this->setDefaultDir('DESC');
21
+ $this->setSaveParametersInSession(true);
22
+ $this->setUseAjax(true);
23
+ }
24
+
25
+ protected function _prepareCollection() {
26
+ $collection = Mage::getModel('magebackupfree/backup')->getCollection();
27
+ $this->setCollection($collection);
28
+
29
+ return parent::_prepareCollection();
30
+ }
31
+
32
+ protected function _prepareColumns() {
33
+ $this->addColumn('backup_id', array(
34
+ 'header' => Mage::helper('magebackupfree')->__('ID'),
35
+ 'align' => 'right',
36
+ 'width' => '50px',
37
+ 'index' => 'backup_id',
38
+ 'type' => 'number',
39
+ ));
40
+
41
+ $this->addColumn('name', array(
42
+ 'header' => Mage::helper('magebackupfree')->__('Name'),
43
+ 'align' => 'left',
44
+ 'index' => 'name',
45
+ ));
46
+
47
+ $this->addColumn('duration', array(
48
+ 'header' => Mage::helper('magebackupfree')->__('Duration'),
49
+ 'align' => 'left',
50
+ 'renderer' => 'magebackupfree/adminhtml_backup_renderer_duration',
51
+ 'filter' => false,
52
+ 'sortable' => false,
53
+ 'width' => '90px',
54
+ ));
55
+
56
+ $this->addColumn('file_name', array(
57
+ 'header' => Mage::helper('magebackupfree')->__('Download'),
58
+ 'align' => 'left',
59
+ 'index' => 'file_name',
60
+ 'renderer' => 'magebackupfree/adminhtml_backup_renderer_download',
61
+ 'class' => 'nowrap',
62
+ 'width' => '270px',
63
+ ));
64
+
65
+ $this->addColumn('file_size', array(
66
+ 'header' => Mage::helper('magebackupfree')->__('File Size'),
67
+ 'align' => 'left',
68
+ 'index' => 'file_size',
69
+ 'filter' => false,
70
+ 'sortable' => false,
71
+ 'renderer' => 'magebackupfree/adminhtml_backup_renderer_size',
72
+ 'width' => '100px',
73
+ ));
74
+
75
+ $this->addColumn('action', array(
76
+ 'header' => Mage::helper('magebackupfree')->__('Action'),
77
+ 'width' => '100px',
78
+ 'type' => 'action',
79
+ 'getter' => 'getId',
80
+ 'actions' => array(
81
+ array(
82
+ 'caption' => Mage::helper('magebackupfree')->__('Delete'),
83
+ 'url' => array('base' => '*/*/delete'),
84
+ 'field' => 'id',
85
+ 'confirm' => Mage::helper('adminhtml')->__('Are you sure you want to do this?'),
86
+ ),
87
+ ),
88
+ 'filter' => false,
89
+ 'sortable' => false,
90
+ 'index' => 'stores',
91
+ 'is_system' => true,
92
+ ));
93
+
94
+ return parent::_prepareColumns();
95
+ }
96
+
97
+ protected function _prepareMassaction() {
98
+ $this->setMassactionIdField('backup_id');
99
+ $this->getMassactionBlock()->setFormFieldName('backup');
100
+ $this->getMassactionBlock()->addItem('delete', array(
101
+ 'label' => Mage::helper('magebackupfree')->__('Delete'),
102
+ 'url' => $this->getUrl('*/*/massDelete'),
103
+ 'confirm' => Mage::helper('magebackupfree')->__('Are you sure?'),
104
+ ));
105
+
106
+ return $this;
107
+ }
108
+
109
+ public function getRowUrl($row) {
110
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
111
+ }
112
+
113
+ public function getGridUrl() {
114
+ return $this->getUrl('*/*/grid', array('_current' => true));
115
+ }
116
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Renderer/Download.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup Adminhtml file download renderer block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Renderer_Download extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
15
+
16
+ public function render(Varien_Object $row) {
17
+ $outputDir = Mage::getSingleton('magebackupfree/config')->getOutputDir();
18
+ $filePath = $outputDir . DS . $row->getFileName();
19
+
20
+ if (is_file($filePath)) {
21
+ return '<a href="' . $this->getUrl('*/*/download', array('id' => $row->getId())) .'">' . $row->getFileName() . '</a>';
22
+ } else {
23
+ return $row->getFileName();
24
+ }
25
+ }
26
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Renderer/Duration.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup Adminhtml backup duration renderer block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Renderer_Duration extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
15
+
16
+ public function render(Varien_Object $row) {
17
+ $runtime = strtotime($row->getEndTime()) - strtotime($row->getStartTime());
18
+ $runtimeSec = $runtime % 60;
19
+ $runtimeMin = (int) ($runtime / 60) % 60;
20
+ $runtimeHour = (int) ($runtime / 3600);
21
+
22
+ return $runtimeHour . 'h ' . $runtimeMin . 'm ' . $runtimeSec . 's';
23
+ }
24
+ }
app/code/community/MageBackup/MageBackupFree/Block/Adminhtml/Backup/Renderer/Size.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup Adminhtml file size renderer block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_Adminhtml_Backup_Renderer_Size extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
15
+
16
+ public function render(Varien_Object $row) {
17
+ $outputDir = Mage::getSingleton('magebackupfree/config')->getOutputDir();
18
+ $filePath = $outputDir . DS . $row->getFileName();
19
+
20
+ if (is_file($filePath)) {
21
+ return Mage::helper('magebackupfree')->formatFileSize(filesize($filePath));
22
+ } else {
23
+ return Mage::helper('magebackupfree')->__('Not Available');
24
+ }
25
+ }
26
+ }
app/code/community/MageBackup/MageBackupFree/Block/Magebackupfree.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Mage Backup Free block
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Block_MageBackupFree extends Mage_Core_Block_Template {
15
+
16
+ public function _prepareLayout() {
17
+ return parent::_prepareLayout();
18
+ }
19
+
20
+ public function getMageBackupFree() {
21
+ return 'Mage Backup Free will go here';
22
+ }
23
+ }
app/code/community/MageBackup/MageBackupFree/Helper/Data.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Mage Backup Free data helper
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup ({email})
13
+ */
14
+ class MageBackup_MageBackupFree_Helper_Data extends Mage_Core_Helper_Abstract {
15
+
16
+ public function unlimit() {
17
+ ini_set('max_execution_time', 9999999);
18
+ ini_set('memory_limit', '9999M');
19
+
20
+ // fix mysql timeout
21
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
22
+ $write->query('set session wait_timeout = 999999');
23
+ }
24
+
25
+ public function formatFileSize($int, $bytesStyle = false){
26
+ if ($bytesStyle != false) {
27
+ $bytes = $int;
28
+ }
29
+
30
+ $str = ' ' . $this->__('bytes');
31
+
32
+ if ($int > 1024 + 256) {
33
+ $int /= 1024;
34
+ $str = ' ' . $this->__('KB');
35
+ }
36
+
37
+ if ($int > 1024 + 256) {
38
+ $int /= 1024;
39
+ $str = ' ' . $this->__('MB');
40
+ }
41
+
42
+ if ($int > 1024 + 256) {
43
+ $int /= 1024;
44
+ $str = ' ' . $this->__('GB');
45
+ }
46
+
47
+ if ($int > 1024 + 256) {
48
+ $int /= 1024;
49
+ $str = ' ' . $this->__('TB');
50
+ }
51
+
52
+ $int2 = round(number_format($int, 2), 2);
53
+
54
+ if ($str != (' ' . $this->__('bytes')) AND $bytesStyle == 1) {
55
+ $str .= ' (' . $bytes . ' ' . $this->__('bytes') . ')';
56
+ }
57
+
58
+ return $int2 . $str;
59
+ }
60
+ }
app/code/community/MageBackup/MageBackupFree/Model/Backup.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Backup extends Mage_Core_Model_Abstract {
15
+
16
+ public function _construct() {
17
+ parent::_construct();
18
+ $this->_init('magebackupfree/backup');
19
+ }
20
+
21
+ public function getActiveBackupsOption() {
22
+ $collection = Mage::getModel('magebackupfree/backup')
23
+ ->getCollection()
24
+ ->addFieldToFilter('status', array('eq' => '1'))
25
+ ;
26
+
27
+ $options = array();
28
+ foreach ($collection as $backup) {
29
+ $options[$backup->getBackupId()] = $backup->getName();
30
+ }
31
+
32
+ return $options;
33
+ }
34
+
35
+ public function getFileName() {
36
+ if (!$this->getData('file_name')) {
37
+ $this->setData('file_name', sprintf('site-%s-%s-%s', $_SERVER['SERVER_NAME'], strftime('%Y%m%d'), strftime('%H%M%S')) . '.zip');
38
+ }
39
+
40
+ return $this->getData('file_name');
41
+ }
42
+
43
+ public function backup() {
44
+ // initialize
45
+ Mage::helper('magebackupfree')->unlimit();
46
+
47
+ $config = Mage::getSingleton('magebackupfree/config');
48
+ $ouputDir = $config->getOutputDir();
49
+ $tmpDir = $config->getTempDir();
50
+
51
+ @mkdir($ouputDir, 0777, true);
52
+ @mkdir($tmpDir, 0777, true);
53
+
54
+ if (!file_exists($ouputDir) || !file_exists($tmpDir)) {
55
+ return false;
56
+ }
57
+
58
+ // clear database file in temp dir
59
+ if (file_exists($tmpDir . DS . 'database.sql')) {
60
+ @unlink($tmpDir . DS . 'database.sql');
61
+ }
62
+
63
+ if (!file_exists($ouputDir . DS . '.htaccess')) {
64
+ file_put_contents($ouputDir . DS . '.htaccess', 'deny from all');
65
+ }
66
+
67
+ //
68
+ $backupType = $config->getBackupType();
69
+
70
+ // backup database
71
+ if ($backupType == MageBackup_MageBackupFree_Model_Config_Backuptype::TYPE_ALL || $backupType == MageBackup_MageBackupFree_Model_Config_Backuptype::TYPE_DATABASE) {
72
+ if (!Mage::getSingleton('magebackupfree/backup_db')->setBackup($this)->backup()) {
73
+ return false;
74
+ }
75
+ }
76
+
77
+ // backup files
78
+ if ($backupType == MageBackup_MageBackupFree_Model_Config_Backuptype::TYPE_ALL || $backupType == MageBackup_MageBackupFree_Model_Config_Backuptype::TYPE_FILE) {
79
+ if (!Mage::getSingleton('magebackupfree/backup_file')->setBackup($this)->backup()) {
80
+ return false;
81
+ }
82
+ }
83
+
84
+ // add database file to zip
85
+ if ($backupType != MageBackup_MageBackupFree_Model_Config_Backuptype::TYPE_FILE) {
86
+ $zip = new ZipArchive();
87
+ $zip->open($ouputDir . DS . $this->getFileName(), ZipArchive::CREATE);
88
+
89
+ if ($backupType == MageBackup_MageBackupFree_Model_Config_Backuptype::TYPE_ALL) {
90
+ $length = strlen(Mage::getBaseDir() . DS);
91
+ $dbDir = str_replace('\\', '/', substr($ouputDir, $length)) . '/database.sql';
92
+ } else {
93
+ $dbDir = 'database.sql';
94
+ }
95
+
96
+ $zip->addFile($tmpDir . DS . 'database.sql', $dbDir);
97
+
98
+ $zip->close();
99
+ }
100
+
101
+ return true;
102
+ }
103
+ }
app/code/community/MageBackup/MageBackupFree/Model/Backup/Backup.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup backup model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author Pham Minh Tuan (tuanpm@magezone.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Backup_Backup extends Mage_Backup_Model_Backup {
15
+
16
+ public function getFileName() {
17
+ return 'database.sql';
18
+ }
19
+
20
+ public function open($write = false) {
21
+ $ioAdapter = new Varien_Io_File();
22
+
23
+ try {
24
+ $path = $ioAdapter->getCleanPath($this->getPath());
25
+ $ioAdapter->checkAndCreateFolder($path);
26
+ $filePath = $path . DS . $this->getFileName();
27
+ } catch (Exception $e) {
28
+ Mage::exception('Mage_Backup', $e->getMessage());
29
+ }
30
+
31
+ if ($write && $ioAdapter->fileExists($filePath)) {
32
+ $ioAdapter->rm($filePath);
33
+ }
34
+ if (!$write && !$ioAdapter->fileExists($filePath)) {
35
+ Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" does not exist.', $this->getFileName()));
36
+ }
37
+
38
+ $mode = $write ? 'w+' : 'r+';
39
+
40
+ $this->_handler = @fopen($filePath, $mode);
41
+
42
+ if (!$this->_handler) {
43
+ throw new Mage_Backup_Exception_NotEnoughPermissions(
44
+ Mage::helper('backup')->__('Backup file "%s" cannot be read from or written to.', $this->getFileName())
45
+ );
46
+ }
47
+
48
+ return $this;
49
+ }
50
+
51
+ public function write($string) {
52
+ if (is_null($this->_handler)) {
53
+ Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler was unspecified.'));
54
+ }
55
+
56
+ try {
57
+ fwrite($this->_handler, $string);
58
+ }
59
+ catch (Exception $e) {
60
+ Mage::exception('Mage_Backup', Mage::helper('backup')->__('An error occurred while writing to the backup file "%s".', $this->getFileName()));
61
+ }
62
+
63
+ return $this;
64
+ }
65
+
66
+ public function close() {
67
+ @fclose($this->_handler);
68
+ $this->_handler = null;
69
+
70
+ return $this;
71
+ }
72
+ }
app/code/community/MageBackup/MageBackupFree/Model/Backup/Db.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup database model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author Pham Minh Tuan (tuanpm@magezone.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Backup_Db extends Varien_Object {
15
+
16
+ /**
17
+ * Create database backup.
18
+ */
19
+ public function backup() {
20
+ $config = Mage::getSingleton('magebackupfree/config');
21
+ $ouputDir = $config->getOutputDir();
22
+ $tmpDir = $config->getTempDir();
23
+
24
+ $backupDb = Mage::getModel('backup/db');
25
+ $backup = Mage::getModel('magebackupfree/backup_backup')
26
+ ->setTime(time())
27
+ ->setType('db')
28
+ ->setPath($tmpDir)
29
+ ;
30
+
31
+ $dbFile = $tmpDir . DS . 'database.sql';
32
+
33
+ if (file_exists($dbFile)) {
34
+ @unlink($dbFile);
35
+ }
36
+
37
+ Mage::register('backup_model', $backup);
38
+
39
+ $backupDb->createBackup($backup);
40
+
41
+ return true;
42
+ }
43
+ }
app/code/community/MageBackup/MageBackupFree/Model/Backup/File.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup file model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author Pham Minh Tuan (tuanpm@magezone.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Backup_File extends Varien_Object {
15
+ protected $_zip;
16
+
17
+ protected function _addFile($file) {
18
+ if (is_dir($file) || is_file($file)) {
19
+ $filePath = realpath($file);
20
+
21
+ if (is_file($file)) {
22
+ $this->_zip->addFile($filePath, $file);
23
+ }
24
+ }
25
+ }
26
+
27
+ protected function _addDir($root, $path, $exclude_files = array()) {
28
+ $rootLength = strlen($root . DS);
29
+ $children = @glob($root . DS . ($path ? $path . DS : '') . '{,.}*', GLOB_BRACE);
30
+
31
+ if (!empty($children)) {
32
+ foreach ($children as $child) {
33
+ $filePath = substr($child, $rootLength);
34
+
35
+ // excluded files
36
+ $filePath2 = is_dir($filePath) ? $filePath . DS : $filePath;
37
+ $filePath2 = str_replace(DS, '/', $filePath2);
38
+
39
+ if (in_array($filePath2, $exclude_files)) {
40
+ continue;
41
+ }
42
+
43
+ if (is_dir($filePath)) {
44
+ $baseName = basename($filePath);
45
+ if (in_array($baseName, array('.', '..', '.svn'))) {
46
+ continue;
47
+ }
48
+
49
+ // for subdirectory call method recursively
50
+ $this->_addDir($root, $filePath, $exclude_files);
51
+ } else if (is_file($filePath)) {
52
+ $this->_addFile($filePath);
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Backup file system.
60
+ */
61
+ public function backup() {
62
+ $config = Mage::getSingleton('magebackupfree/config');
63
+ $ouputDir = $config->getOutputDir();
64
+ $excludedFiles = $config->getExcludedFiles();
65
+
66
+ try {
67
+ $this->_zip = new ZipArchive();
68
+ $this->_zip->open($ouputDir . DS . $this->getBackup()->getFileName(), ZipArchive::CREATE);
69
+
70
+ $this->_addDir(Mage::getBaseDir(), '', $excludedFiles);
71
+
72
+ $this->_zip->close();
73
+ } catch (Exception $e) {
74
+ return false;
75
+ }
76
+
77
+ return true;
78
+ }
79
+ }
app/code/community/MageBackup/MageBackupFree/Model/Config.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Config {
15
+ const XML_PATH_OUTPUT_DIR = 'magebackupfree/basic/output_dir';
16
+ const XML_PATH_BACKUP_TYPE = 'magebackupfree/basic/backup_type';
17
+ const XML_PATH_EXCLUDED_FILES = 'magebackupfree/file/excluded_files';
18
+ const XML_PATH_CRON_ENABLE = 'magebackupfree/cron/enable';
19
+ const XML_PATH_CRON_FREQUENCY = 'magebackupfree/cron/frequency';
20
+ const XML_PATH_CRON_HOURS = 'magebackupfree/cron/hours';
21
+
22
+ public function getOutputDir() {
23
+ $outputDir = Mage::getStoreConfig(self::XML_PATH_OUTPUT_DIR);
24
+ $outputDir = $outputDir ? $outputDir : '{{base_dir}}/var/magebackup';
25
+
26
+ return str_replace('{{base_dir}}', Mage::getBaseDir(), $outputDir);
27
+ }
28
+
29
+ public function getTempDir() {
30
+ return $this->getOutputDir() . DS . 'tmp';
31
+ }
32
+
33
+ public function getBackupType() {
34
+ return Mage::getStoreConfig(self::XML_PATH_BACKUP_TYPE);
35
+ }
36
+
37
+ public function getExcludedFiles() {
38
+ $lenth = strlen(Mage::getBaseDir() . DS);
39
+ $excludedFiles = explode(',', Mage::getStoreConfig(self::XML_PATH_EXCLUDED_FILES));
40
+ $excludedFiles[] = str_replace('\\', '/', substr($this->getOutputDir(), $lenth)) . '/';
41
+
42
+ return $this->_processExcludedFiles($excludedFiles);
43
+ }
44
+
45
+ protected function _processExcludedFiles($excludedFiles = array()) {
46
+ asort($excludedFiles);
47
+
48
+ $files = array();
49
+ $last = null;
50
+
51
+ foreach ($excludedFiles as $file) {
52
+ if ($file == '' || $last && strpos($file, $last) === 0) {
53
+ continue;
54
+ } else {
55
+ $last = $file;
56
+ $files[] = $file;
57
+ }
58
+ }
59
+
60
+ return $files;
61
+ }
62
+ }
app/code/community/MageBackup/MageBackupFree/Model/Config/Backuptype.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Configuration Backup Type model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Config_Backuptype extends Varien_Object {
15
+ const TYPE_ALL = 0;
16
+ const TYPE_FILE = 1;
17
+ const TYPE_DATABASE = 2;
18
+
19
+ public static function toOptionArray() {
20
+ $options = array(
21
+ self::TYPE_ALL => Mage::helper('magebackupfree')->__('Files and Database'),
22
+ self::TYPE_FILE => Mage::helper('magebackupfree')->__('Files only'),
23
+ self::TYPE_DATABASE => Mage::helper('magebackupfree')->__('Database only'),
24
+ );
25
+
26
+ return $options;
27
+ }
28
+ }
app/code/community/MageBackup/MageBackupFree/Model/Config/Cron/Frequency.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Configuration con freequency model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Config_Cron_Frequency extends Varien_Object {
15
+ const CRON_DAILY = 1;
16
+ const CRON_WEEKLY = 2;
17
+ const CRON_MONTHLY = 3;
18
+ const CRON_EVERY_MINUTE = 4;
19
+
20
+ public static function toOptionArray() {
21
+ return array(
22
+ array(
23
+ 'label' => 'Daily',
24
+ 'value' => self::CRON_DAILY
25
+ ),
26
+ array(
27
+ 'label' => 'Weekly',
28
+ 'value' => self::CRON_WEEKLY
29
+ ),
30
+ array(
31
+ 'label' => 'Monthly',
32
+ 'value' => self::CRON_MONTHLY
33
+ ),
34
+ array(
35
+ 'label' => 'Every minute',
36
+ 'value' => self::CRON_EVERY_MINUTE
37
+ )
38
+ );
39
+ }
40
+ }
app/code/community/MageBackup/MageBackupFree/Model/Config/Cron/Hour.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Configuration cron hour model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Config_Cron_Hour extends Varien_Object {
15
+ public static function toOptionArray() {
16
+ $hours = array();
17
+
18
+ for ($i = 1; $i <= 24; $i++) {
19
+ $hours[] = array('label' => $i, 'value' => $i);
20
+ }
21
+
22
+ return $hours;
23
+ }
24
+ }
app/code/community/MageBackup/MageBackupFree/Model/Config/File.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Configuration File model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Config_File extends Varien_Object {
15
+
16
+ public static function toOptionArray() {
17
+ $options = array();
18
+ $baseDir = Mage::getBaseDir();
19
+ $handle = opendir($baseDir);
20
+
21
+ while (($folder = readdir($handle)) !== false) {
22
+ if ($folder == '.' || $folder == '..' || is_file($folder)) {
23
+ continue;
24
+ }
25
+
26
+ $options[] = array(
27
+ 'value' => $folder . '/',
28
+ 'label' => $folder,
29
+ );
30
+ }
31
+
32
+ closedir($handle);
33
+
34
+ return $options;
35
+ }
36
+ }
app/code/community/MageBackup/MageBackupFree/Model/Mysql4/Backup.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup entity resource model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Mysql4_Backup extends Mage_Core_Model_Mysql4_Abstract {
15
+
16
+ public function _construct() {
17
+ $this->_init('magebackupfree/backup', 'backup_id');
18
+ }
19
+ }
app/code/community/MageBackup/MageBackupFree/Model/Mysql4/Backup/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup collection
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Mysql4_Backup_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
15
+
16
+ public function _construct() {
17
+ $this->_init('magebackupfree/backup');
18
+ }
19
+ }
app/code/community/MageBackup/MageBackupFree/Model/Status.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Mage Backup Free status model
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Model_Status extends Varien_Object {
15
+ const STATUS_ENABLED = 1;
16
+ const STATUS_DISABLED = 2;
17
+
18
+ static public function getOptionArray() {
19
+ return array(
20
+ self::STATUS_ENABLED => Mage::helper('magebackupfree')->__('Enabled'),
21
+ self::STATUS_DISABLED => Mage::helper('magebackupfree')->__('Disabled'),
22
+ );
23
+ }
24
+ }
app/code/community/MageBackup/MageBackupFree/controllers/Adminhtml/Magebackupfree/BackupController.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Backup Adminhtml controller
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+ class MageBackup_MageBackupFree_Adminhtml_MageBackupFree_BackupController extends Mage_Adminhtml_Controller_Action {
15
+
16
+ protected function _initAction() {
17
+ $this->loadLayout()
18
+ ->_setActiveMenu('magebackup/magebackupfree/backup')
19
+ ->_addBreadcrumb(Mage::helper('magebackupfree')->__('Backup Manager'),
20
+ Mage::helper('magebackupfree')->__('Backup Manager'));
21
+
22
+ return $this;
23
+ }
24
+
25
+ protected function _setTitle() {
26
+ return $this->_title($this->__('Mage Backup Free'))->_title($this->__('Backup'));
27
+ }
28
+
29
+ public function indexAction() {
30
+ $this->_setTitle();
31
+ $this->_initAction();
32
+ $this->renderLayout();
33
+ }
34
+
35
+ public function gridAction() {
36
+ $this->getResponse()->setBody(
37
+ $this->getLayout()->createBlock('magebackupfree/adminhtml_backup_grid')->toHtml()
38
+ );
39
+ }
40
+
41
+ public function editAction() {
42
+ $this->_setTitle();
43
+ $backupId = $this->getRequest()->getParam('id');
44
+ $backupModel = Mage::getModel('magebackupfree/backup')->load($backupId);
45
+
46
+ if ($backupModel->getId() || $backupId == 0) {
47
+ Mage::register('backup', $backupModel);
48
+ $this->loadLayout();
49
+ $this->_setActiveMenu('magebackup/magebackupfree/backup');
50
+ $this->_addBreadcrumb(Mage::helper('magebackupfree')->__('Backup Manager'), Mage::helper('magebackupfree')->__('Backup Manager'));
51
+ $this->_addBreadcrumb(Mage::helper('magebackupfree')->__('Backup Description'), Mage::helper('magebackupfree')->__('Backup Description'));
52
+
53
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
54
+ $this->_addContent($this->getLayout()->createBlock('magebackupfree/adminhtml_backup_edit'))
55
+ ->_addLeft($this->getLayout()->createBlock('magebackupfree/adminhtml_backup_edit_tabs'));
56
+ $this->renderLayout();
57
+ } else {
58
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magebackupfree')->__('Backup does not exist'));
59
+ $this->_redirect('*/*/');
60
+ }
61
+ }
62
+
63
+ public function newAction() {
64
+ $this->_forward('edit');
65
+ }
66
+
67
+ public function saveAction() {
68
+ if ($this->getRequest()->getPost()) {
69
+ try {
70
+ $postData = $this->getRequest()->getPost();
71
+ $backupModel = Mage::getModel('magebackupfree/backup');
72
+
73
+ if ($this->getRequest()->getParam('id') <= 0) {
74
+ // create backup
75
+ $backupModel->setStartTime(Mage::getSingleton('core/date')->gmtDate());
76
+ $backupModel->backup();
77
+ $backupModel->setEndTime(Mage::getSingleton('core/date')->gmtDate());
78
+ }
79
+
80
+ $backupModel->addData($postData)
81
+ ->setUpdateTime(Mage::getSingleton('core/date')->gmtDate())
82
+ ->setId($this->getRequest()->getParam('id'))
83
+ ->save()
84
+ ;
85
+
86
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magebackupfree')->__('Backup was successfully saved'));
87
+ Mage::getSingleton('adminhtml/session')->setBackupData(false);
88
+
89
+ // check if 'Save and Continue'
90
+ if ($this->getRequest()->getParam('back')) {
91
+ $this->_redirect('*/*/edit', array('id' => $backupModel->getId()));
92
+ return;
93
+ }
94
+
95
+ // go to grid
96
+ $this->_redirect('*/*/');
97
+ return;
98
+
99
+ } catch (Exception $e) {
100
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
101
+ Mage::getSingleton('adminhtml/session')->setBackupData($this->getRequest()->getPost());
102
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
103
+
104
+ return;
105
+ }
106
+ }
107
+
108
+ $this->_redirect('*/*/');
109
+ }
110
+
111
+ protected function _deleteBackupFile($backup) {
112
+ $filePath = Mage::getSingleton('magebackupfree/config')->getOutputDir() . DS . $backup->getFileName();
113
+
114
+ if (is_file($filePath)) {
115
+ @unlink($filePath);
116
+ }
117
+ }
118
+
119
+ public function deleteAction() {
120
+ if ($this->getRequest()->getParam('id') > 0) {
121
+ try {
122
+ $backupModel = Mage::getModel('magebackupfree/backup')->load($this->getRequest()->getParam('id'));
123
+ $this->_deleteBackupFile($backupModel);
124
+ $backupModel->delete();
125
+
126
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magebackupfree')->__('Backup was successfully deleted'));
127
+ $this->_redirect('*/*/');
128
+ } catch (Exception $e) {
129
+ Mage::getSingleton('adminihtml/session')->addError($e->getMessage());
130
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
131
+ }
132
+ }
133
+
134
+ $this->_redirect('*/*/');
135
+ }
136
+
137
+ public function massDeleteAction() {
138
+ $ids = $this->getRequest()->getParam('backup');
139
+ if (!is_array($ids)) {
140
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magebackupfree')->__('Please select Backup(s)'));
141
+ } else {
142
+ try {
143
+ foreach ($ids as $id) {
144
+ $backup = Mage::getModel('magebackupfree/backup')->load($id);
145
+ $this->_deleteBackupFile($backup);
146
+ $backup->delete();
147
+ }
148
+
149
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magebackupfree')->__('Total of %d Backup(s) were successfully deleted', count($ids)));
150
+
151
+ } catch (Exception $e) {
152
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
153
+ }
154
+ }
155
+
156
+ $this->_redirect('*/*/');
157
+ }
158
+
159
+ public function massStatusAction() {
160
+ $ids = $this->getRequest()->getParam('backup');
161
+ if (!is_array($ids)) {
162
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magebackupfree')->__('Please select Backup(s)'));
163
+ } else {
164
+ try {
165
+ foreach ($ids as $id) {
166
+ $backup = Mage::getModel('magebackupfree/backup')
167
+ ->load($id)
168
+ ->setStatus($this->getRequest()->getParam('status'))
169
+ ->setIsMassupdate(true)
170
+ ->save()
171
+ ;
172
+ }
173
+
174
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magebackupfree')->__('Total of %d Backup(s) were successfully updated', count($ids)));
175
+ } catch (Exception $e) {
176
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
177
+ }
178
+ }
179
+
180
+ $this->_redirect('*/*/');
181
+ }
182
+
183
+ /**
184
+ * Download backup action.
185
+ */
186
+ public function downloadAction() {
187
+ if ($this->getRequest()->getParam('id') <= 0) {
188
+ $this->_redirect('*/*/');
189
+ }
190
+
191
+ Mage::helper('magebackupfree')->unlimit();
192
+
193
+ try {
194
+ $backup = Mage::getSingleton('magebackupfree/backup')->load($this->getRequest()->getParam('id'));
195
+ $config = Mage::getSingleton('magebackupfree/config');
196
+
197
+ $filePath = realpath($config->getOutputDir() . DS . $backup->getFileName());
198
+
199
+ if (!is_file($filePath)) {
200
+ $this->_redirect('*/*/');
201
+ }
202
+
203
+ $content = array(
204
+ 'type' => 'filename',
205
+ 'value' => $filePath,
206
+ );
207
+
208
+ $this->_prepareDownloadResponse($backup->getFileName(), $content);
209
+ } catch (Exception $e) {
210
+
211
+ }
212
+
213
+ exit();
214
+ }
215
+ }
app/code/community/MageBackup/MageBackupFree/etc/adminhtml.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ /**
4
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+
9
+ <config>
10
+ <menu>
11
+ <magebackupfree module="magebackupfree">
12
+ <title>Mage Backup Free</title>
13
+ <sort_order>71</sort_order>
14
+ <children>
15
+ <new_backup module="magebackupfree">
16
+ <title>Backup Now</title>
17
+ <sort_order>0</sort_order>
18
+ <action>adminhtml/magebackupfree_backup/new</action>
19
+ </new_backup>
20
+ <backup module="magebackupfree">
21
+ <title>Manage Backups</title>
22
+ <sort_order>1</sort_order>
23
+ <action>adminhtml/magebackupfree_backup/index</action>
24
+ </backup>
25
+ <magebackupfree_config module="magebackupfree">
26
+ <title>Configuration</title>
27
+ <sort_order>999</sort_order>
28
+ <action>adminhtml/system_config/edit/section/magebackupfree</action>
29
+ </magebackupfree_config>
30
+ </children>
31
+ </magebackupfree>
32
+ </menu>
33
+
34
+ <acl>
35
+ <resources>
36
+ <all>
37
+ <title>Allow Everything</title>
38
+ </all>
39
+ <admin>
40
+ <children>
41
+ <MageBackup_MageBackupFree>
42
+ <title>Mage Backup Free Module</title>
43
+ <sort_order>10</sort_order>
44
+ </MageBackup_MageBackupFree>
45
+ <system>
46
+ <children>
47
+ <config>
48
+ <children>
49
+ <magebackupfree translate="title">
50
+ <title>Mage Backup Free</title>
51
+ <sort_order>50</sort_order>
52
+ </magebackupfree>
53
+ </children>
54
+ </config>
55
+ </children>
56
+ </system>
57
+ </children>
58
+ </admin>
59
+ </resources>
60
+ </acl>
61
+ </config>
app/code/community/MageBackup/MageBackupFree/etc/config.xml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ /**
4
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+
9
+ <config>
10
+ <modules>
11
+ <MageBackup_MageBackupFree>
12
+ <version>1.0.0</version>
13
+ </MageBackup_MageBackupFree>
14
+ </modules>
15
+
16
+ <admin>
17
+ <routers>
18
+ <adminhtml>
19
+ <args>
20
+ <modules>
21
+ <MageBackup_MageBackupFree after="Mage_Adminhtml">MageBackup_MageBackupFree_Adminhtml</MageBackup_MageBackupFree>
22
+ </modules>
23
+ </args>
24
+ </adminhtml>
25
+ </routers>
26
+ </admin>
27
+
28
+ <adminhtml>
29
+ <layout>
30
+ <updates>
31
+ <magebackupfree>
32
+ <file>magebackupfree.xml</file>
33
+ </magebackupfree>
34
+ </updates>
35
+ </layout>
36
+
37
+ <translate>
38
+ <modules>
39
+ <MageBackup_MageBackupFree>
40
+ <files>
41
+ <default>MageBackup_MageBackupFree.csv</default>
42
+ </files>
43
+ </MageBackup_MageBackupFree>
44
+ </modules>
45
+ </translate>
46
+ </adminhtml>
47
+ <global>
48
+ <models>
49
+ <magebackupfree>
50
+ <class>MageBackup_MageBackupFree_Model</class>
51
+ <resourceModel>magebackupfree_mysql4</resourceModel>
52
+ </magebackupfree>
53
+ <magebackupfree_mysql4>
54
+ <class>MageBackup_MageBackupFree_Model_Mysql4</class>
55
+ <entities>
56
+ <backup>
57
+ <table>magebackupfree_backups</table>
58
+ </backup>
59
+ </entities>
60
+ </magebackupfree_mysql4>
61
+ </models>
62
+
63
+ <resources>
64
+ <magebackupfree_setup>
65
+ <setup>
66
+ <module>MageBackup_MageBackupFree</module>
67
+ </setup>
68
+ <connection>
69
+ <use>core_setup</use>
70
+ </connection>
71
+ </magebackupfree_setup>
72
+
73
+ <magebackupfree_write>
74
+ <connection>
75
+ <use>core_setup</use>
76
+ </connection>
77
+ </magebackupfree_write>
78
+
79
+ <magebackupfree_read>
80
+ <connection>
81
+ <use>core_setup</use>
82
+ </connection>
83
+ </magebackupfree_read>
84
+ </resources>
85
+ <blocks>
86
+ <magebackupfree>
87
+ <class>MageBackup_MageBackupFree_Block</class>
88
+ </magebackupfree>
89
+ </blocks>
90
+
91
+ <helpers>
92
+ <magebackupfree>
93
+ <class>MageBackup_MageBackupFree_Helper</class>
94
+ </magebackupfree>
95
+ </helpers>
96
+ </global>
97
+
98
+ <default>
99
+ <magebackupfree>
100
+ <basic>
101
+ <output_dir>{{base_dir}}/var/magebackup</output_dir>
102
+ <backup_type>0</backup_type>
103
+ </basic>
104
+ <cron>
105
+ <enable>0</enable>
106
+ <frequency>1</frequency>
107
+ <hours>1</hours>
108
+ </cron>
109
+ </magebackupfree>
110
+ </default>
111
+ </config>
app/code/community/MageBackup/MageBackupFree/etc/system.xml ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ /**
4
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+
9
+ <config>
10
+ <tabs>
11
+ <magebackup translate="label">
12
+ <label>MageBackup</label>
13
+ <sort_order>40</sort_order>
14
+ </magebackup>
15
+ </tabs>
16
+ <sections>
17
+ <magebackupfree translate="label" module="magebackupfree">
18
+ <class>separator-top</class>
19
+ <label>Mage Backup Free</label>
20
+ <tab>magebackup</tab>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>300</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <groups>
27
+ <basic translate="label">
28
+ <label>Basic Configuration</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>0</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>0</show_in_store>
34
+
35
+ <fields>
36
+ <output_dir translate="label">
37
+ <label>Output Directory</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>1</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </output_dir>
44
+
45
+ <backup_type translate="label">
46
+ <label>Backup Type</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>magebackupfree/config_backuptype</source_model>
49
+ <sort_order>2</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </backup_type>
54
+
55
+ <ajax translate="label">
56
+ <label>Ajax Backup</label>
57
+ <frontend_type>label</frontend_type>
58
+ <comment>
59
+ <![CDATA[
60
+ This feature is available in PRO version. Find more PRO features at
61
+ <a href="http://magebackup.com">http://magebackup.com</a>
62
+ ]]>
63
+ </comment>
64
+ <sort_order>3</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </ajax>
69
+ </fields>
70
+ </basic>
71
+
72
+ <cron translate="label">
73
+ <label>Cron Configuration</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>1</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>0</show_in_store>
79
+
80
+ <fields>
81
+ <enable translate="label">
82
+ <label>Enable Cron</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>1</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </enable>
90
+
91
+ <frequency translate="label">
92
+ <label>Cron Frequency</label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>magebackupfree/config_cron_frequency</source_model>
95
+ <sort_order>2</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </frequency>
100
+
101
+ <hours translate="label">
102
+ <label>Cron Hour</label>
103
+ <frontend_type>select</frontend_type>
104
+ <source_model>magebackupfree/config_cron_hour</source_model>
105
+ <sort_order>3</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </hours>
110
+
111
+ <multi_config>
112
+ <label>Multiple Crons and Configurations</label>
113
+ <frontend_type>label</frontend_type>
114
+ <comment>
115
+ <![CDATA[
116
+ This feature is available in PRO version. Find more PRO features at
117
+ <a href="http://magebackup.com">http://magebackup.com</a>
118
+ ]]>
119
+ </comment>
120
+ <sort_order>4</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </multi_config>
125
+ </fields>
126
+ </cron>
127
+
128
+ <file translate="label">
129
+ <label>Files Configuration</label>
130
+ <frontend_type>text</frontend_type>
131
+ <sort_order>3</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>0</show_in_store>
135
+
136
+ <fields>
137
+ <excluded_files translate="label">
138
+ <label>Excluded Folders</label>
139
+ <frontend_type>multiselect</frontend_type>
140
+ <source_model>magebackupfree/config_file</source_model>
141
+ <comment>
142
+ <![CDATA[
143
+ More options for excluding files and subfolders are available in PRO version. Find more PRO features at
144
+ <a href="http://magebackup.com">http://magebackup.com</a>
145
+ ]]>
146
+ </comment>
147
+ <sort_order>1</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </excluded_files>
152
+ </fields>
153
+ </file>
154
+
155
+ <database translate="label">
156
+ <label>Databases Configuration</label>
157
+ <frontend_type>text</frontend_type>
158
+ <sort_order>4</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>0</show_in_store>
162
+
163
+ <fields>
164
+ <excluded_tables translate="label">
165
+ <label>Exclude Tables and Include Extra Databases</label>
166
+ <frontend_type>label</frontend_type>
167
+ <comment>
168
+ <![CDATA[
169
+ This feature is available in PRO version. Find more PRO features at
170
+ <a href="http://magebackup.com">http://magebackup.com</a>
171
+ ]]>
172
+ </comment>
173
+ <sort_order>1</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ </excluded_tables>
178
+ </fields>
179
+ </database>
180
+
181
+ <cloud translate="label">
182
+ <label>Cloud Configuration</label>
183
+ <frontend_type>text</frontend_type>
184
+ <sort_order>5</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ <show_in_store>0</show_in_store>
188
+
189
+ <fields>
190
+ <cloud_engine translate="label">
191
+ <label>Upload to Cloud</label>
192
+ <frontend_type>label</frontend_type>
193
+ <comment>
194
+ <![CDATA[
195
+ This feature is available in PRO version. Find more PRO features at
196
+ <a href="http://magebackup.com">http://magebackup.com</a>
197
+ ]]>
198
+ </comment>
199
+ <sort_order>1</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>1</show_in_store>
203
+ </cloud_engine>
204
+ </fields>
205
+ </cloud>
206
+ </groups>
207
+ </magebackupfree>
208
+ </sections>
209
+ </config>
app/code/community/MageBackup/MageBackupFree/sql/magebackupfree_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
4
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5
+ */
6
+
7
+ /**
8
+ * Mage Backup Free install
9
+ *
10
+ * @category MageBackup
11
+ * @package MageBackup_MageBackupFree
12
+ * @author MageBackup (admin@magebackup.com)
13
+ */
14
+
15
+ /** @var $installer Mage_Customer_Model_Entity_Setup */
16
+ $installer = $this;
17
+
18
+ $installer->startSetup();
19
+
20
+ $installer->run("
21
+ -- DROP TABLE IF EXISTS {$installer->getTable('magebackupfree_backups')};
22
+ CREATE TABLE {$installer->getTable('magebackupfree_backups')} (
23
+ `backup_id` int(11) unsigned NOT NULL auto_increment,
24
+ `name` varchar(255) NOT NULL DEFAULT '',
25
+ `description` text NOT NULL DEFAULT '',
26
+ `file_name` varchar(255) NOT NULL DEFAULT '',
27
+ `start_time` datetime NULL,
28
+ `end_time` datetime NULL,
29
+ `logs` text NOT NULL DEFAULT '',
30
+
31
+ PRIMARY KEY (`backup_id`)
32
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
33
+ ");
34
+
35
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/magebackupfree.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ /**
4
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+
9
+ <layout version="1.0.0">
10
+ <adminhtml_magebackupfree_backup_index>
11
+ <reference name="content">
12
+ <block type="magebackupfree/adminhtml_backup" name="backup" />
13
+ </reference>
14
+ </adminhtml_magebackupfree_backup_index>
15
+ </layout>
app/etc/modules/MageBackup_MageBackupFree.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ /**
4
+ * @copyright Copyright (c) 2013 MageBackup (http://www.magebackup.com). All rights reserved.
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+ -->
8
+
9
+ <config>
10
+ <modules>
11
+ <MageBackup_MageBackupFree>
12
+ <active>true</active>
13
+ <codePool>community</codePool>
14
+ </MageBackup_MageBackupFree>
15
+ </modules>
16
+ </config>
app/locale/en_US/MageBackup_MageBackupFree.csv ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ID, ID
2
+ Name, Name
3
+ Status, Status
4
+ Action, Action
5
+ Edit, Edit
6
+ Delete, Delete
7
+ Are you sure?, Are you sure?
8
+ Change status, Change status
9
+ Save and Continue Edit, Save and Continue Edit
10
+ General, General
11
+ General Information, General Information
12
+ Description, Description
13
+ Enabled, Enabled
14
+ Disabled, Disabled
15
+
16
+ Manage Backups, Manage Backups
17
+ Add New Backup, Add New Backup
18
+ Save Backup, Save Backup
19
+ Delete Backup, Delete Backup
20
+ Edit Backup '%s', Edit Backup '%s'
21
+ Information, Backup Information
22
+ Backup Name, Backup Name
23
+ Backup Manager, Backup Manager
24
+ Backup Description, Backup Description
25
+ Backup does not exist, Backup does not exist
26
+ Backup was successfully saved, Backup was successfully saved
27
+ Backup was successfully deleted, Backup was successfully deleted
28
+ Please select Backup(s), Please select Backup(s)
29
+ Total of %d Backup(s) were successfully deleted, Total of %d Backup(s) were successfully deleted
30
+ Total of %d Backup(s) were successfully updated, Total of %d Backup(s) were successfully updated
31
+
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MageBackup_MageBackupFree</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL V3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Free Edition of MageBackup</summary>
10
+ <description>Free Edition of MageBackup</description>
11
+ <notes>Version 1.0.0</notes>
12
+ <authors><author><name>MageBackup</name><user>auto-converted</user><email>admin@magebackup.com</email></author></authors>
13
+ <date>2013-09-17</date>
14
+ <time>09:23:27</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="MageBackup_MageBackupFree.xml" hash="9b1789c611a9743bbf725e666d0412ec"/></dir></target><target name="magecommunity"><dir name="MageBackup"><dir name="MageBackupFree"><dir name="Block"><dir name="Adminhtml"><dir name="Backup"><dir name="Edit"><dir name="Tab"><file name="General.php" hash="9bc9d8dec92385678334b2e8706e4e65"/></dir><file name="Form.php" hash="a661f74e34974fe2761348e0d6b1afb8"/><file name="Tabs.php" hash="0617f27d4eb62a28a9055ec5289bf112"/></dir><dir name="Renderer"><file name="Download.php" hash="8743ed8d82b186e10c01d2e67cedbb2a"/><file name="Duration.php" hash="2ca43033a82f76810b83b423a2b7a05c"/><file name="Size.php" hash="e58ceed30def39daa8b6a0d2b725814a"/></dir><file name="Edit.php" hash="dd3b84acb742c2d288a2ab03f4aaf231"/><file name="Grid.php" hash="f5ced4e7f2439e79f7d3edc2a1b1df60"/></dir><file name="Backup.php" hash="4906de5fbbbcbe42c0e894d8f1c6dd29"/></dir><file name="Magebackupfree.php" hash="bca539013fb74f3525c927b6626e1f1c"/></dir><dir name="Helper"><file name="Data.php" hash="de1779d993db2cecdfab8860190f6f6a"/></dir><dir name="Model"><dir name="Backup"><file name="Backup.php" hash="d2031481cc901ea141b621e2bff5dda2"/><file name="Db.php" hash="79d819d238c05a4e1882d62caacb3fea"/><file name="File.php" hash="b46fb7049ace1f3a263529feae522e71"/></dir><dir name="Config"><dir name="Cron"><file name="Frequency.php" hash="6e24a4793ada7d22c19080a62911f9c8"/><file name="Hour.php" hash="fc2fd25f3091a0d51becb11427c34855"/></dir><file name="Backuptype.php" hash="5ad6bcda4d5fae0e429e7f7155eb70a0"/><file name="File.php" hash="b0030ec5911f3588d58b288a9f78338e"/></dir><dir name="Mysql4"><dir name="Backup"><file name="Collection.php" hash="3b93ee16ecb244e7e0d50fbe19481ae0"/></dir><file name="Backup.php" hash="d9ad5a01f68da24bd58a53d6d299e366"/></dir><file name="Backup.php" hash="959f09f99d6e31eef983f24a97f625a5"/><file name="Config.php" hash="e608f8421b5c5e1367b243aa9fb73d4f"/><file name="Status.php" hash="8d6ab9f92754bef1d25a072b5aeb5687"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Magebackupfree"><file name="BackupController.php" hash="46698dc9c67c1905e43c6b07f9776fc7"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5f795565ab9d4192dfcb59c507b0921c"/><file name="config.xml" hash="14382c28da2990fdd0c93d155181dde7"/><file name="system.xml" hash="faba0655f1be7bf49782c51411f0bee5"/></dir><dir name="sql"><dir name="magebackupfree_setup"><file name="mysql4-install-1.0.0.php" hash="a34faee664b98b933f60c4e7f07488bd"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="magebackupfree.xml" hash="969b28355c33bb692fae701f08618894"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="MageBackup_MageBackupFree.csv" hash="b3bf6b19d43bc3e0088a4a793c671b80"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>