BackWPup – WordPress Backup Plugin - Version 0.5.0

Version Description

Download this release

Release Info

Developer danielhuesken
Plugin Icon 128x128 BackWPup – WordPress Backup Plugin
Version 0.5.0
Comparing to
See all releases

Version 0.5.0

app/css/options.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .column-id {
2
+ width:25px;
3
+ }
4
+ .column-logdate, .column-last, .column-next {
5
+ width:100px;
6
+ }
7
+ .column-type {
8
+ width:100px;
9
+ }
10
+ .column-size {
11
+ width:75px;
12
+ }
app/dojob/MySQLDBExport.class.php ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // **********************************************
4
+ // *** MySQLDBExport.class.php v2.0.1 ***
5
+ // **********************************************
6
+
7
+ // -----------------------------------------------------------------------
8
+ /*
9
+ Copyright:
10
+ ==============
11
+ Dieses Script wurde urspr�nglich von Dennis Riehle geschrieben - Sie d�rfen
12
+ das Script frei verwenden, bearbeiten und weitergeben, solange dieser Copyright
13
+ Hinweis nicht entfernt wird.
14
+ Es erfolgt keinerlei Haftung f�r eventuell durch dieses Script entstandene
15
+ Sch�den - die Benutzung erfolgt vollst�ndig auf eigene Gefahr.
16
+
17
+ Beschreibung:
18
+ ==============
19
+ Mit dieser Klasse l�sst sich ein Dump (Export) einer MySQL Datenbank erzeugen,
20
+ was z.B. f�r ein Backupsystem verwendet werden kann.
21
+
22
+ Benutzung:
23
+ ==============
24
+ a) Bei einer bereits vorhandenen MySQL Verbindung:
25
+
26
+ $export = new MySQLDBExport(); // Instanz erzeugen
27
+ $export->set_db("Datenbank"); // Datenbank ausw�hlen
28
+ $dump = $export->make_dump(); // Dump erstellen
29
+
30
+ b) Wenn erst noch eine Verbindung hergestellt werden muss:
31
+
32
+ $export = new MySQLDBExport("Host", "User", "Passwort");
33
+ // Instanz erzeugen und gleichzeitig
34
+ // eine MySQL-Verbindung erstellen
35
+ $export->set_db("Datenbank"); // Datenbank ausw�hlen
36
+ $dump = $export->make_dump(); // Dump erstellen
37
+
38
+ Weitere Optionen:
39
+ -----------------
40
+ Standardm��ig wird innerhalb des Dumps ein Unix Zeilenumbruch verwendet, m�chte
41
+ man dies �ndern, so ist vor dem Aufrufen von make_dump() folgendes zu setzen:
42
+ $export->set_newline("\r\n");
43
+
44
+ MySQLDBExport erzeugt normalerweise immer einen Dump f�r alle sich innerhalb einer
45
+ Datenbank befindlichen Tabellen, m�chte man nur eine einzelne oder nur bestimmte
46
+ Tabellen exportieren, so l�sst sich make_dump() ein String oder ein Array der
47
+ zu exportierenden Tabellen �bergeben:
48
+ $export->make_dump("Tabellenname");
49
+ Oder:
50
+ $export->make_dump(array("Tabelle1", "Tabelle2"));
51
+
52
+ Error Handling - beim Auftreten eines Fehlers liefern die Funktionen false
53
+ zur�ck und schreiben eine Nachricht in die error Variable, die sich wie folgt
54
+ abfragen l�sst:
55
+ echo $export->get_error();
56
+
57
+ Changelog
58
+ ==============
59
+ Von Version 2.0.1 auf Version 2.0.2 wurden folgende �nderungen vorgenommen:
60
+ - in Zeile 272 und 273 (bzw. 284 und 285 in Version 2.0.1) fehlte ein abschlie�endes
61
+ Semikolon (Syntaxfehler)
62
+ - in get_tables() trat eine Verwechslung von Variablen auf
63
+ */
64
+
65
+ class MySQLDBExport {
66
+
67
+ var $con = false;
68
+ var $db = "";
69
+ var $newline = "\n";
70
+ var $error = "";
71
+
72
+ // -----------------------------------------------------------------------
73
+ function MySQLDBExport($host = NULL, $user = NULL, $pass = NULL) {
74
+ // Initialisierung - sofern gew�nscht, MySQL Verbindung aufbauen
75
+ if($host != NULL AND $user != NULL) {
76
+ // Verbindung herstellen
77
+ $con = @mysql_connect($host, $user, $pass);
78
+ // Wenn fehlgeschlagen, Error melden und abbrechen
79
+ if(!$con) {
80
+ $this->error = "Fehler beim Herstellen der MySQL Verbindung - " . mysql_error();
81
+ return false;
82
+ }
83
+ // Sonst die Verbindung in $con speichern
84
+ $this->con = $con;
85
+ return true;
86
+ }
87
+ }
88
+
89
+ // -----------------------------------------------------------------------
90
+ function get_error() {
91
+ // Ausgabe der letzten Error-Meldung
92
+ return $this->error;
93
+ }
94
+
95
+ // -----------------------------------------------------------------------
96
+ function set_newline($newline) {
97
+ // Setzen von $newline
98
+ $this->newline = $newline;
99
+ return true;
100
+ }
101
+
102
+ // -----------------------------------------------------------------------
103
+ function set_db($db) {
104
+ // Wenn vorher bereits ein Fehler aufgetreten ist, abbrechen
105
+ if(!empty($this->error)) {
106
+ return false;
107
+ }
108
+ // Sonst versuchen, die MySQL Datenbank auszuw�hlen
109
+ $try = @mysql_select_db($db);
110
+ // Im Fehlerfall einen Error melden und abbrechen
111
+ if(!$try) {
112
+ $this->error = mysql_error();
113
+ return false;
114
+ }
115
+ // Sonst den Datenbanknamen abspeichern in $db
116
+ $this->db = $db;
117
+ return true;
118
+ }
119
+
120
+ // -----------------------------------------------------------------------
121
+ function escape_table_name($table) {
122
+ // Escapen von Tabellen oder Datenbanknamen gem��
123
+ // <http://dev.mysql.com/doc/refman/5.0/en/legal-names.html>
124
+ $table = str_replace("�", "��", $table);
125
+ return $table;
126
+ }
127
+
128
+ // -----------------------------------------------------------------------
129
+ function get_tables() {
130
+ // Liste �ber alle existierenden Tabellen in der Datenbank besorgen
131
+ $result = mysql_query('SHOW TABLES FROM `' . $this->escape_table_name($this->db) . '`;');
132
+ if(!$result) {
133
+ $this->error = mysql_error();
134
+ return false;
135
+ }
136
+ // Array f�r Liste initialisieren
137
+ $tables = array();
138
+ // MySQL Ergebnisliste durchgehen und jede Tabelle in $tables hinzuf�gen
139
+ while (list($current) = mysql_fetch_row($result)) {
140
+ $tables[] = $current;
141
+ }
142
+ // Und Tabellenarray zur�ckgeben
143
+ return $tables;
144
+ }
145
+
146
+ // -----------------------------------------------------------------------
147
+ function export_table_structure($table, $drop_if_exists = true) {
148
+ // Ausgabestring initialisieren
149
+ $sqlstring = "";
150
+ // Wenn DROP TABLE mit ausgegeben werden soll, dieses in den
151
+ // Ausgabestring schreiben
152
+ if($drop_if_exists) {
153
+ $sqlstring .= "DROP TABLE IF EXISTS `" . $this->escape_table_name($table)
154
+ . "`;" . $this->newline;
155
+ }
156
+ // Die CREATE TABLE Syntax per SQL Befehl besorgen oder Fehler ausgeben
157
+ $return = mysql_query("SHOW CREATE TABLE `" . $this->escape_table_name($table) . "`");
158
+ if(!$return) {
159
+ $this->error = mysql_error();
160
+ return false;
161
+ }
162
+ // Auslesen, ...
163
+ $data = mysql_fetch_assoc($return);
164
+ // ...in Ausgabestring schreiben ...
165
+ $sqlstring .= str_replace("\n", $this->newline, $data['Create Table']) . ";"
166
+ . $this->newline
167
+ . $this->newline;
168
+ // ...und diesen zur�ck geben
169
+ return $sqlstring;
170
+ }
171
+
172
+ // -----------------------------------------------------------------------
173
+ function export_table_data($table, $leave_out_fields = false) {
174
+ // Alle Felder aus der Tabelle auslesen, bei Fehler abbrechen
175
+ $sql = "SELECT * FROM `" . $this->escape_table_name($table) . "`";
176
+ $return = mysql_query($sql);
177
+ if(!$return) {
178
+ $this->error = mysql_error();
179
+ return false;
180
+ }
181
+ // Ausgabestring initialisieren
182
+ $sqlstring = "";
183
+ // Alle Ergebniszeilen abarbeiten...
184
+ while($data = mysql_fetch_assoc($return))
185
+ {
186
+ // Arrays zum Sammeln der Key und der Value Werte initialisieren
187
+ $keys = array();
188
+ $values = array();
189
+ foreach($data as $key => $value) {
190
+ // Wenn dieses Feld ausgelassen werden soll, fahre mit
191
+ // n�chster Schleife fort
192
+ if(is_array($leave_out_fields) AND in_array($key, $leave_out_fields)) {
193
+ continue;
194
+ }
195
+ // Sonst f�ge den aktuellen Key in das "Keysammelarray" hinzu
196
+ $keys[] = "`" . $this->escape_table_name($key) . "`";
197
+ // Wenn das Value NULL ist, in den String NULL umwandeln
198
+ if($value === NULL) {
199
+ $value = "NULL";
200
+ }
201
+ // Wenn das Value leer oder False ist, ein "" als Value nehmen
202
+ elseif($value === "" OR $value === false) {
203
+ $value = '""';
204
+ }
205
+ // Wenn das Value nicht numerisch ist, es mit mysql_real_escape_string()
206
+ // escapen und zwischen " setzen
207
+ elseif(!is_numeric($value)) {
208
+ $value = mysql_real_escape_string($value);
209
+ $value = "\"$value\"";
210
+ }
211
+ // In allen anderen F�llen ist das Value numerisch, kann belassen
212
+ // werden wie es ist und direkt in das "Valuesammelarray" hinzugef�gt
213
+ // werden
214
+ $values[] = $value;
215
+ }
216
+ // Aus den Sammelarrays jetzt einen INSERT INTO SQL-Befehl erstellen und diesen
217
+ // an die Ausgabe anh�ngen
218
+ $sqlstring .= "INSERT INTO `" . $this->escape_table_name($table) . "` ( "
219
+ . implode(", ",$keys)
220
+ . " ){$this->newline}\tVALUES ( "
221
+ . implode(", ",$values)
222
+ . " );" . $this->newline;
223
+ }
224
+ // Ausgabestring zur�ckliefern
225
+ return $sqlstring;
226
+ }
227
+
228
+ // -----------------------------------------------------------------------
229
+ function make_dump($tables_input = NULL, $drop_if_exists = false, $leave_out_fields = false ) {
230
+ // Ausgabestring f�r den Datenbank Dump initialisieren mit einer ersten Kommentarzeile
231
+ $exportstring = "-- ------------------------------------------" . $this->newline;
232
+ // Array f�r alle zu exportierenden Tabellen initialisieren
233
+ // Jeder Wert in diesem Array wird sp�ter als Tabellennamen aufgefasst und es wird
234
+ // versucht einen MySQL DUMP dieser Tabelle zu erstellen
235
+ $tables = array();
236
+ // Wenn f�r $tables_input ein Array �bergeben wurde die Kopfzeile f�r einen indivi-
237
+ // duellen Datenbankexport erzeugen und alle Eintr�ge aus dem Array in das Tabellen-
238
+ // array kopieren, sodass nur die im Array �bergebenen Tabellen exportiert werden
239
+ if(is_array($tables_input)) {
240
+ $tables = $tables_input;
241
+ $exportstring .= "-- INDIVIDUAL DATABASE EXPORT --" . $this->newline;
242
+ }
243
+ // Ansonsten, wenn $tables_input ein einfacher String ist, diesen als eine Tabelle
244
+ // auffassen und nur diese eine Tabelle exportieren, als Single Database Export
245
+ elseif(!is_array($tables_input) AND $tables_input != NULL) {
246
+ $tables[0] = $tables_input;
247
+ $exportstring .= "-- SINGLE DATABASE EXPORT --" . $this->newline;
248
+ }
249
+ // Wurde der Parameter $tables_input gar nicht mit �bergeben oder ist dieser False, so
250
+ // wird per $this->get_tables() herausgefunden welche Tabellen alle existieren und es werden
251
+ // alle Tabellen exportiert => Full Database Export
252
+ else {
253
+ $tables = $this->get_tables();
254
+ // Wenn get_tables() fehlschl�gt, abbrechen
255
+ if($tables === false) return false;
256
+ $exportstring .= "-- FULL DATABASE EXPORT --".$this->newline;
257
+ }
258
+ // In den Ausgabestring die Kopfzeilen schreiben, welche den Namen der Datenbank in
259
+ // der die Tabellen liegen, das Datum zu dem der Dump erzeugt wurde sowie den Typ des
260
+ // Exports (s.o.) enth�lt
261
+ $exportstring .= "-- ------------------------------------------" . $this->newline
262
+ . "-- Database: " . $this->db.str_repeat(" ",30 - strlen($this->db)) . "--"
263
+ . $this->newline
264
+ . "-- Build: " . date("d.m.Y, H:i")." --" . $this->newline
265
+ . "-- Script by Dennis Riehle --" . $this->newline
266
+ . "-- http://tutorial.riehle-web.com/scripts/ --" . $this->newline
267
+ . "-- ------------------------------------------" . $this->newline
268
+ . $this->newline;
269
+ // Gehe alle Tabellen in $tables durch und exportiere nacheinander von jeder Tabelle
270
+ // die Struktur, sowie die Daten.
271
+ foreach($tables as $table) {
272
+ $structure = $this->export_table_structure($table, $drop_if_exists);
273
+ $data = $this->export_table_data($table, $leave_out_fields);
274
+ // Wenn export_table_structure() oder export_table_data() fehlschl�gt, abbrechen
275
+ if($structure === false OR $data === false) return false;
276
+ $exportstring .= "-- Table: $table" . $this->newline
277
+ . "-- ------------------------------------------" . $this->newline
278
+ . $structure
279
+ . $data
280
+ . $this->newline;
281
+ }
282
+ // F�ge dem Exportstring noch ein Ende Kennzeichen hinzu...
283
+ $exportstring .= "-- ------------------------------------------" . $this->newline
284
+ . "-- Export End --" . $this->newline
285
+ . "-- ------------------------------------------" . $this->newline;
286
+ // ...und liefere den kompletten String zur�ck.
287
+ return $exportstring;
288
+ }
289
+ }
290
+ // -----------------------------------------------------------------------
291
+ /*
292
+ ENDE
293
+ */
294
+
295
+ ?>
app/dojob/after.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?PHP
2
+ if (is_file($cfg['tempdir'].'/'.DB_NAME.'.sql') ) {
3
+ unlink($cfg['tempdir'].'/'.DB_NAME.'.sql');
4
+ }
5
+
6
+ $jobs[$jobid]['lastrun']=$jobs[$jobid]['starttime'];
7
+ $jobs[$jobid]['stoptime']=time();
8
+ $jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
9
+ update_option('backwpup_jobs',$jobs); //Save Settings
10
+
11
+ $logs=get_option('backwpup_log');
12
+ $time=time();
13
+ $logs[$time]['jobid']=$jobid;
14
+ $logs[$time]['error']=$joberror;
15
+ $logs[$time]['logfile']=$logfile;
16
+ $logs[$time]['type']=$jobs[$jobid]['type'];
17
+ $logs[$time]['worktime']=$jobs[$jobid]['stoptime']-$jobs[$jobid]['starttime'];
18
+ if (is_file($backupfile))
19
+ $logs[$time]['backupfile']=$backupfile;
20
+ update_option('backwpup_log',$logs);
21
+ ?>
app/dojob/bevore.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ set_time_limit(300);
3
+
4
+ $cfg=get_option('backwpup');
5
+ $jobs=get_option('backwpup_jobs');
6
+ $logfilename='/backwpup_'.$jobid.'_'.date('Y-m-d_H-i-s').'.log';
7
+ $logfile=$cfg['tempdir'].$logfilename;
8
+ $backupfilename='/backwpup_'.$jobid.'_'.date('Y-m-d_H-i-s').'.zip';
9
+ $backupfile=$cfg['tempdir'].$backupfilename;
10
+ $joberror=false;
11
+
12
+ //Look for and Crate Temp dir
13
+ if (!is_dir($cfg['tempdir'].'/')) {
14
+ if (!mkdir($cfg['tempdir'].'/')) {
15
+ return false;
16
+ }
17
+ }
18
+ if (!is_file($cfg['tempdir'].'/.htaccess')) {
19
+ if($file = @fopen($cfg['tempdir'].'/.htaccess', 'w')) {
20
+ fwrite($file, "Order allow,deny\ndeny from all");
21
+ fclose($file);
22
+ }
23
+ }
24
+ if (!is_file($cfg['tempdir'].'/index.html')) {
25
+ if($file = @fopen($cfg['tempdir'].'/index.html', 'w')) {
26
+ fwrite($file,"\n");
27
+ fclose($file);
28
+ }
29
+ }
30
+
31
+ //Set start vars
32
+ $jobs[$jobid]['starttime']=time();
33
+ $jobs[$jobid]['stoptime']='';
34
+ $jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
35
+ update_option('backwpup_jobs',$jobs); //Save Settings
36
+ ?>
app/dojob/db.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?PHP
2
+ BackWPupFunctions::joblog($logfile,__('Run Database Backup...','backwpup'));
3
+
4
+ //Tables to backup
5
+ $tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
6
+
7
+ if (is_array($jobs[$jobid]['dbexclude'])) {
8
+ foreach($tables as $tablekey => $tablevalue) {
9
+ if (in_array($tablevalue,$jobs[$jobid]['dbexclude']))
10
+ unset($tables[$tablekey]);
11
+ }
12
+ }
13
+
14
+ if (sizeof($tables)>0) {
15
+ BackWPupFunctions::joblog($logfile,__('Tables to Backup: ','backwpup').print_r($tables,true));
16
+
17
+ require_once('MySQLDBExport.class.php');
18
+ $export = new MySQLDBExport(DB_HOST, DB_USER, DB_PASSWORD);
19
+ $export->set_db(DB_NAME);
20
+
21
+ $file = @fopen($cfg['tempdir'].'/'.DB_NAME.'.sql', 'w');
22
+ fwrite($file, $export->make_dump($tables));
23
+ fclose($file);
24
+
25
+
26
+ if ($error=$export->get_error()) {
27
+ BackWPupFunctions::joblog($logfile,__('ERROR:','backwpup').' '.$error);
28
+ $joberror=true;
29
+ }
30
+ } else {
31
+ BackWPupFunctions::joblog($logfile,__('ERROR: No Tables to Backup','backwpup'));
32
+ $joberror=true;
33
+ }
34
+
35
+
36
+ BackWPupFunctions::joblog($logfile,__('Database backup done!','backwpup'));
37
+
38
+ if ($jobs[$jobid]['type']=='DB' and is_file($cfg['tempdir'].'/'.DB_NAME.'.sql')) {
39
+ BackWPupFunctions::joblog($logfile,__('Create Zip file from dump...','backwpup'));
40
+ require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
41
+ $zipbackupfile = new PclZip($backupfile);
42
+ if (0==$zipbackupfile -> create($cfg['tempdir'].'/'.DB_NAME.'.sql',PCLZIP_OPT_REMOVE_PATH,$cfg['tempdir'].'/')) {
43
+ BackWPupFunctions::joblog($logfile,__('ERROR: Database Zip file create:','backwpup').' '.$zipbackupfile->errorInfo(true));
44
+ $joberror=true;
45
+ }
46
+ BackWPupFunctions::joblog($logfile,__('Zip file created...','backwpup'));
47
+ }
48
+ //clean vars
49
+ unset($tables);
50
+ unset($zipbackupfile);
51
+ ?>
app/dojob/destination-dir.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ BackWPupFunctions::joblog($logfile,__('Move Backup Zip file to Backup dir...','backwpup'));
3
+
4
+ if (!is_file($jobs[$jobid]['backupdir'].'/.htaccess')) {
5
+ if($file = fopen($jobs[$jobid]['backupdir'].'/.htaccess', 'w')) {
6
+ fwrite($file, "Order allow,deny\ndeny from all");
7
+ fclose($file);
8
+ }
9
+ }
10
+ if (!is_file($jobs[$jobid]['backupdir'].'/index.html')) {
11
+ if($file = fopen($jobs[$jobid]['backupdir'].'/index.html', 'w')) {
12
+ fwrite($file,"\n");
13
+ fclose($file);
14
+ }
15
+ }
16
+
17
+ if ($jobs[$jobid]['backupdir']!=$cfg['tempdir']) {
18
+ if (!rename($backupfile,$jobs[$jobid]['backupdir'].$backupfilename)) {
19
+ BackWPupFunctions::joblog($logfile,__('ERROR: Backup Zip file can not moved to Backup dir!!!','backwpup'));
20
+ $joberror=true;
21
+ } else {
22
+ $backupfile=$jobs[$jobid]['backupdir'].$backupfilename;
23
+ }
24
+ if (!rename($logfile,$jobs[$jobid]['backupdir'].$logfilename)) {
25
+ BackWPupFunctions::joblog($logfile,__('ERROR: Log file file can not moved to Backup dir!!!','backwpup'));
26
+ $joberror=true;
27
+ } else {
28
+ $logfile=$jobs[$jobid]['backupdir'].$logfilename;
29
+ }
30
+ }
31
+
32
+ if (is_file($backupfile)) {
33
+ BackWPupFunctions::joblog($logfile,__('Backup zip file saved to:','backwpup').' '.$backupfile);
34
+ BackWPupFunctions::joblog($logfile,__('Backup zip filesize is','backwpup').' '.BackWPupFunctions::formatBytes(filesize($backupfile)));
35
+ }
36
+ BackWPupFunctions::joblog($logfile,__('Log file saved to:','backwpup').' '.$logfile);
37
+
38
+ if (!empty($jobs[$jobid]['maxbackups'])) {
39
+ BackWPupFunctions::joblog($logfile,__('Delete old backup files...','backwpup'));
40
+ $logs=get_option('backwpup_log');
41
+ if (is_array($logs)) {
42
+ unset($logkeys);
43
+ foreach ($logs as $timestamp => $logdata) {
44
+ if ($logdata['jobid']==$jobid)
45
+ $logkeys[]=$timestamp;
46
+ }
47
+ if (is_array($logkeys)) {
48
+ rsort($logkeys,SORT_NUMERIC);
49
+ $counter=0;$countdelbackups=0;$countdellogs=0;
50
+ for ($i=0;$i<sizeof($logkeys);$i++) {
51
+ if (!empty($logs[$logkeys[$i]]['backupfile']))
52
+ $counter++;
53
+ if ($counter>=$jobs[$jobid]['maxbackups']) {
54
+ if (is_file($logs[$logkeys[$i]]['backupfile'])) {
55
+ unlink($logs[$logkeys[$i]]['backupfile']);
56
+ $countdelbackups++;
57
+ }
58
+ if (is_file($logs[$logkeys[$i]]['logfile'])) {
59
+ unlink($logs[$logkeys[$i]]['logfile']);
60
+ $countdellogs++;
61
+ }
62
+ unset($logs[$logkeys[$i]]);
63
+ }
64
+ }
65
+ }
66
+ }
67
+ update_option('backwpup_log',$logs);
68
+ BackWPupFunctions::joblog($logfile,$countdelbackups.' '.__('Old backup files deleted!!!','backwpup'));
69
+ BackWPupFunctions::joblog($logfile,$countdellogs.' '.__('Old Log files deleted!!!','backwpup'));
70
+ //clean vars
71
+ unset($logkeys);
72
+ unset($logs);
73
+ }
74
+
75
+ ?>
app/dojob/destination-ftp.php ADDED
File without changes
app/dojob/destination-mail.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!empty($jobs[$jobid]['mailaddress'])) {
3
+ BackWPupFunctions::joblog($logfile,__('Sendig mail...','backwpup'));
4
+ if (is_file($backupfile)) {
5
+ if (filesize($backupfile)<5242880) {
6
+ $mailfiles=$backupfile;
7
+ } else {
8
+ BackWPupFunctions::joblog($logfile,__('WARNING: Backup Archive too big for sendig by mail','backwpup'));
9
+ $mailfiles='';
10
+ }
11
+ }
12
+ $logmassage=file($logfile);
13
+ foreach ($logmassage as $massageline) {
14
+ $mailmessage.=$massageline;
15
+ }
16
+ if (wp_mail($jobs[$jobid]['mailaddress'],__('BackWPup Job:','backwpup').' '.$jobs[$jobid]['name'],$mailmessage,'',$mailfiles)) {
17
+ BackWPupFunctions::joblog($logfile,__('Mail send!!!','backwpup'));
18
+ } else {
19
+ BackWPupFunctions::joblog($logfile,__('ERROR: can not send mail!!!','backwpup'));
20
+ $joberror=true;
21
+ }
22
+ }
23
+ //clean vars
24
+ unset($mailfiles);
25
+ unset($message);
26
+ ?>
app/dojob/file.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?PHP
2
+ BackWPupFunctions::joblog($logfile,__('Run File Backup...','backwpup'));
3
+
4
+ BackWPupFunctions::joblog($logfile,__('Make File List...','backwpup'));
5
+
6
+ function allfiles($path,$filelist='') { //helper function
7
+ if ($pathhandle = @opendir($path)) {
8
+ $path=str_replace('\\','/',$path);
9
+ $path=str_replace('//','/',$path);
10
+ $path=untrailingslashit($path);
11
+ while (false !== ($file = readdir($pathhandle))) {
12
+ if ($file != "." && $file != ".." && $file != ".svn") {
13
+ if (is_dir($path.'/'.$file)) {
14
+ $filelist=allfiles($path.'/'.$file,$filelist);
15
+ } else {
16
+ $filelist[]=$path.'/'.$file;
17
+ }
18
+ }
19
+ }
20
+ closedir($pathhandle);
21
+ }
22
+ return $filelist;
23
+ }
24
+
25
+ //Make filelist
26
+ if ($jobs[$jobid]['backuproot']) {
27
+ $filelist=allfiles(ABSPATH);
28
+ }
29
+ if ($jobs[$jobid]['backupcontent']) {
30
+ $filelist=allfiles(WP_CONTENT_DIR,$filelist);
31
+ } else {
32
+ if (is_array($filelist)) {
33
+ unset($excludefilelist); //clean vars
34
+ $excludefilelist=allfiles(WP_CONTENT_DIR);
35
+ foreach($excludefilelist as $fileexcludevalue) {
36
+ foreach($filelist as $filelistkey =>$filelistvalue) {
37
+ if ($filelistvalue==$fileexcludevalue)
38
+ unset($filelist[$filelistkey]);
39
+ }
40
+ }
41
+ }
42
+ }
43
+ if ($jobs[$jobid]['backupplugins']) {
44
+ $filelist=allfiles(WP_PLUGIN_DIR,$filelist);
45
+ } else {
46
+ if (is_array($filelist)) {
47
+ unset($excludefilelist); //clean vars
48
+ $excludefilelist=allfiles(WP_PLUGIN_DIR);
49
+ foreach($excludefilelist as $fileexcludevalue) {
50
+ foreach($filelist as $filelistkey =>$filelistvalue) {
51
+ if ($filelistvalue==$fileexcludevalue)
52
+ unset($filelist[$filelistkey]);
53
+ }
54
+ }
55
+ }
56
+ }
57
+ $dirinclude=split(',',$jobs[$jobid]['dirinclude']); // Add extra include dirs
58
+ if (is_array($dirinclude)) {
59
+ foreach($dirinclude as $dirincludevalue) {
60
+ if (is_dir($dirincludevalue)) {
61
+ $filelist=allfiles($dirincludevalue,$filelist);
62
+ }
63
+ }
64
+ }
65
+
66
+ if (sizeof($filelist)>0) {
67
+ $filelist=array_unique($filelist);
68
+ BackWPupFunctions::joblog($logfile,__('Remove Excludes from file list...','backwpup'));
69
+ //Remove Backup dirs
70
+ foreach($jobs as $jobsvale) {
71
+ foreach($filelist as $filelistkey =>$filelistvalue) {
72
+ if (stristr($filelistvalue,$jobsvale['backupdir'].'/'))
73
+ unset($filelist[$filelistkey]);
74
+ }
75
+ }
76
+ //Exclute files and dirs
77
+ $fileexclude=split(',',$jobs[$jobid]['fileexclude']);
78
+ if (is_array($fileexclude) and !empty($fileexclude[0]) and sizeof($fileexclude)>1) {
79
+ foreach($fileexclude as $fileexcludevalue) {
80
+ foreach($filelist as $filelistkey =>$filelistvalue) {
81
+ if (stristr($filelistvalue,$fileexcludevalue))
82
+ unset($filelist[$filelistkey]);
83
+ }
84
+ }
85
+ }
86
+ unset($fileexclude); //clean vars
87
+ } else {
88
+ BackWPupFunctions::joblog($logfile,__('ERROR: No files to Backup','backwpup'));
89
+ $joberror=true;
90
+ unset($filelist); //clean vars
91
+ }
92
+
93
+ if (sizeof($filelist)>0) {
94
+ //Make array index mor readable
95
+ $filestobackup=0;
96
+ foreach($filelist as $filelistvalue) {
97
+ $cleanfilelist[$filestobackup++]=$filelistvalue;
98
+ }
99
+ unset($filelist);
100
+ $filelist=$cleanfilelist;
101
+ unset($cleanfilelist);
102
+ } else {
103
+ BackWPupFunctions::joblog($logfile,__('ERROR: No files to Backup','backwpup'));
104
+ $joberror=true;
105
+ unset($filelist); //clean vars
106
+ }
107
+
108
+ //Create Zip File
109
+ BackWPupFunctions::joblog($logfile,__('Files to Backup: ','backwpup').print_r($filelist,true));
110
+ BackWPupFunctions::joblog($logfile,__('Create Backup Zip file...','backwpup'));
111
+
112
+ if (is_array($filelist) or $jobs[$jobid]['type']=='DB+FILE') {
113
+ require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
114
+ $zipbackupfile = new PclZip($backupfile);
115
+ if (0==$zipbackupfile -> create($filelist,PCLZIP_OPT_REMOVE_PATH,str_replace('\\','/',ABSPATH))) {
116
+ BackWPupFunctions::joblog($logfile,__('ERROR: Zip file create:','backwpup').' '.$zipbackupfile->errorInfo(true));
117
+ $joberror=true;
118
+ }
119
+ if ($jobs[$jobid]['type']=='DB+FILE') {
120
+ BackWPupFunctions::joblog($logfile,__('Add Database dump to Backup Zip file...','backwpup'));
121
+ if (0==$zipbackupfile -> add($cfg['tempdir'].'/'.DB_NAME.'.sql',PCLZIP_OPT_REMOVE_PATH,$cfg['tempdir'].'/')) {
122
+ BackWPupFunctions::joblog($logfile,__('ERROR: Zip file create Add Database dump:','backwpup').' '.$zipbackupfile->errorInfo(true));
123
+ $joberror=true;
124
+ }
125
+ }
126
+ //clean vars
127
+ unset($zipbackupfile);
128
+ unset($filelist);
129
+ BackWPupFunctions::joblog($logfile,__('Backup Zip file create done!','backwpup'));
130
+ }
131
+
132
+ ?>
app/dojob/optimize.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?PHP
2
+ //Optimize SQL Table
3
+ BackWPupFunctions::joblog($logfile,__('Run Database optimize...','backwpup'));
4
+ $tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
5
+
6
+ if (is_array($jobs[$jobid]['dbexclude'])) {
7
+ foreach($tables as $tablekey => $tablevalue) {
8
+ if (in_array($tablevalue,$jobs[$jobid]['dbexclude']))
9
+ unset($tables[$tablekey]);
10
+ }
11
+ }
12
+
13
+ if (sizeof($tables)>0) {
14
+ BackWPupFunctions::joblog($logfile,__('Tables to optimize: ','backwpup').print_r($tables,true));
15
+
16
+ foreach ($tables as $table) {
17
+ if (!in_array($table,(array)$jobs[$jobid]['dbexclude'])) {
18
+ $wpdb->query('OPTIMIZE TABLE `'.$table.'`');
19
+ if ($sqlerr=mysql_error($wpdb->dbh)) {
20
+ BackWPupFunctions::joblog($logfile,sprintf(__('ERROR: BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
21
+ $joberror=true;
22
+ }
23
+ }
24
+ }
25
+ $wpdb->flush();
26
+ BackWPupFunctions::joblog($logfile,__('Database optimize done!','backwpup'));
27
+ } else {
28
+ BackWPupFunctions::joblog($logfile,__('ERROR: No Tables to optimize','backwpup'));
29
+ $joberror=true;
30
+ }
31
+
32
+
33
+ BackWPupFunctions::joblog($logfile,__('Delete old Log files...','backwpup'));
34
+ $logs=get_option('backwpup_log');
35
+ if (is_array($logs)) {
36
+ unset($logkeys);
37
+ foreach ($logs as $timestamp => $logdata) {
38
+ if ($logdata['jobid']==$jobid)
39
+ $logkeys[]=$timestamp;
40
+ }
41
+ if (is_array($logkeys)) {
42
+ rsort($logkeys,SORT_NUMERIC);
43
+ $counter=0;$countdelbackups=0;$countdellogs=0;
44
+ for ($i=0;$i<sizeof($logkeys);$i++) {
45
+ if (!empty($logs[$logkeys[$i]]['backupfile']))
46
+ $counter++;
47
+ if ($counter>=15) {
48
+ if (is_file($logs[$logkeys[$i]]['backupfile'])) {
49
+ unlink($logs[$logkeys[$i]]['backupfile']);
50
+ $countdelbackups++;
51
+ }
52
+ if (is_file($logs[$logkeys[$i]]['logfile'])) {
53
+ unlink($logs[$logkeys[$i]]['logfile']);
54
+ $countdellogs++;
55
+ }
56
+ unset($logs[$logkeys[$i]]);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ update_option('backwpup_log',$logs);
62
+ BackWPupFunctions::joblog($logfile,$countdellogs.' '.__('Old Log files deleted!!!','backwpup'));
63
+ //clean vars
64
+ unset($logkeys);
65
+ unset($logs);
66
+
67
+
68
+
69
+ ?>
app/functions.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?PHP
2
+
3
+ class BackWPupFunctions {
4
+
5
+ //Thems Option menu entry
6
+ function menu_entry() {
7
+ $hook = add_management_page(__('BackWPup','backwpup'), __('BackWPup','backwpup'), 'install_plugins', 'BackWPup',array('BackWPupFunctions', 'options')) ;
8
+ add_action('load-'.$hook, array('BackWPupFunctions', 'options_load'));
9
+ add_contextual_help($hook,BackWPupFunctions::show_help());
10
+ }
11
+
12
+ // Help too display
13
+ function show_help() {
14
+ $help .= '<div class="metabox-prefs">';
15
+ $help .= '<a href="http://wordpress.org/tags/backwpup" target="_blank">'.__('Support').'</a>';
16
+ $help .= ' | <a href="http://wordpress.org/extend/plugins/backwpup/faq/" target="_blank">' . __('FAQ') . '</a>';
17
+ $help .= ' | <a href="http://danielhuesken.de/portfolio/backwpup" target="_blank">' . __('Plugin Homepage', 'backwpup') . '</a>';
18
+ $help .= ' | <a href="http://wordpress.org/extend/plugins/backwpup" target="_blank">' . __('Plugin Home on WordPress.org', 'backwpup') . '</a>';
19
+ $help .= ' | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">' . __('Donate') . '</a>';
20
+ $help .= "</div>\n";
21
+ $help .= '<div class="metabox-prefs">';
22
+ $help .= __('Version:', 'backwpup').' '.BACKWPUP_VERSION.' | ';
23
+ $help .= __('Author:', 'backwpup').' <a href="http://danielhuesken.de" target="_blank">Daniel H&uuml;sken</a>';
24
+ $help .= "</div>\n";
25
+ return $help;
26
+ }
27
+
28
+ //Options Page
29
+ function options() {
30
+ global $wpdb;
31
+ switch($_REQUEST['action']) {
32
+ case 'edit':
33
+ $jobs=get_option('backwpup_jobs');
34
+ $jobid = (int) $_REQUEST['jobid'];
35
+ check_admin_referer('edit-job');
36
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-edit.php');
37
+ break;
38
+ case 'logs':
39
+ $logs=get_option('backwpup_log');
40
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-logs.php');
41
+ break;
42
+ case 'settings':
43
+ $cfg=get_option('backwpup');
44
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-settings.php');
45
+ break;
46
+ case 'runnow':
47
+ $jobid = (int) $_GET['jobid'];
48
+ check_admin_referer('runnow-job_' . $jobid);
49
+ $jobs=get_option('backwpup_jobs');
50
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-runnow.php');
51
+ break;
52
+ case 'view_log':
53
+ $log= (int) $_GET['log'];
54
+ check_admin_referer('view-log');
55
+ $logs=get_option('backwpup_log');
56
+ $logfile=$logs[$log]['logfile'];
57
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-view_log.php');
58
+ break;
59
+ default:
60
+ $jobs=get_option('backwpup_jobs');
61
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options.php');
62
+ break;
63
+ }
64
+ }
65
+
66
+ //Options Page
67
+ function options_load() {
68
+ global $wpdb;
69
+ //Css for Admin Section
70
+ wp_enqueue_style('BackWpup',plugins_url('/'.BACKWPUP_PLUGIN_DIR.'/app/css/options.css'),'',BACKWPUP_VERSION,'screen');
71
+ //wp_enqueue_script('BackWpupOptions',plugins_url('/'.BACKWPUP_PLUGIN_DIR.'/app/js/options.js'),array('jquery','utils','jquery-ui-core'),BACKWPUP_VERSION,true);
72
+ //For save Options
73
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-save.php');
74
+ if ($_REQUEST['action2']!='-1' and !empty($_REQUEST['doaction2']))
75
+ $_REQUEST['action']=$_REQUEST['action2'];
76
+ switch($_REQUEST['action']) {
77
+ case 'delete':
78
+ if (is_Array($_POST['jobs'])) {
79
+ check_admin_referer('actions-jobs');
80
+ foreach ($_POST['jobs'] as $jobid) {
81
+ BackWPupOptions::delete_job($jobid);
82
+ }
83
+ } else {
84
+ $jobid = (int) $_GET['jobid'];
85
+ check_admin_referer('delete-job_' . $jobid);
86
+ BackWPupOptions::delete_job($jobid);
87
+ }
88
+ $_REQUEST['action']='';
89
+ break;
90
+ case 'delete-logs':
91
+ if (is_Array($_POST['logs'])) {
92
+ check_admin_referer('actions-logs');
93
+ foreach ($_POST['logs'] as $timestamp) {
94
+ BackWPupOptions::delete_log($timestamp);
95
+ }
96
+ } else {
97
+ $timestamp = (int) $_GET['log'];
98
+ check_admin_referer('delete-log_' . $timestamp);
99
+ BackWPupOptions::delete_log($timestamp);
100
+ }
101
+ $_REQUEST['action']='logs';
102
+ break;
103
+ case 'saveeditjob':
104
+ check_admin_referer('edit-job');
105
+ BackWPupOptions::edit_job((int) $_POST['jobid']);
106
+ break;
107
+ case 'savecfg':
108
+ check_admin_referer('backwpup-cfg');
109
+ BackWPupOptions::config();
110
+ $_REQUEST['action']='settings';
111
+ break;
112
+ case 'copy':
113
+ $jobid = (int) $_GET['jobid'];
114
+ check_admin_referer('copy-job_'.$jobid);
115
+ BackWPupOptions::copy_job($jobid);
116
+ $_REQUEST['action']='';
117
+ break;
118
+ case 'download':
119
+ $log = (int) $_GET['log'];
120
+ check_admin_referer('download-backup_'.$log);
121
+ BackWPupOptions::download_backup($log);
122
+ $_REQUEST['action']='logs';
123
+ break;
124
+ }
125
+ }
126
+
127
+ //delete Otions
128
+ function plugin_uninstall() {
129
+ delete_option('backwpup');
130
+ delete_option('backwpup_jobs');
131
+ delete_option('backwpup_log');
132
+ }
133
+
134
+ //On Plugin activate
135
+ function plugin_activate() {
136
+ //add cron jobs
137
+ $jobs=get_option('backwpup_jobs');
138
+ if (is_array($jobs)) {
139
+ foreach ($jobs as $jobid => $jobvalue) {
140
+ if ($jobvalue['activated']) {
141
+ wp_schedule_event($jobvalue['scheduletime'], 'backwpup_int_'.$jobid, 'backwpup_cron',array('jobid'=>$jobid));
142
+ }
143
+ }
144
+ }
145
+ //set Tmp dir
146
+ $cfg=get_option('backwpup');
147
+ if (empty($cfg['tempdir']))
148
+ $cfg['tempdir']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup';
149
+ update_option('backwpup',$cfg);
150
+ }
151
+
152
+ //on Plugin deaktivate
153
+ function plugin_deactivate() {
154
+ //remove cron jobs
155
+ $jobs=get_option('backwpup_jobs');
156
+ if (is_array($jobs)) {
157
+ foreach ($jobs as $jobid => $jobvalue) {
158
+ if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
159
+ wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ //add edit setting to plugins page
166
+ function plugin_options_link($links) {
167
+ $settings_link='<a href="admin.php?page=BackWPup" title="' . __('Go to Settings Page','backwpup') . '" class="edit">' . __('Settings') . '</a>';
168
+ array_unshift( $links, $settings_link );
169
+ return $links;
170
+ }
171
+
172
+ //add links on plugins page
173
+ function plugin_links($links, $file) {
174
+ if ($file == BACKWPUP_PLUGIN_DIR.'/backwpup.php') {
175
+ $links[] = '<a href="http://wordpress.org/extend/plugins/backwpup/faq/" target="_blank">' . __('FAQ') . '</a>';
176
+ $links[] = '<a href="http://wordpress.org/tags/backwpup/" target="_blank">' . __('Support') . '</a>';
177
+ $links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank">' . __('Donate') . '</a>';
178
+ }
179
+ return $links;
180
+ }
181
+
182
+ //Add cron interval
183
+ function intervals($schedules) {
184
+ $jobs=get_option('backwpup_jobs'); //Load Settings
185
+ if (is_array($jobs)) {
186
+ foreach ($jobs as $jobkey => $jobvalue) {
187
+ if (!empty($jobvalue['scheduleinterval']))
188
+ $intervals['backwpup_int_'.$jobkey]=array('interval' => $jobvalue['scheduleinterval'], 'display' => __('BackWPup Job '.$jobkey, 'backwpup'));
189
+ }
190
+ if (is_array($intervals))
191
+ $schedules=array_merge($intervals,$schedules);
192
+ }
193
+ return $schedules;
194
+ }
195
+
196
+ //DoJob
197
+ function dojob($args) {
198
+ global $wpdb;
199
+ if (is_array($args)) { //cron gifes no complete arry back!!!
200
+ extract($args, EXTR_SKIP );
201
+ } else {
202
+ $jobid=$args;
203
+ }
204
+ if (empty($jobid)) return false;
205
+ require_once('dojob/bevore.php');
206
+ switch($jobs[$jobid]['type']) {
207
+ case 'DB+FILE':
208
+ require_once('dojob/db.php');
209
+ require_once('dojob/file.php');
210
+ require_once('dojob/destination-dir.php');
211
+ //require_once('dojob/destination-ftp.php');
212
+ break;
213
+ case 'DB':
214
+ require_once('dojob/db.php');
215
+ require_once('dojob/destination-dir.php');
216
+ //require_once('dojob/destination-ftp.php');
217
+ break;
218
+ case 'FILE':
219
+ require_once('dojob/file.php');
220
+ require_once('dojob/destination-dir.php');
221
+ //require_once('dojob/destination-ftp.php');
222
+ break;
223
+ case 'OPTIMIZE':
224
+ require_once('dojob/optimize.php');
225
+ break;
226
+ }
227
+ require_once('dojob/destination-mail.php');
228
+ require_once('dojob/after.php');
229
+
230
+ if ($returnlogfile)
231
+ return $logfile;
232
+ else
233
+ return;
234
+ }
235
+
236
+ //Make Log File for Jobs.
237
+ function joblog($logfile,$entry) {
238
+ if($file = fopen($logfile, 'a')) {
239
+ fwrite($file, date('Y-m-d H:i.s').": ".$entry."\n");
240
+ fclose($file);
241
+ }
242
+ }
243
+
244
+ //file size
245
+ function formatBytes($bytes, $precision = 2) {
246
+ $units = array('B', 'KB', 'MB', 'GB', 'TB');
247
+ $bytes = max($bytes, 0);
248
+ $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
249
+ $pow = min($pow, count($units) - 1);
250
+ $bytes /= pow(1024, $pow);
251
+ return round($bytes, $precision) . ' ' . $units[$pow];
252
+ }
253
+
254
+ // add all action and so on only if plugin loaded.
255
+ function init() {
256
+ //load Text Domain
257
+ load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_DIR.'/lang');
258
+ //add Menu
259
+ add_action('admin_menu', array('BackWPupFunctions', 'menu_entry'));
260
+ //Additional links on the plugin page
261
+ add_filter('plugin_action_links_'.BACKWPUP_PLUGIN_DIR.'/backwpup.php', array('BackWPupFunctions', 'plugin_options_link'));
262
+ add_filter('plugin_row_meta', array('BackWPupFunctions', 'plugin_links'),10,2);
263
+ //add cron intervals
264
+ add_filter('cron_schedules', array('BackWPupFunctions', 'intervals'));
265
+ //Actions for Cron job
266
+ add_action('backwpup_cron', array('BackWPupFunctions', 'dojob'));
267
+ }
268
+ }
269
+
270
+ ?>
app/options-edit.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-tools" class="icon32"><br /></div>
3
+ <h2><?php _e('Edit BackWPup Job', 'backwpup'); ?></h2>
4
+
5
+ <form method="post" action="">
6
+ <input type="hidden" name="action" value="saveeditjob" />
7
+ <input type="hidden" name="jobid" value="<?PHP echo $jobid;?>" />
8
+ <?php
9
+ wp_nonce_field('edit-job');
10
+ if (empty($jobs[$jobid]['type']))
11
+ $jobs[$jobid]['type']='DB+FILE';
12
+
13
+
14
+ if ($jobs[$jobid]['type']=='OPTIMIZE') {
15
+ echo '<input type="hidden" name="backupdir" value="'.$jobs[$jobid]['backupdir'].'" />';
16
+ echo '<input type="hidden" name="maxbackups" value="'.$jobs[$jobid]['maxbackups'].'" />';
17
+ }
18
+ if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='OPTIMIZE') {
19
+ echo '<input type="hidden" name="fileexclude" value="'.$jobs[$jobid]['fileexclude'].'" />';
20
+ }
21
+ if ($jobs[$jobid]['type']=='FILE') {
22
+ if (is_array($jobs[$jobid]['dbexclude'])) {
23
+ foreach ($jobs[$jobid]['dbexclude'] as $table) {
24
+ echo '<input type="hidden" name="dbexclude[]" value="'.$table.'" />';
25
+ }
26
+ }
27
+ }
28
+
29
+
30
+ ?>
31
+ <table class="form-table">
32
+
33
+ <tr valign="top">
34
+ <th scope="row"><label for="job_type"><?PHP _e('Job Type','backwpup'); ?></label></th>
35
+ <td>
36
+ <select name="type" id="job_type">
37
+ <option value="DB+FILE"<?PHP selected('DB+FILE',$jobs[$jobid]['type']);?>><?PHP _e('Database &amp; File Backup','backwpup'); ?></option>
38
+ <option value="DB"<?PHP selected('DB',$jobs[$jobid]['type']);?>><?PHP _e('Database Backup','backwpup'); ?></option>
39
+ <option value="FILE"<?PHP selected('FILE',$jobs[$jobid]['type']);?>><?PHP _e('File Backup','backwpup'); ?></option>
40
+ <option value="OPTIMIZE"<?PHP selected('OPTIMIZE',$jobs[$jobid]['type']);?>><?PHP _e('Optimize Database Tabels','backwpup'); ?></option>
41
+ </select>
42
+ <input type="submit" name="change" class="button" value="<?php _e('Change', 'backwpup'); ?>" />
43
+ </td>
44
+ </tr>
45
+
46
+ <tr valign="top">
47
+ <th scope="row"><label for="jobname"><?PHP _e('Job Name','backwpup'); ?></label></th>
48
+ <td><input name="name" type="text" id="jobname" value="<?PHP echo $jobs[$jobid]['name'];?>" class="regular-text" /></td>
49
+ </tr>
50
+
51
+ <?PHP if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE' or $jobs[$jobid]['type']=='OPTIMIZE') {?>
52
+ <tr valign="top">
53
+ <th scope="row"><label for="dbexclude"><?PHP _e('Exclude Databas Tabels:','backwpup'); ?></label></th><td>
54
+ <?php
55
+ $tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
56
+ if (!isset($jobs[$jobid]['dbexclude'])) { //def.
57
+ foreach ($tables as $table) {
58
+ if (substr($table,0,strlen($wpdb->prefix))!=$wpdb->prefix)
59
+ $jobs[$jobid]['dbexclude'][]=$table;
60
+ }
61
+ }
62
+ foreach ($tables as $table) {
63
+ echo ' <input class="checkbox" type="checkbox"'.checked(in_array($table,(array)$jobs[$jobid]['dbexclude']),true,false).' name="dbexclude[]" value="'.$table.'"/>'.$table;
64
+ }
65
+
66
+ ?>
67
+ </td></tr>
68
+ <?PHP } ?>
69
+ <?PHP if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB+FILE') {?>
70
+ <?PHP if (!isset($jobs[$jobid]['backuproot'])) $jobs[$jobid]['backuproot']=true; if (!isset($jobs[$jobid]['backupcontent'])) $jobs[$jobid]['backupcontent']=true; if (!isset($jobs[$jobid]['backupplugins'])) $jobs[$jobid]['backupplugins']=true;?>
71
+ <tr valign="top">
72
+ <th scope="row"><label for="fileinclude"><?PHP _e('Backup Blog dirs','backwpup'); ?></label></th><td>
73
+ <input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backuproot'],true,true);?> name="backuproot" value="1"/> <?php _e('Blog root and WP Files','backwpup');?><br />
74
+ <input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupcontent'],true,true);?> name="backupcontent" value="1"/> <?php _e('Blog Content','backwpup');?><br />
75
+ <input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupplugins'],true,true);?> name="backupplugins" value="1"/> <?php _e('Blog Plugins','backwpup');?>
76
+ </td></tr>
77
+
78
+ <tr valign="top">
79
+ <th scope="row"><label for="dirinclude"><?PHP _e('Include extra dirs','backwpup'); ?></label></th><td>
80
+ <input name="dirinclude" type="text" value="<?PHP echo $jobs[$jobid]['dirinclude'];?>" class="regular-text" /><span class="description"><?PHP echo __('Separate with ,. Full Path like:','backwpup').' '.str_replace('\\','/',ABSPATH); ?></span>
81
+ </td></tr>
82
+
83
+ <tr valign="top">
84
+ <th scope="row"><label for="fileexclude"><?PHP _e('Exclude files/dirs','backwpup'); ?></label></th><td>
85
+ <input name="fileexclude" type="text" value="<?PHP echo $jobs[$jobid]['fileexclude'];?>" class="regular-text" /><span class="description"><?PHP _e('Separate with ,','backwpup') ?></span>
86
+ </td></tr>
87
+ <?PHP } ?>
88
+
89
+ <tr valign="top">
90
+ <th scope="row"><label for="jobname"><?PHP _e('Schedule','backwpup'); ?></label></th>
91
+ <td>
92
+ <span class="description"><?php _e('Run Every:', 'backwpup'); ?></span>
93
+ <?PHP
94
+ echo '<select name="scheduleintervalteimes">';
95
+ for ($i=1;$i<=60;$i++) {
96
+ echo '<option value="'.$i.'"'.selected($i,$jobs[$jobid]['scheduleintervalteimes'],false).'>'.$i.'</option>';
97
+ }
98
+ echo '</select>';
99
+ if (empty($jobs[$jobid]['scheduleintervaltype']))
100
+ $jobs[$jobid]['scheduleintervaltype']=3600;
101
+ echo '<select name="scheduleintervaltype">';
102
+ echo '<option value="60"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Min(s)','backwpup').'</option>';
103
+ echo '<option value="3600"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Houer(s)','backwpup').'</option>';
104
+ echo '<option value="86400"'.selected('86400',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Day(s)','backwpup').'</option>';
105
+ echo '</select>';
106
+ ?>
107
+ <br />
108
+ <span class="description"><?php _e('Start Time:', 'backwpup'); ?></span>
109
+ <?PHP
110
+ if (empty($jobs[$jobid]['scheduletime']))
111
+ $jobs[$jobid]['scheduletime']=time();
112
+
113
+ echo '<select name="schedulehour">';
114
+ for ($i=0;$i<=23;$i++) {
115
+ echo '<option value="'.$i.'"'.selected($i,date('G',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
116
+ }
117
+ echo '</select>:';
118
+ echo '<select name="scheduleminute">';
119
+ for ($i=0;$i<=59;$i++) {
120
+ echo '<option value="'.$i.'"'.selected($i,date('i',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
121
+ }
122
+ echo '</select>&nbsp;';
123
+ ?><span class="description"><?php _e('Start Date:', 'backwpup'); ?></span><?PHP
124
+ echo '<select name="scheduleday">';
125
+ for ($i=1;$i<=31;$i++) {
126
+ echo '<option value="'.$i.'"'.selected($i,date('j',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
127
+ }
128
+ echo '</select>.';
129
+ $month=array('1'=>__('January'),'2'=>__('February'),'3'=>__('March'),'4'=>__('April'),'5'=>__('May'),'6'=>__('June'),'7'=>__('July'),'8'=>__('August'),'9'=>__('September'),'10'=>__('October'),'11'=>__('November'),'12'=>__('December'));
130
+ echo '<select name="schedulemonth">';
131
+ for ($i=1;$i<=12;$i++) {
132
+ echo '<option value="'.$i.'"'.selected($i,date('n',$jobs[$jobid]['scheduletime']),false).'>'.$month[$i].'</option>';
133
+ }
134
+ echo '</select>.';
135
+ echo '<select name="scheduleyear">';
136
+ for ($i=date('Y')-1;$i<=date('Y')+3;$i++) {
137
+ echo '<option value="'.$i.'"'.selected($i,date('Y',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
138
+ }
139
+ echo '</select>';
140
+ ?>
141
+ <br />
142
+ <span class="description"><?php _e('Activate:', 'backwpup'); ?></span>
143
+ <input class="checkbox" type="checkbox" <?php checked($jobs[$jobid]['activated'],true); ?> name="activated" />
144
+ </td>
145
+ </tr>
146
+
147
+ <?PHP if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE') {?>
148
+ <tr valign="top">
149
+ <?PHP if (empty($jobs[$jobid]['backupdir'])) $jobs[$jobid]['backupdir']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup/';?>
150
+ <th scope="row"><label for="backupdir"><?PHP _e('Backup to Directory','backwpup'); ?></label></th>
151
+ <td><input name="backupdir" type="text" value="<?PHP echo $jobs[$jobid]['backupdir'];?>" class="regular-text" /><span class="description"><?PHP _e('Full Phath of Directory for Backup fiels','backwpup'); ?></span></td>
152
+ </tr>
153
+ <tr valign="top">
154
+ <th scope="row"><label for="maxbackups"><?PHP _e('Max number of Backup Files','backwpup'); ?></label></th>
155
+ <td>
156
+ <?PHP
157
+ echo '<select name="maxbackups">';
158
+ echo '<option value="0"'.selected(0,$jobs[$jobid]['maxbackups'],false).'>'.__('Off','backwpup').'</option>';
159
+ for ($i=1;$i<=50;$i++) {
160
+ echo '<option value="'.$i.'"'.selected($i,$jobs[$jobid]['maxbackups'],false).'>'.$i.'</option>';
161
+ }
162
+ echo '</select> <span class="description">';
163
+ _e('Oldest files will deletet first.','backwpup');
164
+ ?></span>
165
+ </td>
166
+ </tr>
167
+ <?PHP } ?>
168
+
169
+
170
+ <tr valign="top">
171
+ <th scope="row"><label for="mailaddress"><?PHP _e('Send Mail to','backwpup'); ?></label></th>
172
+ <td><input name="mailaddress" type="text" value="<?PHP echo $jobs[$jobid]['mailaddress'];?>" class="regular-text" /></td>
173
+ </tr>
174
+
175
+ </table>
176
+ <p class="submit">
177
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
178
+ </p>
179
+ </form>
app/options-logs.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-tools" class="icon32"><br /></div>
3
+ <h2><?php _e('BackWPup Logs', 'backwpup'); ?></h2>
4
+ <ul class="subsubsub">
5
+ <li><a href="admin.php?page=BackWPup">Jobs</a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs" class="current">Logs</a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=settings">Settings</a></li>
8
+ </ul>
9
+
10
+ <form id="logs-filter" action="" method="post">
11
+ <?php wp_nonce_field('actions-logs'); ?>
12
+ <input type="hidden" name="page" value="BackWPup" />
13
+ <div class="tablenav">
14
+
15
+ <div class="alignleft actions">
16
+ <select name="action" class="select-action">
17
+ <option value="-1" selected="selected"><?PHP _e('Bulk Actions','backwpup'); ?></option>
18
+ <option value="delete-logs"><?PHP _e('Delete','backwpup'); ?></option>
19
+ </select>
20
+ <input type="submit" value="<?PHP _e('Apply','backwpup'); ?>" name="doaction" id="doaction" class="button-secondary action" />
21
+ </div>
22
+
23
+ <br class="clear" />
24
+ </div>
25
+
26
+ <div class="clear"></div>
27
+
28
+ <table class="widefat fixed" cellspacing="0">
29
+ <thead>
30
+ <tr>
31
+ <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th>
32
+ <th scope="col" id="id" class="manage-column column-id" style=""><?PHP _e('Job','backwpup'); ?></th>
33
+ <th scope="col" id="type" class="manage-column column-type" style=""><?PHP _e('Type','backwpup'); ?></th>
34
+ <th scope="col" id="log" class="manage-column column-log" style=""><?PHP _e('Backup/Log','backwpup'); ?></th>
35
+ <th scope="col" id="size" class="manage-column column-size" style=""><?PHP _e('Size','backwpup'); ?></th>
36
+ <th scope="col" id="logdate" class="manage-column column-logdate" style=""><?PHP _e('Log Date','backwpup'); ?></th>
37
+ </tr>
38
+ </thead>
39
+
40
+ <tfoot>
41
+ <tr>
42
+ <th scope="col" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th>
43
+ <th scope="col" class="manage-column column-id" style=""><?PHP _e('Job','backwpup'); ?></th>
44
+ <th scope="col" class="manage-column column-type" style=""><?PHP _e('Type','backwpup'); ?></th>
45
+ <th scope="col" class="manage-column column-log" style=""><?PHP _e('Backup/Log','backwpup'); ?></th>
46
+ <th scope="col" class="manage-column column-size" style=""><?PHP _e('Size','backwpup'); ?></th>
47
+ <th scope="col" class="manage-column column-logdate" style=""><?PHP _e('Log Date','backwpup'); ?></th>
48
+ </tr>
49
+ </tfoot>
50
+
51
+ <tbody id="the-list" class="list:post">
52
+
53
+ <?PHP if (is_array($logs)) {
54
+ $logs=array_reverse($logs,true);
55
+ foreach ($logs as $timestamp => $logvalue) {?>
56
+ <tr id="post-16" class="alternate author-self status-inherit" valign="top">
57
+ <th scope="row" class="check-column">
58
+ <input type="checkbox" name="logs[]" value="<?PHP echo $timestamp;?>" />
59
+ </th>
60
+ <td class="column-id"><?PHP echo $logvalue['jobid'];?></td>
61
+ <td class="column-type">
62
+ <?PHP
63
+ switch($logvalue['type']) {
64
+ case 'DB+FILE':
65
+ _e('Database &amp; File Backup','backwpup');
66
+ break;
67
+ case 'DB':
68
+ _e('Database Backup','backwpup');
69
+ break;
70
+ case 'FILE':
71
+ _e('File Backup','backwpup');
72
+ break;
73
+ case 'OPTIMIZE':
74
+ _e('Optimize Database Tabels','backwpup');
75
+ break;
76
+ }
77
+ ?>
78
+ </td>
79
+ <td class="name column-log">
80
+ <?php
81
+ $name=basename($logvalue['logfile']);
82
+ if (!empty($logvalue['backupfile']) and is_file($logvalue['backupfile']))
83
+ $name=basename($logvalue['backupfile']);
84
+ ?>
85
+ <strong><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=view_log&log='.$timestamp, 'view-log'); ?>" title="<?PHP _e('View log','backwpup'); ?>"><?PHP echo $name;?></a> <?PHP if($logvalue['error']) { echo '<span style="color:red;">'.__('ERROR','backwpup').'</span>'; } else { _e('OK','backwpup'); } ?></strong>
86
+ <p><div class="row-actions">
87
+ <span class="view"><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=view_log&log='.$timestamp, 'view-log'); ?>"><?PHP _e('View','backwpup'); ?></a></span>
88
+ <span class="delete"> | <a class="submitdelete" href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=delete-logs&log='.$timestamp, 'delete-log_'.$timestamp); ?>" onclick="if ( confirm('<?PHP echo esc_js(__("You are about to delete this Job. \n 'Cancel' to stop, 'OK' to delete.","backwpup")) ?>') ){return true;}return false;"><?PHP _e('Delete','backwpup'); ?></a></span>
89
+ <?PHP if (!empty($logvalue['backupfile']) and is_file($logvalue['backupfile'])) { ?>
90
+ <span class="download"> | <a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=download&log='.$timestamp, 'download-backup_'.$timestamp); ?>"><?PHP _e('Download','backwpup'); ?></a></span>
91
+ <?PHP } ?>
92
+ </div></p>
93
+ </td>
94
+ <td class="column-size">
95
+ <?PHP
96
+ if (!empty($logvalue['backupfile']) and is_file($logvalue['backupfile'])) {
97
+ echo BackWPupFunctions::formatBytes(filesize($logvalue['backupfile']));
98
+ } else {
99
+ _e('only Log','backwpup');
100
+ }
101
+ ?>
102
+ </td>
103
+ <td class="column-logdate">
104
+ <?PHP
105
+ echo date(get_option('date_format'),$timestamp); ?><br /><?PHP echo date(get_option('time_format'),$timestamp);
106
+ echo '<br />'.__('Runtime:','backwpup').' '.$logvalue['worktime'].' '.__('sec.','backwpup');
107
+ ?>
108
+ </td>
109
+ </tr>
110
+ <?PHP }}?>
111
+ </tbody>
112
+ </table>
113
+
114
+ <div class="tablenav">
115
+ <div class="alignleft actions">
116
+ <select name="action2" class="select-action">
117
+ <option value="-1" selected="selected"><?PHP _e('Bulk Actions','backwpup'); ?></option>
118
+ <option value="delete-logs"><?PHP _e('Delete','backwpup'); ?></option>
119
+ </select>
120
+ <input type="submit" value="<?PHP _e('Apply','backwpup'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
121
+ </div>
122
+
123
+ <br class="clear" />
124
+ </div>
125
+ </form>
126
+ <br class="clear" />
127
+
128
+ <div>
app/options-runnow.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-tools" class="icon32"><br /></div>
3
+ <h2><?php _e("BackWPup Job Running", "backwpup"); ?></h2>
4
+ <ul class="subsubsub">
5
+ <li><a href="admin.php?page=BackWPup">Jobs</a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs">Logs</a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=settings">Settings</a></li>
8
+ </ul>
9
+ <br class="clear" />
10
+ <?PHP $logfile=BackWPupFunctions::dojob(array('jobid'=>$jobid,'returnlogfile'=>true)); ?>
11
+ <pre>
12
+ <?PHP
13
+ $log=file($logfile);
14
+ for ($i=0;$i<sizeof($log);$i++) {
15
+ echo $log[$i];
16
+ }
17
+ ?>
18
+ </pre>
app/options-save.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BackWPupOptions {
4
+
5
+ function delete_job($jobid) {
6
+ $jobs=get_option('backwpup_jobs'); //Load Settings
7
+ unset($jobs[$jobid]);
8
+ update_option('backwpup_jobs',$jobs); //Save Settings
9
+ if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
10
+ wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
11
+ }
12
+ }
13
+
14
+ function delete_log($timestamp) {
15
+ $logs=get_option('backwpup_log'); //Load Settings
16
+ if (is_file($logs[$timestamp]['logfile']))
17
+ unlink($logs[$timestamp]['logfile']);
18
+ if (is_file($logs[$timestamp]['backupfile']))
19
+ unlink($logs[$timestamp]['backupfile']);
20
+ unset($logs[$timestamp]);
21
+ update_option('backwpup_log',$logs); //Save Settings
22
+ }
23
+
24
+ function copy_job($jobid) {
25
+ $jobs=get_option('backwpup_jobs'); //Load Settings
26
+
27
+ //generate new ID
28
+ foreach ($jobs as $jobkey => $jobvalue) {
29
+ if ($jobkey>$heighestid) $heighestid=$jobkey;
30
+ }
31
+ $newjobid=$heighestid+1;
32
+
33
+ $jobs[$newjobid]=$jobs[$jobid];
34
+ $jobs[$newjobid]['name']=__('Copy of','backwpup').' '.$jobs[$newjobid]['name'];
35
+ $jobs[$newjobid]['activated']=false;
36
+ update_option('backwpup_jobs',$jobs); //Save Settings
37
+ }
38
+
39
+ function config() {
40
+ $cfg=get_option('backwpup'); //Load Settings
41
+ $cfg['tempdir']= untrailingslashit(str_replace('\\','/',stripslashes($_POST['tempdir'])));
42
+ update_option('backwpup',$cfg); //Save Settings
43
+ }
44
+
45
+ function download_backup($timestamp) {
46
+ $logs=get_option('backwpup_log'); //Load Settings
47
+ if (is_file($logs[$timestamp]['backupfile'])) {
48
+ header("Pragma: public");
49
+ header("Expires: 0");
50
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
51
+ header("Content-Type: application/force-download");
52
+ header("Content-Type: application/octet-stream");
53
+ header("Content-Type: application/download");
54
+ header("Content-Disposition: attachment; filename=".basename($logs[$timestamp]['backupfile']).";");
55
+ header("Content-Transfer-Encoding: binary");
56
+ header("Content-Length: ".filesize($logs[$timestamp]['backupfile']));
57
+ @readfile($logs[$timestamp]['backupfile']);
58
+ } else {
59
+ header('HTTP/1.0 404 Not Found');
60
+ die(__('File does not exist.', 'backwpup'));
61
+ }
62
+ }
63
+
64
+ function edit_job($jobid) {
65
+ $jobs=get_option('backwpup_jobs'); //Load Settings
66
+
67
+ if (empty($jobid)) { //generate a new id for new job
68
+ if (is_array($jobs)) {
69
+ foreach ($jobs as $jobkey => $jobvalue) {
70
+ if ($jobkey>$heighestid) $heighestid=$jobkey;
71
+ }
72
+ $jobid=$heighestid+1;
73
+ } else {
74
+ $jobid=1;
75
+ }
76
+ }
77
+
78
+
79
+ $jobs[$jobid]['type']= $_POST['type'];
80
+ $jobs[$jobid]['name']= esc_html($_POST['name']);
81
+ $jobs[$jobid]['activated']= $_POST['activated'];
82
+ $jobs[$jobid]['scheduletime']=mktime($_POST['schedulehour'],$_POST['scheduleminute'],0,$_POST['schedulemonth'],$_POST['scheduleday'],$_POST['scheduleyear']);
83
+ $jobs[$jobid]['scheduleintervaltype']=$_POST['scheduleintervaltype'];
84
+ $jobs[$jobid]['scheduleintervalteimes']=$_POST['scheduleintervalteimes'];
85
+ $jobs[$jobid]['scheduleinterval']=$_POST['scheduleintervaltype']*$_POST['scheduleintervalteimes'];
86
+ $jobs[$jobid]['backupdir']= untrailingslashit(str_replace('\\','/',stripslashes($_POST['backupdir'])));
87
+ $jobs[$jobid]['maxbackups']=abs((int)$_POST['maxbackups']);
88
+ $jobs[$jobid]['mailaddress']=sanitize_email($_POST['mailaddress']);
89
+ $jobs[$jobid]['dbexclude']=array_unique((array)$_POST['dbexclude']);
90
+ $jobs[$jobid]['fileexclude']=str_replace('\\','/',stripslashes($_POST['fileexclude']));
91
+ $jobs[$jobid]['dirinclude']=str_replace('\\','/',stripslashes($_POST['dirinclude']));
92
+ $jobs[$jobid]['backuproot']=isset($_POST['backuproot']);
93
+ $jobs[$jobid]['backupcontent']=isset($_POST['backupcontent']);
94
+ $jobs[$jobid]['backupplugins']=isset($_POST['backupplugins']);
95
+
96
+
97
+ update_option('backwpup_jobs',$jobs); //Save Settings
98
+ if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
99
+ wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
100
+ }
101
+ if ($jobs[$jobid]['activated']) {
102
+ wp_schedule_event($jobs[$jobid]['scheduletime'], 'backwpup_int_'.$jobid, 'backwpup_cron',array('jobid'=>$jobid));
103
+ }
104
+ if (!empty($_POST['change'])) {
105
+ $_REQUEST['action']='edit';
106
+ $_REQUEST['jobid']=$jobid;
107
+ } else {
108
+ $_REQUEST['action']='';
109
+ }
110
+ }
111
+ }
112
+ ?>
app/options-settings.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-tools" class="icon32"><br /></div>
3
+ <h2><?php _e("BackWPup Settings", "backwpup"); ?></h2>
4
+ <ul class="subsubsub">
5
+
6
+ <li><a href="admin.php?page=BackWPup">Jobs</a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=logs">Logs</a> |</li>
8
+ <li><a href="admin.php?page=BackWPup&amp;action=settings" class="current">Settings</a></li>
9
+ </ul>
10
+
11
+ <form method="post" action="">
12
+ <input type="hidden" name="action" value="savecfg" />
13
+ <?php wp_nonce_field('backwpup-cfg'); ?>
14
+
15
+ <table class="form-table">
16
+ <tr valign="top">
17
+ <th scope="row"><label for="tempdir"><?PHP _e('Temp Directory:','backwpup'); ?></label></th>
18
+ <td><input name="tempdir" type="text" value="<?PHP echo $cfg['tempdir'];?>" class="regular-text" /><span class="description"><?PHP _e('Full Phath of Temp Directory','backwpup'); ?></span></td>
19
+ </tr>
20
+
21
+ </table>
22
+
23
+ <p class="submit">
24
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
25
+ </p>
26
+ </form>
app/options-view_log.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-tools" class="icon32"><br /></div>
3
+ <h2><?php _e("BackWPup View Log", "backwpup"); ?></h2>
4
+ <ul class="subsubsub">
5
+ <li><a href="admin.php?page=BackWPup">Jobs</a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs" >Logs</a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=settings">Settings</a></li>
8
+ </ul>
9
+ <br class="clear" />
10
+
11
+ <pre>
12
+ <?PHP
13
+ $log=file($logfile);
14
+ for ($i=0;$i<sizeof($log);$i++) {
15
+ echo $log[$i];
16
+ }
17
+ ?>
18
+ </pre>
app/options.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-tools" class="icon32"><br /></div>
3
+ <h2><?php _e("BackWPup", "backwpup"); ?><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid=0', 'edit-job'); ?>" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a></h2>
4
+ <ul class="subsubsub">
5
+
6
+ <li><a href="admin.php?page=BackWPup" class="current"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
8
+ <li><a href="admin.php?page=BackWPup&amp;action=settings"><?PHP _e('Settings','backwpup'); ?></a></li>
9
+ </ul>
10
+
11
+ <form id="jobs-filter" action="" method="post">
12
+ <?php wp_nonce_field('actions-jobs'); ?>
13
+ <input type="hidden" name="page" value="BackWPup" />
14
+ <div class="tablenav">
15
+
16
+ <div class="alignleft actions">
17
+ <select name="action" class="select-action">
18
+ <option value="-1" selected="selected"><?PHP _e('Bulk Actions','backwpup'); ?></option>
19
+ <option value="delete"><?PHP _e('Delete','backwpup'); ?></option>
20
+ </select>
21
+ <input type="submit" value="<?PHP _e('Apply','backwpup'); ?>" name="doaction" id="doaction" class="button-secondary action" />
22
+ </div>
23
+
24
+ <br class="clear" />
25
+ </div>
26
+
27
+ <div class="clear"></div>
28
+
29
+ <table class="widefat fixed" cellspacing="0">
30
+ <thead>
31
+ <tr>
32
+ <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th>
33
+ <th scope="col" id="id" class="manage-column column-id" style=""><?PHP _e('ID','backwpup'); ?></th>
34
+ <th scope="col" id="name" class="manage-column column-name" style=""><?PHP _e('Name','backwpup'); ?></th>
35
+ <th scope="col" id="type" class="manage-column column-type" style=""><?PHP _e('Type','backwpup'); ?></th>
36
+ <th scope="col" id="next" class="manage-column column-next" style=""><?PHP _e('Next Run','backwpup'); ?></th>
37
+ <th scope="col" id="last" class="manage-column column-last" style=""><?PHP _e('Last Run','backwpup'); ?></th>
38
+ </tr>
39
+ </thead>
40
+
41
+ <tfoot>
42
+ <tr>
43
+ <th scope="col" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th>
44
+ <th scope="col" class="manage-column column-id" style=""><?PHP _e('ID','backwpup'); ?></th>
45
+ <th scope="col" class="manage-column column-name" style=""><?PHP _e('Name','backwpup'); ?></th>
46
+ <th scope="col" class="manage-column column-type" style=""><?PHP _e('Type','backwpup'); ?></th>
47
+ <th scope="col" class="manage-column column-next" style=""><?PHP _e('Next Run','backwpup'); ?></th>
48
+ <th scope="col" class="manage-column column-last" style=""><?PHP _e('Last Run','backwpup'); ?></th>
49
+ </tr>
50
+ </tfoot>
51
+
52
+ <tbody id="the-list" class="list:post">
53
+
54
+ <?PHP if (is_array($jobs)) { foreach ($jobs as $jobid => $jobvalue) {?>
55
+ <tr id="post-16" class="alternate author-self status-inherit" valign="top">
56
+ <th scope="row" class="check-column">
57
+ <input type="checkbox" name="jobs[]" value="<?PHP echo $jobid;?>" />
58
+ </th>
59
+ <td class="column-id"><?PHP echo $jobid;?></td>
60
+ <td class="name column-name">
61
+ <strong><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job'); ?>" title="<?PHP _e('Edit:','backwpup'); ?> <?PHP echo $jobvalue['name'];?>"><?PHP echo $jobvalue['name'];?></a></strong>
62
+ <p><div class="row-actions">
63
+ <span class="edit"><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job'); ?>"><?PHP _e('Edit','backwpup'); ?></a> | </span>
64
+ <span class="delete"><a class="submitdelete" href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=delete&jobid='.$jobid, 'delete-job_'.$jobid); ?>" onclick="if ( confirm('<?PHP echo esc_js(__("You are about to delete this Job. \n 'Cancel' to stop, 'OK' to delete.","backwpup")) ?>') ){return true;}return false;"><?PHP _e('Delete','backwpup'); ?></a> | </span>
65
+ <span class="copy"><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=copy&jobid='.$jobid, 'copy-job_'.$jobid); ?>"><?PHP _e('Copy','backwpup'); ?></a> | </span>
66
+ <span class="runnow"><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=runnow&jobid='.$jobid, 'runnow-job_'.$jobid); ?>" title="Run Now: <?PHP echo $jobvalue['name'];?>"><?PHP _e('Run Now','backwpup'); ?></a></span>
67
+ </div></p>
68
+ </td>
69
+ <td class="column-type">
70
+ <?PHP
71
+ switch($jobvalue['type']) {
72
+ case 'DB+FILE':
73
+ _e('Database &amp; File Backup','backwpup');
74
+ break;
75
+ case 'DB':
76
+ _e('Database Backup','backwpup');
77
+ break;
78
+ case 'FILE':
79
+ _e('File Backup','backwpup');
80
+ break;
81
+ case 'OPTIMIZE':
82
+ _e('Optimize Database Tabels','backwpup');
83
+ break;
84
+ }
85
+ ?>
86
+ </td>
87
+ <td class="column-next">
88
+ <?PHP
89
+ if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
90
+ $runtime=time()-$jobvalue['starttime'];
91
+ echo __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
92
+ } elseif ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
93
+ echo date(get_option('date_format'),$time); ?><br /><?PHP echo date(get_option('time_format'),$time);
94
+ } else {
95
+ _e('Inactive','backwpup');
96
+ }
97
+ ?>
98
+ </td>
99
+ <td class="column-last">
100
+ <?PHP
101
+ if ($jobvalue['lastrun']) {
102
+ echo date(get_option('date_format'),$jobvalue['lastrun']); ?><br /><?PHP echo date(get_option('time_format'),$jobvalue['lastrun']);
103
+ $runtime=$jobvalue['stoptime']-$jobvalue['starttime'];
104
+ echo '<br />'.__('Runtime:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
105
+ } else {
106
+ _e('None','backwpup');
107
+ }
108
+ ?>
109
+ </td>
110
+ </tr>
111
+ <?PHP }}?>
112
+ </tbody>
113
+ </table>
114
+
115
+ <div class="tablenav">
116
+ <div class="alignleft actions">
117
+ <select name="action2" class="select-action">
118
+ <option value="-1" selected="selected"><?PHP _e('Bulk Actions','backwpup'); ?></option>
119
+ <option value="delete"><?PHP _e('Delete','backwpup'); ?></option>
120
+ </select>
121
+ <input type="submit" value="<?PHP _e('Apply','backwpup'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
122
+ </div>
123
+
124
+ <br class="clear" />
125
+ </div>
126
+ </form>
127
+ <br class="clear" />
128
+
129
+ <div>
backwpup.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: BackWPup
4
+ Plugin URI: http://danielhuesken.de/portfolio/backwpup/
5
+ Description: Backup and more of your WordPress Blog Database and Files.
6
+ Author: Daniel H&uuml;sken
7
+ Version: 0.5.0
8
+ Author URI: http://danielhuesken.de
9
+ Text Domain: backwpup
10
+ Domain Path: /lang/
11
+ */
12
+
13
+ /*
14
+ Copyright 2007 Daniel H�sken (email : daniel@huesken-net.de)
15
+
16
+ This program is free software; you can redistribute it and/or modify
17
+ it under the terms of the GNU General Public License as published by
18
+ the Free Software Foundation; either version 2 of the License, or
19
+ (at your option) any later version.
20
+
21
+ This program is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU General Public License for more details.
25
+
26
+ You should have received a copy of the GNU General Public License
27
+ along with this program; if not, write to the Free Software
28
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
29
+ */
30
+
31
+ /*
32
+ Change log:
33
+ Version 0.5.0: Inital test Release
34
+
35
+ */
36
+
37
+
38
+ //Set plugin dirname
39
+ define('BACKWPUP_PLUGIN_DIR', dirname(plugin_basename(__FILE__)));
40
+ //Set Plugin Version
41
+ define('BACKWPUP_VERSION', '0.5.0');
42
+
43
+ //Version check
44
+ if (version_compare($wp_version, '2.8', '<')) { // Let only Activate on WordPress Version 2.8 or heiger
45
+ add_action('admin_notices', create_function('', 'echo \'<div id="message" class="error fade"><p><strong>' . __('Sorry, BackWPup works only under WordPress 2.8 or higher','backwpup') . '</strong></p></div>\';'));
46
+ } else {
47
+ //Load functions file
48
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/functions.php');
49
+ //Plugin activate
50
+ register_activation_hook(__FILE__, array('BackWPupFunctions', 'plugin_activate')); //Don't work!!!!
51
+ //Plugin deactivate
52
+ register_deactivation_hook(__FILE__, array('BackWPupFunctions', 'plugin_deactivate'));
53
+ //Plugin uninstall
54
+ register_uninstall_hook(__FILE__, array('BackWPupFunctions', 'plugin_uninstall'));
55
+ //Plugin init
56
+ add_action('plugins_loaded', array('BackWPupFunctions', 'init'));
57
+ }
58
+ ?>
lang/backwpup.pot ADDED
@@ -0,0 +1,558 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR Daniel H&uuml;sken
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/backwpup\n"
11
+ "POT-Creation-Date: 2009-07-05 15:39+0000\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=CHARSET\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+
19
+ #: app/dojob/db.php:2
20
+ msgid "Run Database Backup..."
21
+ msgstr ""
22
+
23
+ #: app/dojob/db.php:15
24
+ msgid "Tables to Backup: "
25
+ msgstr ""
26
+
27
+ #: app/dojob/db.php:27
28
+ msgid "ERROR:"
29
+ msgstr ""
30
+
31
+ #: app/dojob/db.php:31
32
+ msgid "ERROR: No Tables to Backup"
33
+ msgstr ""
34
+
35
+ #: app/dojob/db.php:36
36
+ msgid "Database backup done!"
37
+ msgstr ""
38
+
39
+ #: app/dojob/db.php:39
40
+ msgid "Create Zip file from dump..."
41
+ msgstr ""
42
+
43
+ #: app/dojob/db.php:43
44
+ msgid "ERROR: Database Zip file create:"
45
+ msgstr ""
46
+
47
+ #: app/dojob/db.php:46
48
+ msgid "Zip file created..."
49
+ msgstr ""
50
+
51
+ #: app/dojob/destination-dir.php:2
52
+ msgid "Move Backup Zip file to Backup dir..."
53
+ msgstr ""
54
+
55
+ #: app/dojob/destination-dir.php:19
56
+ msgid "ERROR: Backup Zip file can not moved to Backup dir!!!"
57
+ msgstr ""
58
+
59
+ #: app/dojob/destination-dir.php:25
60
+ msgid "ERROR: Log file file can not moved to Backup dir!!!"
61
+ msgstr ""
62
+
63
+ #: app/dojob/destination-dir.php:33
64
+ msgid "Backup zip file saved to:"
65
+ msgstr ""
66
+
67
+ #: app/dojob/destination-dir.php:34
68
+ msgid "Backup zip filesize is"
69
+ msgstr ""
70
+
71
+ #: app/dojob/destination-dir.php:36
72
+ msgid "Log file saved to:"
73
+ msgstr ""
74
+
75
+ #: app/dojob/destination-dir.php:39
76
+ msgid "Delete old backup files..."
77
+ msgstr ""
78
+
79
+ #: app/dojob/destination-dir.php:68
80
+ msgid "Old backup files deleted!!!"
81
+ msgstr ""
82
+
83
+ #: app/dojob/destination-dir.php:69 app/dojob/optimize.php:62
84
+ msgid "Old Log files deleted!!!"
85
+ msgstr ""
86
+
87
+ #: app/dojob/destination-mail.php:3
88
+ msgid "Sendig mail..."
89
+ msgstr ""
90
+
91
+ #: app/dojob/destination-mail.php:8
92
+ msgid "WARNING: Backup Archive too big for sendig by mail"
93
+ msgstr ""
94
+
95
+ #: app/dojob/destination-mail.php:16
96
+ msgid "BackWPup Job:"
97
+ msgstr ""
98
+
99
+ #: app/dojob/destination-mail.php:17
100
+ msgid "Mail send!!!"
101
+ msgstr ""
102
+
103
+ #: app/dojob/destination-mail.php:19
104
+ msgid "ERROR: can not send mail!!!"
105
+ msgstr ""
106
+
107
+ #: app/dojob/file.php:2
108
+ msgid "Run File Backup..."
109
+ msgstr ""
110
+
111
+ #: app/dojob/file.php:4
112
+ msgid "Make File List..."
113
+ msgstr ""
114
+
115
+ #: app/dojob/file.php:68
116
+ msgid "Remove Excludes from file list..."
117
+ msgstr ""
118
+
119
+ #: app/dojob/file.php:88 app/dojob/file.php:103
120
+ msgid "ERROR: No files to Backup"
121
+ msgstr ""
122
+
123
+ #: app/dojob/file.php:109
124
+ msgid "Files to Backup: "
125
+ msgstr ""
126
+
127
+ #: app/dojob/file.php:110
128
+ msgid "Create Backup Zip file..."
129
+ msgstr ""
130
+
131
+ #: app/dojob/file.php:116
132
+ msgid "ERROR: Zip file create:"
133
+ msgstr ""
134
+
135
+ #: app/dojob/file.php:120
136
+ msgid "Add Database dump to Backup Zip file..."
137
+ msgstr ""
138
+
139
+ #: app/dojob/file.php:122
140
+ msgid "ERROR: Zip file create Add Database dump:"
141
+ msgstr ""
142
+
143
+ #: app/dojob/file.php:129
144
+ msgid "Backup Zip file create done!"
145
+ msgstr ""
146
+
147
+ #: app/dojob/optimize.php:3
148
+ msgid "Run Database optimize..."
149
+ msgstr ""
150
+
151
+ #: app/dojob/optimize.php:14
152
+ msgid "Tables to optimize: "
153
+ msgstr ""
154
+
155
+ #: app/dojob/optimize.php:20
156
+ #, php-format
157
+ msgid "ERROR: BackWPup database error %1$s for query %2$s"
158
+ msgstr ""
159
+
160
+ #: app/dojob/optimize.php:26
161
+ msgid "Database optimize done!"
162
+ msgstr ""
163
+
164
+ #: app/dojob/optimize.php:28
165
+ msgid "ERROR: No Tables to optimize"
166
+ msgstr ""
167
+
168
+ #: app/dojob/optimize.php:33
169
+ msgid "Delete old Log files..."
170
+ msgstr ""
171
+
172
+ #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
173
+ #. Plugin Name of an extension
174
+ #: app/functions.php:7 app/options.php:3
175
+ msgid "BackWPup"
176
+ msgstr ""
177
+
178
+ #: app/functions.php:15 app/functions.php:176
179
+ msgid "Support"
180
+ msgstr ""
181
+
182
+ #: app/functions.php:16 app/functions.php:175
183
+ msgid "FAQ"
184
+ msgstr ""
185
+
186
+ #: app/functions.php:17
187
+ msgid "Plugin Homepage"
188
+ msgstr ""
189
+
190
+ #: app/functions.php:18
191
+ msgid "Plugin Home on WordPress.org"
192
+ msgstr ""
193
+
194
+ #: app/functions.php:19 app/functions.php:177
195
+ msgid "Donate"
196
+ msgstr ""
197
+
198
+ #: app/functions.php:22
199
+ msgid "Version:"
200
+ msgstr ""
201
+
202
+ #: app/functions.php:23
203
+ msgid "Author:"
204
+ msgstr ""
205
+
206
+ #: app/functions.php:167
207
+ msgid "Go to Settings Page"
208
+ msgstr ""
209
+
210
+ #: app/functions.php:167 app/options.php:8
211
+ msgid "Settings"
212
+ msgstr ""
213
+
214
+ #: app/functions.php:188
215
+ msgid "BackWPup Job "
216
+ msgstr ""
217
+
218
+ #: app/options-edit.php:3
219
+ msgid "Edit BackWPup Job"
220
+ msgstr ""
221
+
222
+ #: app/options-edit.php:34
223
+ msgid "Job Type"
224
+ msgstr ""
225
+
226
+ #: app/options-edit.php:37 app/options-logs.php:65 app/options.php:73
227
+ msgid "Database &amp; File Backup"
228
+ msgstr ""
229
+
230
+ #: app/options-edit.php:38 app/options-logs.php:68 app/options.php:76
231
+ msgid "Database Backup"
232
+ msgstr ""
233
+
234
+ #: app/options-edit.php:39 app/options-logs.php:71 app/options.php:79
235
+ msgid "File Backup"
236
+ msgstr ""
237
+
238
+ #: app/options-edit.php:40 app/options-logs.php:74 app/options.php:82
239
+ msgid "Optimize Database Tabels"
240
+ msgstr ""
241
+
242
+ #: app/options-edit.php:42
243
+ msgid "Change"
244
+ msgstr ""
245
+
246
+ #: app/options-edit.php:47
247
+ msgid "Job Name"
248
+ msgstr ""
249
+
250
+ #: app/options-edit.php:53
251
+ msgid "Exclude Databas Tabels:"
252
+ msgstr ""
253
+
254
+ #: app/options-edit.php:72
255
+ msgid "Backup Blog dirs"
256
+ msgstr ""
257
+
258
+ #: app/options-edit.php:73
259
+ msgid "Blog root and WP Files"
260
+ msgstr ""
261
+
262
+ #: app/options-edit.php:74
263
+ msgid "Blog Content"
264
+ msgstr ""
265
+
266
+ #: app/options-edit.php:75
267
+ msgid "Blog Plugins"
268
+ msgstr ""
269
+
270
+ #: app/options-edit.php:79
271
+ msgid "Include extra dirs"
272
+ msgstr ""
273
+
274
+ #: app/options-edit.php:80
275
+ msgid "Separate with ,. Full Path like:"
276
+ msgstr ""
277
+
278
+ #: app/options-edit.php:84
279
+ msgid "Exclude files/dirs"
280
+ msgstr ""
281
+
282
+ #: app/options-edit.php:85
283
+ msgid "Separate with ,"
284
+ msgstr ""
285
+
286
+ #: app/options-edit.php:90
287
+ msgid "Schedule"
288
+ msgstr ""
289
+
290
+ #: app/options-edit.php:92
291
+ msgid "Run Every:"
292
+ msgstr ""
293
+
294
+ #: app/options-edit.php:102
295
+ msgid "Min(s)"
296
+ msgstr ""
297
+
298
+ #: app/options-edit.php:103
299
+ msgid "Houer(s)"
300
+ msgstr ""
301
+
302
+ #: app/options-edit.php:104
303
+ msgid "Day(s)"
304
+ msgstr ""
305
+
306
+ #: app/options-edit.php:108
307
+ msgid "Start Time:"
308
+ msgstr ""
309
+
310
+ #: app/options-edit.php:123
311
+ msgid "Start Date:"
312
+ msgstr ""
313
+
314
+ #: app/options-edit.php:129
315
+ msgid "January"
316
+ msgstr ""
317
+
318
+ #: app/options-edit.php:129
319
+ msgid "February"
320
+ msgstr ""
321
+
322
+ #: app/options-edit.php:129
323
+ msgid "March"
324
+ msgstr ""
325
+
326
+ #: app/options-edit.php:129
327
+ msgid "April"
328
+ msgstr ""
329
+
330
+ #: app/options-edit.php:129
331
+ msgid "May"
332
+ msgstr ""
333
+
334
+ #: app/options-edit.php:129
335
+ msgid "June"
336
+ msgstr ""
337
+
338
+ #: app/options-edit.php:129
339
+ msgid "July"
340
+ msgstr ""
341
+
342
+ #: app/options-edit.php:129
343
+ msgid "August"
344
+ msgstr ""
345
+
346
+ #: app/options-edit.php:129
347
+ msgid "September"
348
+ msgstr ""
349
+
350
+ #: app/options-edit.php:129
351
+ msgid "October"
352
+ msgstr ""
353
+
354
+ #: app/options-edit.php:129
355
+ msgid "November"
356
+ msgstr ""
357
+
358
+ #: app/options-edit.php:129
359
+ msgid "December"
360
+ msgstr ""
361
+
362
+ #: app/options-edit.php:142
363
+ msgid "Activate:"
364
+ msgstr ""
365
+
366
+ #: app/options-edit.php:150
367
+ msgid "Backup to Directory"
368
+ msgstr ""
369
+
370
+ #: app/options-edit.php:151
371
+ msgid "Full Phath of Directory for Backup fiels"
372
+ msgstr ""
373
+
374
+ #: app/options-edit.php:154
375
+ msgid "Max number of Backup Files"
376
+ msgstr ""
377
+
378
+ #: app/options-edit.php:158
379
+ msgid "Off"
380
+ msgstr ""
381
+
382
+ #: app/options-edit.php:163
383
+ msgid "Oldest files will deletet first."
384
+ msgstr ""
385
+
386
+ #: app/options-edit.php:171
387
+ msgid "Send Mail to"
388
+ msgstr ""
389
+
390
+ #: app/options-edit.php:177 app/options-settings.php:24
391
+ msgid "Save Changes"
392
+ msgstr ""
393
+
394
+ #: app/options-logs.php:3
395
+ msgid "BackWPup Logs"
396
+ msgstr ""
397
+
398
+ #: app/options-logs.php:17 app/options-logs.php:117 app/options.php:18
399
+ #: app/options.php:118
400
+ msgid "Bulk Actions"
401
+ msgstr ""
402
+
403
+ #: app/options-logs.php:18 app/options-logs.php:88 app/options-logs.php:118
404
+ #: app/options.php:19 app/options.php:64 app/options.php:119
405
+ msgid "Delete"
406
+ msgstr ""
407
+
408
+ #: app/options-logs.php:20 app/options-logs.php:120 app/options.php:21
409
+ #: app/options.php:121
410
+ msgid "Apply"
411
+ msgstr ""
412
+
413
+ #: app/options-logs.php:32 app/options-logs.php:43
414
+ msgid "Job"
415
+ msgstr ""
416
+
417
+ #: app/options-logs.php:33 app/options-logs.php:44 app/options.php:35
418
+ #: app/options.php:46
419
+ msgid "Type"
420
+ msgstr ""
421
+
422
+ #: app/options-logs.php:34 app/options-logs.php:45
423
+ msgid "Backup/Log"
424
+ msgstr ""
425
+
426
+ #: app/options-logs.php:35 app/options-logs.php:46
427
+ msgid "Size"
428
+ msgstr ""
429
+
430
+ #: app/options-logs.php:36 app/options-logs.php:47
431
+ msgid "Log Date"
432
+ msgstr ""
433
+
434
+ #: app/options-logs.php:85
435
+ msgid "View log"
436
+ msgstr ""
437
+
438
+ #: app/options-logs.php:85
439
+ msgid "ERROR"
440
+ msgstr ""
441
+
442
+ #: app/options-logs.php:85
443
+ msgid "OK"
444
+ msgstr ""
445
+
446
+ #: app/options-logs.php:87
447
+ msgid "View"
448
+ msgstr ""
449
+
450
+ #: app/options-logs.php:88 app/options.php:64
451
+ msgid ""
452
+ "You are about to delete this Job. \n"
453
+ " 'Cancel' to stop, 'OK' to delete."
454
+ msgstr ""
455
+
456
+ #: app/options-logs.php:90
457
+ msgid "Download"
458
+ msgstr ""
459
+
460
+ #: app/options-logs.php:99
461
+ msgid "only Log"
462
+ msgstr ""
463
+
464
+ #: app/options-logs.php:106 app/options.php:104
465
+ msgid "Runtime:"
466
+ msgstr ""
467
+
468
+ #: app/options-logs.php:106 app/options.php:91 app/options.php:104
469
+ msgid "sec."
470
+ msgstr ""
471
+
472
+ #: app/options-runnow.php:3
473
+ msgid "BackWPup Job Running"
474
+ msgstr ""
475
+
476
+ #: app/options-save.php:34
477
+ msgid "Copy of"
478
+ msgstr ""
479
+
480
+ #: app/options-save.php:60
481
+ msgid "File does not exist."
482
+ msgstr ""
483
+
484
+ #: app/options-settings.php:3
485
+ msgid "BackWPup Settings"
486
+ msgstr ""
487
+
488
+ #: app/options-settings.php:17
489
+ msgid "Temp Directory:"
490
+ msgstr ""
491
+
492
+ #: app/options-settings.php:18
493
+ msgid "Full Phath of Temp Directory"
494
+ msgstr ""
495
+
496
+ #: app/options-view_log.php:3
497
+ msgid "BackWPup View Log"
498
+ msgstr ""
499
+
500
+ #: app/options.php:3
501
+ msgid "Add New"
502
+ msgstr ""
503
+
504
+ #: app/options.php:6
505
+ msgid "Jobs"
506
+ msgstr ""
507
+
508
+ #: app/options.php:7
509
+ msgid "Logs"
510
+ msgstr ""
511
+
512
+ #: app/options.php:33 app/options.php:44
513
+ msgid "ID"
514
+ msgstr ""
515
+
516
+ #: app/options.php:34 app/options.php:45
517
+ msgid "Name"
518
+ msgstr ""
519
+
520
+ #: app/options.php:36 app/options.php:47
521
+ msgid "Next Run"
522
+ msgstr ""
523
+
524
+ #: app/options.php:37 app/options.php:48
525
+ msgid "Last Run"
526
+ msgstr ""
527
+
528
+ #: app/options.php:61
529
+ msgid "Edit:"
530
+ msgstr ""
531
+
532
+ #: app/options.php:63
533
+ msgid "Edit"
534
+ msgstr ""
535
+
536
+ #: app/options.php:65
537
+ msgid "Copy"
538
+ msgstr ""
539
+
540
+ #: app/options.php:66
541
+ msgid "Run Now"
542
+ msgstr ""
543
+
544
+ #: app/options.php:91
545
+ msgid "Running since:"
546
+ msgstr ""
547
+
548
+ #: app/options.php:95
549
+ msgid "Inactive"
550
+ msgstr ""
551
+
552
+ #: app/options.php:106
553
+ msgid "None"
554
+ msgstr ""
555
+
556
+ #: backwpup.php:45
557
+ msgid "Sorry, BackWPup works only under WordPress 2.8 or higher"
558
+ msgstr ""
readme.txt ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === BackWPup ===
2
+ Contributors: danielhuesken
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8
4
+ Tags: backup, admin, file, Database, mysql
5
+ Requires at least: 2.8
6
+ Tested up to: 2.8.1
7
+ Stable tag: 0.5.0
8
+
9
+ Backup and more of your WordPress Blog Database and Files
10
+
11
+ == Description ==
12
+
13
+ This Plugin is under heavy Development. Pleace test it and give feadback!!!.
14
+
15
+ Backup and more your Blog.
16
+
17
+ * Dateabase Backup
18
+ * Optimize Dateabase
19
+ * File Backup
20
+ * Uses PCLZIP class of Wordpress
21
+
22
+
23
+ I can give no WARRANTY to any backups
24
+
25
+ == Installation ==
26
+
27
+ 1. Download BackWPup Plugin.
28
+ 1. Decompress and upload the contents of the archive into /wp-content/plugins/.
29
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
30
+
31
+ == Frequently Asked Questions ==
32
+
33
+ = Where ist the Database dum on DB+File backup =
34
+
35
+ in the root folder of the zip Archive. <i>DBName</i>.sql
36
+
37
+ = Import with phpMyAdmin =
38
+
39
+ You must import the Database Dump with Charaktercoding:latin1
40
+
41
+
42
+ == Screenshots ==
43
+
44
+ 1. Job Page
screenshot-1.png ADDED
Binary file