Centerax_AutomaticBackup - Version 1.0.0

Version Notes

1.0.0
-----------------------
First release.

Download this release

Release Info

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


Version 1.0.0

app/code/community/Centerax/AutomaticBackup/Helper/Data.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Cron model
5
+ *
6
+ * @category Centerax
7
+ * @package Centerax_AutomaticBackup
8
+ * @author Centerax <cx@pablobenitez.com>
9
+ */
10
+
11
+ class Centerax_AutomaticBackup_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+
14
+ }
app/code/community/Centerax/AutomaticBackup/Model/Cron.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Cron model
5
+ *
6
+ * @category Centerax
7
+ * @package Centerax_AutomaticBackup
8
+ * @author Centerax <cx@pablobenitez.com>
9
+ */
10
+
11
+ class Centerax_AutomaticBackup_Model_Cron
12
+ {
13
+ public function backup($cron = null)
14
+ {
15
+ try {
16
+
17
+ $backupDb = Mage::getModel('backup/db');
18
+ $backup = Mage::getModel('backup/backup')
19
+ ->setTime(time())
20
+ ->setType('db')
21
+ ->setPath(Mage::getBaseDir("var") . DS . "backups");
22
+
23
+ $backupDb->createBackup($backup);
24
+
25
+ return Mage::helper('autobackup')->__('Backup successfully created');
26
+
27
+ } catch (Exception $e) {
28
+ Mage::logException($e);
29
+ }
30
+
31
+ return $this;
32
+ }
33
+ }
app/code/community/Centerax/AutomaticBackup/etc/config.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Cron model
5
+ *
6
+ * @category Centerax
7
+ * @package Centerax_AutomaticBackup
8
+ * @author Centerax <cx@pablobenitez.com>
9
+ */
10
+ -->
11
+ <config>
12
+ <modules>
13
+ <Centerax_AutomaticBackup>
14
+ <version>1.0.0</version>
15
+ </Centerax_AutomaticBackup>
16
+ </modules>
17
+ <global>
18
+ <models>
19
+ <autobackup>
20
+ <class>Centerax_AutomaticBackup_Model</class>
21
+ </autobackup>
22
+ </models>
23
+ <helpers>
24
+ <autobackup>
25
+ <class>Centerax_AutomaticBackup_Helper</class>
26
+ </autobackup>
27
+ </helpers>
28
+ </global>
29
+ <crontab>
30
+ <jobs>
31
+ <cx_automatic_db_backup>
32
+ <schedule>
33
+ <!-- Backup DB every day at 1am -->
34
+ <cron_expr>0 1 * * *</cron_expr>
35
+ </schedule>
36
+ <run>
37
+ <model>autobackup/cron::backup</model>
38
+ </run>
39
+ </cx_automatic_db_backup>
40
+ </jobs>
41
+ </crontab>
42
+ </config>
app/etc/modules/Centerax_AutomaticBackup.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Centerax_AutomaticBackup>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Centerax_AutomaticBackup>
8
+ </modules>
9
+ </config>
centerax_db_backup.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * CLI backuper
5
+ *
6
+ * @category Centerax
7
+ * @package Centerax_AutomaticBackup
8
+ * @author Centerax <cx@pablobenitez.com>
9
+ */
10
+
11
+ require 'app/Mage.php';
12
+
13
+ if (!Mage::isInstalled()) {
14
+ echo "Application is not installed yet, please complete install wizard first.";
15
+ die;
16
+ }
17
+
18
+ Mage::app();
19
+
20
+ try {
21
+ Mage::getModel('autobackup/cron')->backup();
22
+ } catch (Exception $e) {
23
+ Mage::printException($e);
24
+ }
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Centerax_AutomaticBackup</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Automatic DB Backups</summary>
10
+ <description>Automatic DB Backups</description>
11
+ <notes>1.0.0
12
+ -----------------------
13
+ First release.</notes>
14
+ <authors><author><name>Pablo S. Benitez</name><user>auto-converted</user><email>pablos.benitez@gmail.com</email></author></authors>
15
+ <date>2010-02-11</date>
16
+ <time>21:12:58</time>
17
+ <contents><target name="magecommunity"><dir name="Centerax"><dir name="AutomaticBackup"><dir name="etc"><file name="config.xml" hash="e6ead3addc81ac6bee3e948b027de8ad"/></dir><dir name="Helper"><file name="Data.php" hash="26a37821747121447823125b98b6a9f5"/></dir><dir name="Model"><file name="Cron.php" hash="fa2c18c2499751722e2e6c3944187440"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Centerax_AutomaticBackup.xml" hash="b6f0cae5be28faf2c5a17f686a509ec6"/></dir></target><target name="mage"><dir name="."><file name="centerax_db_backup.php" hash="472bf022f5c455f2e11dae2bc38ed8b8"/></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies/>
20
+ </package>