BackWPup – WordPress Backup Plugin - Version 0.6.0

Version Description

dev.= * Add Dashboard Widget * Add Database Check * Add Backup file transfer to FTP Server * Save log fieles in own database table * Optimize Memory usage * Optimize File system access * DB dump with own function * fixed some Bugs

Download this release

Release Info

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

Code changes from version 0.5.5 to 0.6.0

app/css/options.css CHANGED
@@ -5,7 +5,7 @@
5
  width:100px;
6
  }
7
  .column-type {
8
- width:130px;
9
  }
10
  .column-size {
11
  width:75px;
5
  width:100px;
6
  }
7
  .column-type {
8
+ width:120px;
9
  }
10
  .column-size {
11
  width:75px;
app/dojob/MySQLDBExport.class.php DELETED
@@ -1,295 +0,0 @@
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 CHANGED
@@ -2,33 +2,27 @@
2
  //Delete old Logs/Backupfiles
3
  if (!empty($jobs[$jobid]['maxbackups'])) {
4
  BackWPupFunctions::joblog($logtime,__('Delete old backup files...','backwpup'));
5
- $logs=get_option('backwpup_log');
6
  if (is_array($logs)) {
7
- unset($logkeys);
8
- foreach ($logs as $timestamp => $logdata) {
9
- if ($logdata['jobid']==$jobid)
10
- $logkeys[]=$timestamp;
11
- }
12
- if (is_array($logkeys)) {
13
- rsort($logkeys,SORT_NUMERIC);
14
- $counter=0;$countdelbackups=0;
15
- for ($i=0;$i<sizeof($logkeys);$i++) {
16
- if (!empty($logs[$logkeys[$i]]['backupfile']) or in_array($jobs[$jobid]['type'],$logonlytyps))
17
- $counter++;
18
- if ($counter>=$jobs[$jobid]['maxbackups']) {
19
- if (is_file($logs[$logkeys[$i]]['backupfile'])) {
20
- unlink($logs[$logkeys[$i]]['backupfile']);
21
- $countdelbackups++;
22
- }
23
- unset($logs[$logkeys[$i]]);
24
  }
 
 
25
  }
26
  }
27
  }
28
- update_option('backwpup_log',$logs);
29
- BackWPupFunctions::joblog($logtime,$countdelbackups.' '.__('Old backup files deleted!!!','backwpup'));
 
 
30
  //clean vars
31
- unset($logkeys);
32
  unset($logs);
33
  }
34
 
@@ -40,7 +34,8 @@ if (is_file($backupfile)) {
40
  if (is_file(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql') ) { //delete sql temp file
41
  unlink(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql');
42
  }
43
- if (empty($jobs[$jobid]['backupdir']) and ($backupfile!=BackWPupFunctions::get_temp_dir().'backwpup'.$backupfilename) and is_file($backupfile) ) { //delete backup file in temp dir
 
44
  unlink($backupfile);
45
  unset($backupfile);
46
  }
@@ -51,10 +46,7 @@ $jobs[$jobid]['lastrun']=$jobs[$jobid]['starttime'];
51
  $jobs[$jobid]['lastruntime']=$jobs[$jobid]['stoptime']-$jobs[$jobid]['starttime'];
52
  $jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
53
  update_option('backwpup_jobs',$jobs); //Save Settings
54
-
55
- $logs=get_option('backwpup_log');
56
- $logs[$logtime]['worktime']=$jobs[$jobid]['stoptime']-$jobs[$jobid]['starttime'];
57
- if (is_file($backupfile))
58
- $logs[$logtime]['backupfile']=$backupfile;
59
- update_option('backwpup_log',$logs);
60
  ?>
2
  //Delete old Logs/Backupfiles
3
  if (!empty($jobs[$jobid]['maxbackups'])) {
4
  BackWPupFunctions::joblog($logtime,__('Delete old backup files...','backwpup'));
5
+ $logs=$wpdb->get_results("SELECT * FROM ".$wpdb->backwpup_logs." ORDER BY logtime DESC", ARRAY_A);
6
  if (is_array($logs)) {
7
+ $counter=0;$countdelbackups=0;$countdellogs=0;
8
+ for ($i=0;$i<sizeof($logs);$i++) {
9
+ if (!empty($logs[$i]['backupfile']) or in_array($jobs[$jobid]['type'],$logonlytyps))
10
+ $counter++;
11
+ if ($counter>=$jobs[$jobid]['maxbackups']) {
12
+ if (is_file($logs[$i]['backupfile'])) {
13
+ unlink($logs[$i]['backupfile']);
14
+ $countdelbackups++;
 
 
 
 
 
 
 
 
 
15
  }
16
+ $wpdb->query("DELETE FROM ".$wpdb->backwpup_logs." WHERE logtime=".$logs[$i]['logtime']);
17
+ $countdellogs++;
18
  }
19
  }
20
  }
21
+ if ($countdelbackups>0)
22
+ BackWPupFunctions::joblog($logtime,$countdelbackups.' '.__('old backup files deleted!!!','backwpup'));
23
+ if ($countdellogs>0)
24
+ BackWPupFunctions::joblog($logtime,$countdellogs.' '.__('old logs deleted!!!','backwpup'));
25
  //clean vars
 
26
  unset($logs);
27
  }
28
 
34
  if (is_file(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql') ) { //delete sql temp file
35
  unlink(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql');
36
  }
37
+
38
+ if (empty($jobs[$jobid]['backupdir']) and (dirname($backupfile)!=BackWPupFunctions::get_temp_dir().'backwpup') and is_file($backupfile) ) { //delete backup file in temp dir
39
  unlink($backupfile);
40
  unset($backupfile);
41
  }
46
  $jobs[$jobid]['lastruntime']=$jobs[$jobid]['stoptime']-$jobs[$jobid]['starttime'];
47
  $jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
48
  update_option('backwpup_jobs',$jobs); //Save Settings
49
+ //Write backupfile und worktime to log
50
+ $wpdb->update( $wpdb->backwpup_logs, array( 'worktime' => $jobs[$jobid]['lastruntime'], 'backupfile' => mysql_real_escape_string($backupfile)), array( 'logtime' => $logtime ));
51
+ ob_end_flush();
 
 
 
52
  ?>
app/dojob/bevore.php CHANGED
@@ -1,44 +1,51 @@
1
  <?php
 
 
 
 
 
 
 
2
  $cfg=get_option('backwpup');
3
  $jobs=get_option('backwpup_jobs');
4
- $jobs[$jobid]['starttime']=time();
 
5
  $jobs[$jobid]['stoptime']='';
6
  $jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
7
  update_option('backwpup_jobs',$jobs); //Save Settings
8
- $logtime=$jobs[$jobid]['starttime'];
9
- $backupfilename='/backwpup_'.$jobid.'_'.date('Y-m-d_H-i-s',$jobs[$jobid]['starttime']).'.zip';
10
- if (!empty($jobs[$jobid]['backupdir'])) {
11
- $backupfile=$jobs[$jobid]['backupdir'].$backupfilename;
 
 
12
  } else {
13
- $backupfile=BackWPupFunctions::get_temp_dir().'backwpup'.$backupfilename;
14
  }
15
- $logonlytyps=array('OPTIMIZE');
16
  if (in_array($jobs[$jobid]['type'],$logonlytyps)) {
17
  $jobs[$jobid]['maxbackups']=20;
18
  }
19
 
20
  //Create Log
21
- $logs=get_option('backwpup_log');
22
- $logs[$logtime]['jobid']=$jobid;
23
- $logs[$logtime]['error']=0;
24
- $logs[$logtime]['warning']=0;
25
- $logs[$logtime]['log']='';
26
- $logs[$logtime]['type']=$jobs[$jobid]['type'];
27
- update_option('backwpup_log',$logs);
28
 
29
- if (!ini_get('safe_mode') or strtolower(ini_get('safe_mode'))=='off') {
30
  set_time_limit(300); //300 is most webserver time limit.
31
  } else {
32
- BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.sprintf(__('Safe Mode is on!!! Max exec time is %1$s sec.','backwpup'),ini_get('max_execution_time')));
33
  }
34
 
35
  //Look for and Crate Temp dir and secure
 
 
36
  if (!is_dir(BackWPupFunctions::get_temp_dir().'backwpup')) {
37
- if (!mkdir(BackWPupFunctions::get_temp_dir().'backwpup')) {
38
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not create Temp dir','backwpup'));
39
  require_once('after.php');
40
  return false;
41
- }
42
  }
43
  if (!is_writeable(BackWPupFunctions::get_temp_dir().'backwpup')) {
44
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not write to Temp dir','backwpup'));
@@ -62,7 +69,7 @@ if (!is_file(BackWPupFunctions::get_temp_dir().'backwpup/index.html')) {
62
  if (!empty($backupfile)) {
63
  //Look for and Crate Backup dir and secure
64
  if (!is_dir($jobs[$jobid]['backupdir'])) {
65
- if (!mkdir($jobs[$jobid]['backupdir'])) {
66
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not create Backup dir','backwpup'));
67
  require_once('after.php');
68
  return false;
1
  <?php
2
+ global $logtime;
3
+ //@ini_set('memory_limit', '256M');
4
+ ignore_user_abort(true);
5
+ ob_start();
6
+ ob_end_clean();
7
+
8
+ define( 'PCLZIP_TEMPORARY_DIR', BackWPupFunctions::get_temp_dir().'backwpup/' );
9
  $cfg=get_option('backwpup');
10
  $jobs=get_option('backwpup_jobs');
11
+ $logtime=time();
12
+ $jobs[$jobid]['starttime']=$logtime;
13
  $jobs[$jobid]['stoptime']='';
14
  $jobs[$jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid));
15
  update_option('backwpup_jobs',$jobs); //Save Settings
16
+ if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB+FILE' or $jobs[$jobid]['type']=='DB') {
17
+ if (!empty($jobs[$jobid]['backupdir'])) {
18
+ $backupfile=$jobs[$jobid]['backupdir'].'/backwpup_'.$jobid.'_'.date('Y-m-d_H-i-s',$jobs[$jobid]['starttime']).'.zip';
19
+ } else {
20
+ $backupfile=BackWPupFunctions::get_temp_dir().'backwpup/backwpup_'.$jobid.'_'.date('Y-m-d_H-i-s',$jobs[$jobid]['starttime']).'.zip';
21
+ }
22
  } else {
23
+ $backupfile='';
24
  }
25
+ $logonlytyps=array('OPTIMIZE','CHECK');
26
  if (in_array($jobs[$jobid]['type'],$logonlytyps)) {
27
  $jobs[$jobid]['maxbackups']=20;
28
  }
29
 
30
  //Create Log
31
+ $wpdb->insert( $wpdb->backwpup_logs, array( 'logtime' => $logtime, 'jobid' => $jobid, 'jobname' => $jobs[$jobid]['name'], 'type' => $jobs[$jobid]['type'], 'log' => '' ));
32
+
 
 
 
 
 
33
 
34
+ if (!ini_get('safe_mode') or strtolower(ini_get('safe_mode'))=='off' or ini_get('safe_mode')=='0') {
35
  set_time_limit(300); //300 is most webserver time limit.
36
  } else {
37
+ BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.sprintf(__('PHP Safe Mode is on!!! Max exec time is %1$s sec.','backwpup'),ini_get('max_execution_time')));
38
  }
39
 
40
  //Look for and Crate Temp dir and secure
41
+ BackWPupFunctions::joblog($logtime,sprintf(__('Temp dir is %1$s.','backwpup'),get_temp_dir().'backwpup'));
42
+
43
  if (!is_dir(BackWPupFunctions::get_temp_dir().'backwpup')) {
44
+ if (!mkdir(BackWPupFunctions::get_temp_dir().'backwpup',0777,true)) {
45
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not create Temp dir','backwpup'));
46
  require_once('after.php');
47
  return false;
48
+ }
49
  }
50
  if (!is_writeable(BackWPupFunctions::get_temp_dir().'backwpup')) {
51
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not write to Temp dir','backwpup'));
69
  if (!empty($backupfile)) {
70
  //Look for and Crate Backup dir and secure
71
  if (!is_dir($jobs[$jobid]['backupdir'])) {
72
+ if (!mkdir($jobs[$jobid]['backupdir'],0777,true)) {
73
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not create Backup dir','backwpup'));
74
  require_once('after.php');
75
  return false;
app/dojob/check.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?PHP
2
+ //Optimize SQL Table
3
+ BackWPupFunctions::joblog($logtime,__('Run Database check...','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
+ foreach ($tables as $table) {
15
+ if (!in_array($table,(array)$jobs[$jobid]['dbexclude'])) {
16
+ $check=$wpdb->get_row('CHECK TABLE `'.$table.'` MEDIUM', ARRAY_A);
17
+ BackWPupFunctions::joblog($logtime,__(strtoupper($check['Msg_type']).':','backwpup').' '.sprintf(__('Result of table check for %1$s is: %2$s','backwpup'), $table, $check['Msg_text']));
18
+ if ($sqlerr=mysql_error($wpdb->dbh))
19
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
20
+ if ($check['Msg_type']=='error') {
21
+ $repair=$wpdb->get_row('REPAIR TABLE `'.$table.'`', ARRAY_A);
22
+ BackWPupFunctions::joblog($logtime,__(strtoupper($repair['Msg_type']).':','backwpup').' '.sprintf(__('Result of table repair for %1$s is: %2$s ','backwpup'), $table, $repair['Msg_text']));
23
+ if ($sqlerr=mysql_error($wpdb->dbh))
24
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
25
+ }
26
+ }
27
+ }
28
+ $wpdb->flush();
29
+ BackWPupFunctions::joblog($logtime,__('Database check done!','backwpup'));
30
+ } else {
31
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('No Tables to check','backwpup'));
32
+ }
33
+ ?>
app/dojob/db.php CHANGED
@@ -1,9 +1,72 @@
1
  <?PHP
2
  BackWPupFunctions::joblog($logtime,__('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']))
@@ -12,35 +75,73 @@ if (is_array($jobs[$jobid]['dbexclude'])) {
12
  }
13
 
14
  if (sizeof($tables)>0) {
15
- BackWPupFunctions::joblog($logtime,__('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(BackWPupFunctions::get_temp_dir().'backwpup/'.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($logtime,__('ERROR:','backwpup').' '.$error);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
  } else {
30
- BackWPupFunctions::joblog($logtime,__('ERROR: No Tables to Backup','backwpup'));
31
  }
32
 
33
 
34
  BackWPupFunctions::joblog($logtime,__('Database backup done!','backwpup'));
35
 
36
  if ($jobs[$jobid]['type']=='DB' and is_file(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql')) {
 
37
  BackWPupFunctions::joblog($logtime,__('Create Zip file from dump...','backwpup'));
38
- require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
39
  $zipbackupfile = new PclZip($backupfile);
40
- if (0==$zipbackupfile -> create(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql',PCLZIP_OPT_REMOVE_PATH,BackWPupFunctions::get_temp_dir().'backwpup')) {
41
- BackWPupFunctions::joblog($logtime,__('ERROR: Database Zip file create:','backwpup').' '.$zipbackupfile->errorInfo(true));
42
  $joberror=true;
43
- }
44
  BackWPupFunctions::joblog($logtime,__('Zip file created...','backwpup'));
45
  }
46
  //clean vars
1
  <?PHP
2
  BackWPupFunctions::joblog($logtime,__('Run Database Backup...','backwpup'));
3
 
4
+ function dump_table($table,$status) {
5
+ global $wpdb,$logtime;
6
+ $table = str_replace("�", "��", $table); //esc table name
7
+
8
+ // create dump
9
+ $dump = "\n";
10
+ $dump.= "--\n";
11
+ $dump.= "-- Table structure for table $table\n";
12
+ $dump.= "--\n\n";
13
+ $dump.= "DROP TABLE IF EXISTS `" . $table . "`;\n";
14
+ $dump.= "/*!40101 SET @saved_cs_client = @@character_set_client */;\n";
15
+ $dump.= "/*!40101 SET character_set_client = latin1 */;\n";
16
+ //Dump the table structure
17
+ $result=$wpdb->get_row("SHOW CREATE TABLE `".$table."`", ARRAY_A);
18
+ if ($sqlerr=mysql_error($wpdb->dbh)) {
19
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
20
+ return false;
21
+ }
22
+ $dump.=$result['Create Table']."\n";
23
+ $dump.="/*!40101 SET character_set_client = @saved_cs_client */;\n";
24
+ $wpdb->flush();
25
+
26
+ //take data of table
27
+ $result=$wpdb->get_results("SELECT * FROM `".$table."`", ARRAY_A);
28
+ if ($sqlerr=mysql_error($wpdb->dbh)) {
29
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
30
+ return false;
31
+ }
32
+ if (is_array($result)) {
33
+ $dump.= "--\n";
34
+ $dump.= "-- Dumping data for table $table\n";
35
+ $dump.= "--\n\n";
36
+ $dump.= "LOCK TABLES `".$table."` WRITE;\n\n";
37
+ if ($status['Engine']=='MyISAM')
38
+ $dump.= "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n";
39
+ foreach($result as $data) {
40
+ $keys = array();
41
+ $values = array();
42
+ foreach($data as $key => $value) {
43
+ $keys[] = "`".str_replace("�", "��", $key)."`"; // Add key to key list
44
+
45
+ if($value === NULL) // Make Value NULL to string NULL
46
+ $value = "NULL";
47
+ elseif($value === "" or $value === false) // if empty or false Value make "" as Value
48
+ $value = '""';
49
+ elseif(!is_numeric($value)) //is value not numeric esc
50
+ $value = "\"".mysql_real_escape_string($value)."\"";
51
+
52
+ $values[] = $value;
53
+ }
54
+ // make data dump
55
+ $dump .= "INSERT INTO `".$table."` ( ".implode(", ",$keys)." )\n\tVALUES ( ".implode(", ",$values)." );\n";
56
+ }
57
+ if ($status['Engine']=='MyISAM')
58
+ $dump.= "/*!40000 ALTER TABLE ".$table." ENABLE KEYS */;\n";
59
+ $dump.= "UNLOCK TABLES;\n";
60
+ }
61
+ $wpdb->flush();
62
+ return $dump;
63
+ }
64
+
65
+
66
+
67
  //Tables to backup
68
  $tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
69
+ $jobs[$jobid]['dbexclude'][]=$wpdb->backwpup_logs; //Exclude log table
70
  if (is_array($jobs[$jobid]['dbexclude'])) {
71
  foreach($tables as $tablekey => $tablevalue) {
72
  if (in_array($tablevalue,$jobs[$jobid]['dbexclude']))
75
  }
76
 
77
  if (sizeof($tables)>0) {
78
+ $result=$wpdb->get_results("SHOW TABLE STATUS FROM `".DB_NAME."`;", ARRAY_A); //get table status
79
+ if ($sqlerr=mysql_error($wpdb->dbh))
80
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
81
+ foreach($result as $statusdata) {
82
+ $status[$statusdata['Name']]=$statusdata;
83
+ }
 
 
 
 
84
 
85
+ if ($file = @fopen(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql', 'w')) {
86
+ fwrite($file, "-- ---------------------------------------------------------\n");
87
+ fwrite($file, "-- Dump with BackWPup ver.: ".BACKWPUP_VERSION."\n");
88
+ fwrite($file, "-- Plugin for WordPress by Daniel Huesken\n");
89
+ fwrite($file, "-- http://danielhuesken.de/portfolio/backwpup/\n");
90
+ fwrite($file, "-- Blog Name: ".get_option('blogname')."\n");
91
+ if (defined('WP_SITEURL'))
92
+ fwrite($file, "-- Blog URL: ".trailingslashit(WP_SITEURL)."\n");
93
+ else
94
+ fwrite($file, "-- Blog URL: ".trailingslashit(get_option('siteurl'))."\n");
95
+ fwrite($file, "-- Blog ABSPATH: ".trailingslashit(ABSPATH)."\n");
96
+ fwrite($file, "-- Database Name: ".DB_NAME."\n");
97
+ fwrite($file, "-- Dump on: ".date('Y-m-d H:i:s')."\n");
98
+ fwrite($file, "-- ---------------------------------------------------------\n\n");
99
+ //for better import with mysql client
100
+ fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n");
101
+ fwrite($file, "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */\n");
102
+ fwrite($file, "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n");
103
+ fwrite($file, "/*!40101 SET NAMES latin1 */;\n");
104
+ fwrite($file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n");
105
+ //fwrite($file, "/*!40103 SET TIME_ZONE='+00:00' */;\n");
106
+ fwrite($file, "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n");
107
+ fwrite($file, "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n");
108
+ fwrite($file, "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n");
109
+ fwrite($file, "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n\n");
110
+ //make table dumps
111
+ foreach($tables as $table) {
112
+ BackWPupFunctions::joblog($logtime,__('Database table to Backup: ','backwpup').' '.$table);
113
+ BackWPupFunctions::needfreememory(($status[$table]['Data_length']+$status[$table]['Index_length'])*2); //get mor memory if needed
114
+ fwrite($file, dump_table($table,$status[$table]));
115
+ }
116
+ //for better import with mysql client
117
+ fwrite($file, "\n");
118
+ fwrite($file, "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;\n");
119
+ fwrite($file, "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n");
120
+ fwrite($file, "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n");
121
+ fwrite($file, "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n");
122
+ fwrite($file, "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n");
123
+ fwrite($file, "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n");
124
+ fwrite($file, "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
125
+ fwrite($file, "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n");
126
+ fclose($file);
127
+ } else {
128
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not create Database Backup file','backwpup'));
129
  }
130
  } else {
131
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('No Tables to Backup','backwpup'));
132
  }
133
 
134
 
135
  BackWPupFunctions::joblog($logtime,__('Database backup done!','backwpup'));
136
 
137
  if ($jobs[$jobid]['type']=='DB' and is_file(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql')) {
138
+ BackWPupFunctions::joblog($logtime,__('Database file size:','backwpup').' '.BackWPupFunctions::formatBytes(filesize(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql')));
139
  BackWPupFunctions::joblog($logtime,__('Create Zip file from dump...','backwpup'));
 
140
  $zipbackupfile = new PclZip($backupfile);
141
+ if (0==$zipbackupfile -> create(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql',PCLZIP_OPT_REMOVE_ALL_PATH,PCLZIP_OPT_ADD_TEMP_FILE_ON)) {
142
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Database Zip file create:','backwpup').' '.$zipbackupfile->errorInfo(true));
143
  $joberror=true;
144
+ }
145
  BackWPupFunctions::joblog($logtime,__('Zip file created...','backwpup'));
146
  }
147
  //clean vars
app/dojob/destination-ftp.php CHANGED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!empty($jobs[$jobid]['ftphost']) and !empty($jobs[$jobid]['ftpuser']) and !empty($jobs[$jobid]['ftppass'])) {
3
+ $ftpport=21;
4
+ $ftphost=$jobs[$jobid]['ftphost'];
5
+ if (false !== strpos($jobs[$jobid]['ftphost'],':')) //look for port
6
+ list($ftphost,$ftpport)=split(':',$jobs[$jobid]['ftphost'],2);
7
+
8
+ if (function_exists('ftp_ssl_connect')) { //make SSL FTP connection
9
+ $ftp_conn_id = @ftp_ssl_connect($ftphost,$ftpport);
10
+ if ($ftp_conn_id)
11
+ BackWPupFunctions::joblog($logtime,__('Connected by SSL to FTP server:','backwpup').' '.$jobs[$jobid]['ftphost']);
12
+ }
13
+ if (!$ftp_conn_id) { //make normal FTP conection if SSL not work
14
+ $ftp_conn_id = @ftp_connect($ftphost,$ftpport);
15
+ if ($ftp_conn_id)
16
+ BackWPupFunctions::joblog($logtime,__('Connected insecure to FTP server:','backwpup').' '.$jobs[$jobid]['ftphost']);
17
+ }
18
+
19
+ if ($ftp_conn_id) {
20
+ if ($login_result = @ftp_login($ftp_conn_id, $jobs[$jobid]['ftpuser'], $jobs[$jobid]['ftppass'])) {
21
+ BackWPupFunctions::joblog($logtime,__('Logt on to FTP server with user:','backwpup').' '.$jobs[$jobid]['ftpuser']);
22
+
23
+ if (@ftp_pasv($ftp_conn_id, true)) //set passive mode
24
+ BackWPupFunctions::joblog($logtime,__('FTP set to passiv.','backwpup'));
25
+ else
26
+ BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.__('Can not set FTP Server to passiv!','backwpup'));
27
+
28
+ if (@ftp_alloc($ftp_conn_id, filesize($backupfile), $result)) //allocate file spase on ftp server
29
+ BackWPupFunctions::joblog($logtime,__('Space successfully allocated on FTP server. Sending backup file.','backwpup'));
30
+ else
31
+ BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.__('Unable to allocate space on server. FTP Server said:','backwpup').' '.$result);
32
+
33
+ if (@ftp_put($ftp_conn_id, trailingslashit($jobs[$jobid]['ftpdir']).basename($backupfile), $backupfile, FTP_BINARY)) { //transvere file
34
+ BackWPupFunctions::joblog($logtime,__('Backup File transfered to FTP Server:','backwpup').' '.trailingslashit($jobs[$jobid]['ftpdir']).basename($backupfile));
35
+ } else {
36
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not tranfer backup to FTP server.','backwpup'));
37
+ }
38
+ if ($jobs[$jobid]['ftpmaxbackups']>0) { //Delete old backups
39
+ if ($filelist=ftp_nlist($ftp_conn_id, trailingslashit($jobs[$jobid]['ftpdir']))) {
40
+ foreach($filelist as $files) {
41
+ if (!in_array(basename($files),array('.','..')) and false !== strpos(basename($files),'backwpup_'.$jobid.'_'))
42
+ $backupfilelist[]=basename($files);
43
+ }
44
+ rsort($backupfilelist);
45
+ $numdeltefiles=0;
46
+ for ($i=$jobs[$jobid]['ftpmaxbackups'];$i<sizeof($backupfilelist);$i++) {
47
+ if (ftp_delete($ftp_conn_id, trailingslashit($jobs[$jobid]['ftpdir']).$backupfilelist[$i])) //delte files on ftp
48
+ $numdeltefiles++;
49
+ else
50
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not delete file on FTP Server:','backwpup').' '.trailingslashit($jobs[$jobid]['ftpdir']).$backupfilelist[$i]);
51
+ }
52
+ if ($numdeltefiles>0)
53
+ BackWPupFunctions::joblog($logtime,$numdeltefiles.' '.__('files deleted on FTP Server:','backwpup'));
54
+ }
55
+ }
56
+ } else {
57
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not login to FTP server with user:','backwpup').' '.$jobs[$jobid]['ftpuser']);
58
+ }
59
+ ftp_close($ftp_conn_id);
60
+ } else {
61
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not connect to FTP server:','backwpup').' '.$jobs[$jobid]['ftphost']);
62
+ }
63
+ }
64
+ ?>
app/dojob/destination-mail.php CHANGED
@@ -2,19 +2,22 @@
2
  if (!empty($jobs[$jobid]['mailaddress'])) {
3
  BackWPupFunctions::joblog($logtime,__('Sendig mail...','backwpup'));
4
  if (is_file($backupfile)) {
5
- if (filesize($backupfile)<5242880) {
6
- $mailfiles=$backupfile;
 
 
 
 
7
  } else {
8
  if (!empty($jobs[$jobid]['backupdir'])) {
9
  BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.__('Backup Archive too big for sendig by mail','backwpup'));
10
  } else {
11
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Backup Archive too big for sendig by mail','backwpup'));
12
  }
13
- $mailfiles='';
14
  }
15
  }
16
- $logs=get_option('backwpup_log');
17
- if (wp_mail($jobs[$jobid]['mailaddress'],__('BackWPup Job:','backwpup').' '.$jobs[$jobid]['name'],$logs[$logtime]['log'],'',$mailfiles)) {
18
  BackWPupFunctions::joblog($logtime,__('Mail send!!!','backwpup'));
19
  } else {
20
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not send mail!!!','backwpup'));
@@ -22,5 +25,4 @@ if (!empty($jobs[$jobid]['mailaddress'])) {
22
  }
23
  //clean vars
24
  unset($mailfiles);
25
- unset($message);
26
  ?>
2
  if (!empty($jobs[$jobid]['mailaddress'])) {
3
  BackWPupFunctions::joblog($logtime,__('Sendig mail...','backwpup'));
4
  if (is_file($backupfile)) {
5
+ if (filesize($backupfile)<20971520) {
6
+ $mailfiles[0]=$backupfile;
7
+ if (!BackWPupFunctions::needfreememory(filesize($backupfile)*3+33554432)) {
8
+ BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Out of Memory for sending Backup Archive by mail','backwpup'));
9
+ unset($mailfiles);
10
+ }
11
  } else {
12
  if (!empty($jobs[$jobid]['backupdir'])) {
13
  BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.__('Backup Archive too big for sendig by mail','backwpup'));
14
  } else {
15
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Backup Archive too big for sendig by mail','backwpup'));
16
  }
17
+ unset($mailfiles);
18
  }
19
  }
20
+ if (wp_mail($jobs[$jobid]['mailaddress'],__('BackWPup Job:','backwpup').' '.$jobs[$jobid]['name'],$wpdb->get_var("SELECT log FROM ".$wpdb->backwpup_logs." WHERE logtime=".$logtime),'',$mailfiles)) {
 
21
  BackWPupFunctions::joblog($logtime,__('Mail send!!!','backwpup'));
22
  } else {
23
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Can not send mail!!!','backwpup'));
25
  }
26
  //clean vars
27
  unset($mailfiles);
 
28
  ?>
app/dojob/file.php CHANGED
@@ -1,110 +1,107 @@
1
  <?PHP
2
- BackWPupFunctions::joblog($logtime,__('Run File Backup...','backwpup'));
3
- BackWPupFunctions::joblog($logtime,__('Make File List...','backwpup'));
4
-
5
- //Make filelist
6
- if ($jobs[$jobid]['backuproot']) {
7
- $filelist=BackWPupFunctions::list_files(str_replace('\\','/',untrailingslashit(ABSPATH)));
8
- } else {
9
- $filelist=(array)$filelist;
10
- }
11
- if ($jobs[$jobid]['backupcontent']) {
12
- $filelist=array_merge(BackWPupFunctions::list_files(str_replace('\\','/',untrailingslashit(WP_CONTENT_DIR))),$filelist);
13
- } else {
14
- if (is_array($filelist)) {
15
- unset($excludefilelist); //clean vars
16
- $excludefilelist=BackWPupFunctions::list_files(WP_CONTENT_DIR);
17
- foreach($excludefilelist as $fileexcludevalue) {
18
- foreach($filelist as $filelistkey =>$filelistvalue) {
19
- if ($filelistvalue==$fileexcludevalue)
20
- unset($filelist[$filelistkey]);
21
- }
22
- }
23
- }
24
- }
25
- if ($jobs[$jobid]['backupplugins']) {
26
- $filelist=array_merge(BackWPupFunctions::list_files(str_replace('\\','/',untrailingslashit(WP_PLUGIN_DIR))),$filelist);
27
- } else {
28
- if (is_array($filelist)) {
29
- unset($excludefilelist); //clean vars
30
- $excludefilelist=BackWPupFunctions::list_files(WP_PLUGIN_DIR);
31
- foreach($excludefilelist as $fileexcludevalue) {
32
- foreach($filelist as $filelistkey =>$filelistvalue) {
33
- if ($filelistvalue==$fileexcludevalue)
34
- unset($filelist[$filelistkey]);
35
  }
36
- }
37
- }
38
- }
39
- if (!empty($jobs[$jobid]['dirinclude'])) {// Add extra include dirs
40
- $dirinclude=split(',',$jobs[$jobid]['dirinclude']);
41
- if (is_array($dirinclude)) {
42
- foreach($dirinclude as $dirincludevalue) {
43
- if (is_dir($dirincludevalue)) {
44
- $filelist=array_merge(BackWPupFunctions::list_files(str_replace('\\','/',untrailingslashit($dirincludevalue))),$filelist);
 
 
 
 
 
 
 
 
 
 
45
  }
46
  }
47
  }
 
 
48
  }
49
 
50
- if (sizeof($filelist)>0) {
51
- $filelist=array_unique($filelist);
52
- BackWPupFunctions::joblog($logtime,__('Remove Excludes from file list...','backwpup'));
53
- //Remove Temp dir
54
- foreach($filelist as $filelistkey =>$filelistvalue) {
55
- if (stristr($filelistvalue,BackWPupFunctions::get_temp_dir().'backwpup/'))
56
- unset($filelist[$filelistkey]);
57
- }
58
- //Remove Backup dirs
59
- foreach($jobs as $jobsvale) {
60
- foreach($filelist as $filelistkey =>$filelistvalue) {
61
- if (stristr($filelistvalue,$jobsvale['backupdir'].'/') and !empty($filelistvalue))
62
- unset($filelist[$filelistkey]);
63
- }
64
- }
65
- //Exclute files and dirs
66
- if (!empty($jobs[$jobid]['fileexclude'])) {
67
- $fileexclude=split(',',$jobs[$jobid]['fileexclude']);
68
- if (is_array($fileexclude)) {
69
- foreach($fileexclude as $fileexcludevalue) {
70
- foreach($filelist as $filelistkey =>$filelistvalue) {
71
- if (stristr($filelistvalue,$fileexcludevalue))
72
- unset($filelist[$filelistkey]);
73
- }
74
- }
75
- }
76
- unset($fileexclude); //clean vars
77
- }
78
  }
 
79
 
80
- if (sizeof($filelist)>0) {
81
- //Make array index mor readable
82
- $filestobackup=0;
83
- foreach($filelist as $filelistvalue) {
84
- $cleanfilelist[$filestobackup++]=$filelistvalue;
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
- unset($filelist);
87
- $filelist=$cleanfilelist;
88
- unset($cleanfilelist);
89
- } else {
90
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('No files to Backup','backwpup'));
91
  unset($filelist); //clean vars
 
 
92
  }
93
 
 
 
94
  //Create Zip File
95
- if (is_array($filelist) or $jobs[$jobid]['type']=='DB+FILE') {
96
- BackWPupFunctions::joblog($logtime,__('Files to Backup: ','backwpup').print_r($filelist,true));
97
  BackWPupFunctions::joblog($logtime,__('Create Backup Zip file...','backwpup'));
98
- require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
99
  $zipbackupfile = new PclZip($backupfile);
100
- if (0==$zipbackupfile -> create($filelist,PCLZIP_OPT_REMOVE_PATH,str_replace('\\','/',ABSPATH))) {
101
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Zip file create:','backwpup').' '.$zipbackupfile->errorInfo(true));
102
  }
103
  if ($jobs[$jobid]['type']=='DB+FILE') {
 
104
  BackWPupFunctions::joblog($logtime,__('Add Database dump to Backup Zip file...','backwpup'));
105
- if (0==$zipbackupfile -> add(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql',PCLZIP_OPT_REMOVE_PATH,BackWPupFunctions::get_temp_dir().'backwpup/')) {
106
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Zip file create Add Database dump:','backwpup').' '.$zipbackupfile->errorInfo(true));
107
- }
108
  }
109
  //clean vars
110
  unset($zipbackupfile);
1
  <?PHP
2
+ global $backwupu_exclude ,$backwpup_allfilezise, $backwpup_jobs;
3
+ $backwpup_jobs=$jobs[$jobid];
4
+ BackWPupFunctions::joblog($logtime,__('Run file backup...','backwpup'));
5
+ BackWPupFunctions::joblog($logtime,__('Get files to backup...','backwpup'));
6
+
7
+ // helper function to scan dirs recursive
8
+ function backwpup_list_files( $folder = '', $levels = 100 ) {
9
+ global $backwupu_exclude ,$backwpup_allfilezise, $backwpup_jobs;
10
+ if( empty($folder) )
11
+ return false;
12
+ if( ! $levels )
13
+ return false;
14
+ $files = array();
15
+ if ( $dir = @opendir( $folder ) ) {
16
+ while (($file = readdir( $dir ) ) !== false ) {
17
+ if ( in_array($file, array('.', '..','.svn') ) )
18
+ continue;
19
+ foreach ($backwupu_exclude as $exclusion) { //exclude dirs and files
20
+ if (false !== stripos($folder.'/'.$file,str_replace('\\','/',$exclusion)))
21
+ continue 2;
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
+ if (!$backwpup_jobs['backupcontent'] and false !== stripos($folder.'/'.$file,str_replace('\\','/',WP_CONTENT_DIR)) and false === stripos($folder.'/'.$file,str_replace('\\','/',WP_PLUGIN_DIR)) and !is_dir($folder.'/'.$file))
24
+ continue;
25
+ if (!$backwpup_jobs['backupplugins'] and false !== stripos($folder.'/'.$file,str_replace('\\','/',WP_PLUGIN_DIR)))
26
+ continue;
27
+ if ( is_dir( $folder . '/' . $file ) ) {
28
+ $files2 = backwpup_list_files( $folder . '/' . $file, $levels - 1);
29
+ if( $files2 )
30
+ $files = array_merge($files, $files2 );
31
+ } elseif (is_file( $folder . '/' . $file )) {
32
+ if (is_readable($folder . '/' . $file)) {
33
+ $files[] = $folder . '/' . $file;
34
+ $filezise=filesize($folder . '/' . $file);
35
+ $backwpup_allfilezise=$backwpup_allfilezise+$filezise;
36
+ BackWPupFunctions::joblog($logtime,__('File to Backup:','backwpup').' '.$folder . '/' . $file.' '.BackWPupFunctions::formatBytes($filezise));
37
+ } else {
38
+ BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.__('Can not read file:','backwpup').' '.$folder . '/' . $file);
39
+ }
40
+ } else {
41
+ BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.__('Is not a file or directory:','backwpup').' '.$folder . '/' . $file);
42
  }
43
  }
44
  }
45
+ @closedir( $dir );
46
+ return $files;
47
  }
48
 
49
+
50
+ //Make filelist
51
+ $backwupu_exclude=array(); $dirinclude=array(); $allfilezise=''; $filelist=array();
52
+
53
+ if (!empty($jobs[$jobid]['fileexclude']))
54
+ $backwupu_exclude=split(',',$jobs[$jobid]['fileexclude']);
55
+ //Exclude Temp dir
56
+ $backwupu_exclude[]=BackWPupFunctions::get_temp_dir().'backwpup';
57
+ //Exclude Backup dirs
58
+ foreach($jobs as $jobsvale) {
59
+ $backwupu_exclude[]=$jobsvale['backupdir'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
+ $backwupu_exclude=array_unique($backwupu_exclude);
62
 
63
+ //include dirs
64
+ if (!empty($jobs[$jobid]['dirinclude']))
65
+ $dirinclude=split(',',str_replace('\\','/',$jobs[$jobid]['dirinclude']));
66
+
67
+ if ($jobs[$jobid]['backuproot']) //Include extra path
68
+ $dirinclude[]=ABSPATH;
69
+ if ($jobs[$jobid]['backupcontent'] and ((strtolower(str_replace('\\','/',substr(WP_CONTENT_DIR,0,strlen(ABSPATH))))!=strtolower(str_replace('\\','/',ABSPATH)) and $jobs[$jobid]['backuproot']) or !$jobs[$jobid]['backuproot']))
70
+ $dirinclude[]=WP_CONTENT_DIR;
71
+ if ($jobs[$jobid]['backupplugins'] and ((strtolower(str_replace('\\','/',substr(WP_PLUGIN_DIR,0,strlen(ABSPATH))))!=strtolower(str_replace('\\','/',ABSPATH)) and $jobs[$jobid]['backuproot']) or !$jobs[$jobid]['backuproot']) and ((strtolower(str_replace('\\','/',substr(WP_PLUGIN_DIR,0,strlen(WP_CONTENT_DIR))))!=strtolower(str_replace('\\','/',WP_CONTENT_DIR)) and $jobs[$jobid]['backupcontent']) or !$jobs[$jobid]['backupcontent']))
72
+ $dirinclude[]=WP_PLUGIN_DIR;
73
+ $dirinclude=array_unique($dirinclude);
74
+ //Crate file list
75
+ if (is_array($dirinclude)) {
76
+ foreach($dirinclude as $dirincludevalue) {
77
+ if (is_dir($dirincludevalue))
78
+ $filelist=array_merge(backwpup_list_files(untrailingslashit(str_replace('\\','/',$dirincludevalue))),$filelist);
79
  }
80
+ }
81
+
82
+
83
+ if (sizeof($filelist)<1) {
84
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('No files to Backup','backwpup'));
85
  unset($filelist); //clean vars
86
+ } else {
87
+ BackWPupFunctions::joblog($logtime,__('Size off all files:','backwpup').' '.BackWPupFunctions::formatBytes($backwpup_allfilezise));
88
  }
89
 
90
+ BackWPupFunctions::needfreememory(33554432);
91
+
92
  //Create Zip File
93
+ if (is_array($filelist)) {
 
94
  BackWPupFunctions::joblog($logtime,__('Create Backup Zip file...','backwpup'));
 
95
  $zipbackupfile = new PclZip($backupfile);
96
+ if (0==$zipbackupfile -> create($filelist,PCLZIP_OPT_REMOVE_PATH,str_replace('\\','/',ABSPATH),PCLZIP_OPT_ADD_TEMP_FILE_ON)) {
97
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Zip file create:','backwpup').' '.$zipbackupfile->errorInfo(true));
98
  }
99
  if ($jobs[$jobid]['type']=='DB+FILE') {
100
+ BackWPupFunctions::joblog($logtime,__('Database file size:','backwpup').' '.BackWPupFunctions::formatBytes(filesize(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql')));
101
  BackWPupFunctions::joblog($logtime,__('Add Database dump to Backup Zip file...','backwpup'));
102
+ if (0==$zipbackupfile -> add(BackWPupFunctions::get_temp_dir().'backwpup/'.DB_NAME.'.sql',PCLZIP_OPT_REMOVE_ALL_PATH,PCLZIP_OPT_ADD_TEMP_FILE_ON)) {
103
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.__('Zip file create Add Database dump:','backwpup').' '.$zipbackupfile->errorInfo(true));
104
+ }
105
  }
106
  //clean vars
107
  unset($zipbackupfile);
app/dojob/optimize.php CHANGED
@@ -11,14 +11,12 @@ if (is_array($jobs[$jobid]['dbexclude'])) {
11
  }
12
 
13
  if (sizeof($tables)>0) {
14
- BackWPupFunctions::joblog($logtime,__('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($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
21
- }
22
  }
23
  }
24
  $wpdb->flush();
11
  }
12
 
13
  if (sizeof($tables)>0) {
 
 
14
  foreach ($tables as $table) {
15
  if (!in_array($table,(array)$jobs[$jobid]['dbexclude'])) {
16
+ $optimize=$wpdb->get_row('OPTIMIZE TABLE `'.$table.'`', ARRAY_A);
17
+ BackWPupFunctions::joblog($logtime,__(strtoupper($optimize['Msg_type']).':','backwpup').' '.sprintf(__('Result of table optimize for %1$s is: %2$s','backwpup'), $table, $optimize['Msg_text']));
18
+ if ($sqlerr=mysql_error($wpdb->dbh))
19
  BackWPupFunctions::joblog($logtime,__('ERROR:','backwpup').' '.sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, $sqlerr->last_query));
 
20
  }
21
  }
22
  $wpdb->flush();
app/functions.php CHANGED
@@ -2,33 +2,8 @@
2
 
3
  class BackWPupFunctions {
4
 
5
-
6
- function list_files( $folder = '', $levels = 100 ) { //Same as WP function but needet for cron
7
- if( empty($folder) )
8
- return false;
9
- if( ! $levels )
10
- return false;
11
- $files = array();
12
- if ( $dir = @opendir( $folder ) ) {
13
- while (($file = readdir( $dir ) ) !== false ) {
14
- if ( in_array($file, array('.', '..','.svn') ) )
15
- continue;
16
- if ( is_dir( $folder . '/' . $file ) ) {
17
- $files2 = list_files( $folder . '/' . $file, $levels - 1);
18
- if( $files2 )
19
- $files = array_merge($files, $files2 );
20
- else
21
- $files[] = $folder . '/' . $file . '/';
22
- } else {
23
- $files[] = $folder . '/' . $file;
24
- }
25
- }
26
- }
27
- @closedir( $dir );
28
- return $files;
29
- }
30
-
31
- function get_temp_dir() { //Same as WP function but needet for cron
32
  if ( defined('WP_TEMP_DIR') )
33
  return trailingslashit(WP_TEMP_DIR);
34
  $temp = WP_CONTENT_DIR . '/';
@@ -73,13 +48,15 @@ class BackWPupFunctions {
73
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-edit.php');
74
  break;
75
  case 'logs':
76
- $logs=get_option('backwpup_log');
77
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-logs.php');
78
  break;
79
  case 'settings':
80
  $cfg=get_option('backwpup');
81
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-settings.php');
82
  break;
 
 
 
83
  case 'runnow':
84
  $jobid = (int) $_GET['jobid'];
85
  check_admin_referer('runnow-job_' . $jobid);
@@ -89,7 +66,6 @@ class BackWPupFunctions {
89
  case 'view_log':
90
  $logtime= (int) $_GET['logtime'];
91
  check_admin_referer('view-log');
92
- $logs=get_option('backwpup_log');
93
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-view_log.php');
94
  break;
95
  default:
@@ -162,13 +138,47 @@ class BackWPupFunctions {
162
 
163
  //delete Otions
164
  function plugin_uninstall() {
 
165
  delete_option('backwpup');
166
  delete_option('backwpup_jobs');
167
  delete_option('backwpup_log');
 
168
  }
169
 
170
  //On Plugin activate
171
  function plugin_activate() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  //add cron jobs
173
  $jobs=get_option('backwpup_jobs');
174
  if (is_array($jobs)) {
@@ -178,6 +188,7 @@ class BackWPupFunctions {
178
  }
179
  }
180
  }
 
181
  }
182
 
183
  //on Plugin deaktivate
@@ -236,40 +247,75 @@ class BackWPupFunctions {
236
  require_once('dojob/bevore.php');
237
  switch($jobs[$jobid]['type']) {
238
  case 'DB+FILE':
 
239
  require_once('dojob/db.php');
240
  require_once('dojob/file.php');
241
- //require_once('dojob/destination-ftp.php');
242
  break;
243
  case 'DB':
 
244
  require_once('dojob/db.php');
245
- //require_once('dojob/destination-ftp.php');
246
  break;
247
  case 'FILE':
 
248
  require_once('dojob/file.php');
249
- //require_once('dojob/destination-ftp.php');
250
  break;
251
  case 'OPTIMIZE':
252
  require_once('dojob/optimize.php');
253
  break;
 
 
 
254
  }
255
  require_once('dojob/destination-mail.php');
256
  require_once('dojob/after.php');
257
 
258
- if ($returnlogfile)
259
- return $logtime;
260
- else
261
- return;
262
  }
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  //Make Log File for Jobs.
265
  function joblog($logtime,$entry) {
266
- $logs=get_option('backwpup_log');
 
267
  if (substr($entry,0,strlen(__('ERROR:','backwpup')))==__('ERROR:','backwpup'))
268
- $logs[$logtime]['error']=$logs[$logtime]['error']+1;
269
  if (substr($entry,0,strlen(__('WARNING:','backwpup')))==__('WARNING:','backwpup'))
270
- $logs[$logtime]['warning']=$logs[$logtime]['warning']+1;
271
- $logs[$logtime]['log'].=$entry."\n";
272
- update_option('backwpup_log',$logs);
 
 
 
273
  }
274
 
275
  //file size
@@ -282,10 +328,90 @@ class BackWPupFunctions {
282
  return round($bytes, $precision) . ' ' . $units[$pow];
283
  }
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  // add all action and so on only if plugin loaded.
286
  function init() {
287
- //load Text Domain
288
- load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_DIR.'/lang');
289
  //add Menu
290
  add_action('admin_menu', array('BackWPupFunctions', 'menu_entry'));
291
  //Additional links on the plugin page
@@ -294,7 +420,9 @@ class BackWPupFunctions {
294
  //add cron intervals
295
  add_filter('cron_schedules', array('BackWPupFunctions', 'intervals'));
296
  //Actions for Cron job
297
- add_action('backwpup_cron', array('BackWPupFunctions', 'dojob'));
 
 
298
  }
299
  }
300
 
2
 
3
  class BackWPupFunctions {
4
 
5
+ //Same as WP function but needet for cron
6
+ function get_temp_dir() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  if ( defined('WP_TEMP_DIR') )
8
  return trailingslashit(WP_TEMP_DIR);
9
  $temp = WP_CONTENT_DIR . '/';
48
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-edit.php');
49
  break;
50
  case 'logs':
 
51
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-logs.php');
52
  break;
53
  case 'settings':
54
  $cfg=get_option('backwpup');
55
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-settings.php');
56
  break;
57
+ case 'db_restore':
58
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-db_restore.php');
59
+ break;
60
  case 'runnow':
61
  $jobid = (int) $_GET['jobid'];
62
  check_admin_referer('runnow-job_' . $jobid);
66
  case 'view_log':
67
  $logtime= (int) $_GET['logtime'];
68
  check_admin_referer('view-log');
 
69
  require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-view_log.php');
70
  break;
71
  default:
138
 
139
  //delete Otions
140
  function plugin_uninstall() {
141
+ global $wpdb;
142
  delete_option('backwpup');
143
  delete_option('backwpup_jobs');
144
  delete_option('backwpup_log');
145
+ $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->backwpup_logs);
146
  }
147
 
148
  //On Plugin activate
149
  function plugin_activate() {
150
+ global $wpdb;
151
+
152
+ //Create log table
153
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
154
+ $charset_collate = '';
155
+ if($wpdb->supports_collation()) {
156
+ if(!empty($wpdb->charset)) {
157
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
158
+ }
159
+ if(!empty($wpdb->collate)) {
160
+ $charset_collate .= " COLLATE $wpdb->collate";
161
+ }
162
+ }
163
+
164
+
165
+ $statements = array(
166
+ "CREATE TABLE ".$wpdb->backwpup_logs." (
167
+ logtime BIGINT NOT NULL,
168
+ jobid INT NOT NULL,
169
+ jobname VARCHAR(255) NOT NULL,
170
+ type VARCHAR(20) NOT NULL,
171
+ error TINYINT NOT NULL default '0',
172
+ warning TINYINT NOT NULL default '0',
173
+ worktime TINYINT NOT NULL default '0',
174
+ log TEXT NOT NULL default '',
175
+ backupfile VARCHAR(255),
176
+ PRIMARY KEY (logtime)
177
+ )".$charset_collate,
178
+ );
179
+ $sql = implode(';', $statements);
180
+ dbDelta($sql);
181
+
182
  //add cron jobs
183
  $jobs=get_option('backwpup_jobs');
184
  if (is_array($jobs)) {
188
  }
189
  }
190
  }
191
+
192
  }
193
 
194
  //on Plugin deaktivate
247
  require_once('dojob/bevore.php');
248
  switch($jobs[$jobid]['type']) {
249
  case 'DB+FILE':
250
+ require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
251
  require_once('dojob/db.php');
252
  require_once('dojob/file.php');
253
+ require_once('dojob/destination-ftp.php');
254
  break;
255
  case 'DB':
256
+ require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
257
  require_once('dojob/db.php');
258
+ require_once('dojob/destination-ftp.php');
259
  break;
260
  case 'FILE':
261
+ require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
262
  require_once('dojob/file.php');
263
+ require_once('dojob/destination-ftp.php');
264
  break;
265
  case 'OPTIMIZE':
266
  require_once('dojob/optimize.php');
267
  break;
268
+ case 'CHECK':
269
+ require_once('dojob/check.php');
270
+ break;
271
  }
272
  require_once('dojob/destination-mail.php');
273
  require_once('dojob/after.php');
274
 
275
+ return $logtime;
 
 
 
276
  }
277
 
278
+ //increase Memory need free memory in bytes
279
+ function needfreememory($memneed) {
280
+ global $logtime;
281
+ //calc mem to bytes
282
+ if (strtoupper(substr(trim(ini_get('memory_limit')),-1))=='K')
283
+ $memory=trim(substr(ini_get('memory_limit'),0,-1))*1024;
284
+ elseif (strtoupper(substr(trim(ini_get('memory_limit')),-1))=='M')
285
+ $memory=trim(substr(ini_get('memory_limit'),0,-1))*1024*1024;
286
+ elseif (strtoupper(substr(trim(ini_get('memory_limit')),-1))=='G')
287
+ $memory=trim(substr(ini_get('memory_limit'),0,-1))*1024*1024*1024;
288
+ else
289
+ $memory=trim(ini_get('memory_limit'));
290
+
291
+ if (memory_get_usage()+$memneed>$memory) { // increase Memory
292
+ if (ini_get('safe_mode') or strtolower(ini_get('safe_mode'))=='on' or ini_get('safe_mode')=='1') {
293
+ BackWPupFunctions::joblog($logtime,__('WARNING:','backwpup').' '.sprintf(__('PHP Safe Mode is on!!! Can not increse Memory Limit is %1$s','backwpup'),ini_get('memory_limit')));
294
+ return false;
295
+ }
296
+ $newmemory=round((memory_get_usage()+$memneed)/1024/1024)+1;
297
+ if ($oldmem=ini_set('memory_limit', $newmemory.'M'))
298
+ BackWPupFunctions::joblog($logtime,sprintf(__('Memory incresed from %1$s to %2$s','backwpup'),$oldmem,ini_get('memory_limit')));
299
+ else
300
+ BackWPupFunctions::joblog($logtime,sprintf(__('ERROR:','backwpup').' '.__('Can not increse Memory Limit is %1$s','backwpup'),ini_get('memory_limit')));
301
+ }
302
+ return true;
303
+ }
304
+
305
+
306
  //Make Log File for Jobs.
307
  function joblog($logtime,$entry) {
308
+ global $wpdb;
309
+ $log=$wpdb->get_row("SELECT error,warning,log FROM ".$wpdb->backwpup_logs." WHERE logtime=".$logtime, ARRAY_A);
310
  if (substr($entry,0,strlen(__('ERROR:','backwpup')))==__('ERROR:','backwpup'))
311
+ $log['error']=$log['error']+1;
312
  if (substr($entry,0,strlen(__('WARNING:','backwpup')))==__('WARNING:','backwpup'))
313
+ $log['warning']=$log['warning']+1;
314
+ $wpdb->update( $wpdb->backwpup_logs, array( 'error' => $log['error'], 'warning' => $log['warning'], 'log' => $log['log'].date('Y-m-d H:i:s').": ".$entry."\n" ), array( 'logtime' => $logtime ));
315
+ echo date('Y-m-d H:i.s').": ".$entry."\n";
316
+ $wpdb->flush();
317
+ flush();
318
+ ob_flush();
319
  }
320
 
321
  //file size
328
  return round($bytes, $precision) . ' ' . $units[$pow];
329
  }
330
 
331
+ //echo long backup type name
332
+ function backup_types($type='',$echo=false) {
333
+ switch($type) {
334
+ case 'DB+FILE':
335
+ $typename=__('Database &amp; File Backup','backwpup');
336
+ break;
337
+ case 'DB':
338
+ $typename=__('Database Backup','backwpup');
339
+ break;
340
+ case 'FILE':
341
+ $typename=__('File Backup','backwpup');
342
+ break;
343
+ case 'OPTIMIZE':
344
+ $typename=__('Optimize Database Tabels','backwpup');
345
+ break;
346
+ case 'CHECK':
347
+ $typename=__('Check Database Tabels','backwpup');
348
+ break;
349
+ default:
350
+ $typename=array('DB+FILE','DB','FILE','OPTIMIZE','CHECK');
351
+ break;
352
+ }
353
+ if ($echo and !empty($type))
354
+ echo $typename;
355
+ else
356
+ return $typename;
357
+ }
358
+
359
+ //Dashboard widget
360
+ function dashboard_output() {
361
+ global $wpdb;
362
+ echo '<strong>'.__('Logs:','backwpup').'</strong><ul>';
363
+ $logs=$wpdb->get_results("SELECT * FROM ".$wpdb->backwpup_logs." ORDER BY logtime DESC LIMIT 5", ARRAY_A);
364
+ $wpdb->flush();
365
+ if (is_array($logs)) {
366
+ foreach ($logs as $logvalue) {
367
+ echo '<li><a href="'.wp_nonce_url('admin.php?page=BackWPup&action=view_log&logtime='.$logvalue['logtime'], 'view-log').'" title="'.__('View Log','backwpup').'"><strong>'.date(get_option('date_format'),$logvalue['logtime']).' '.date(get_option('time_format'),$logvalue['logtime']).'</strong>: <i>';
368
+ if (empty($logvalue['jobname']))
369
+ BackWPupFunctions::backup_types($logvalue['type'],true);
370
+ else
371
+ echo $logvalue['jobname'];
372
+ echo '</i>';
373
+ if($logvalue['error']>0 or $logvalue['warning']>0) {
374
+ if ($logvalue['error']>0)
375
+ echo ' <strong><span style="color:red;">'.$logvalue['error'].' '.__('ERROR(S)','backwpup').'</span></strong>';
376
+ if ($logvalue['warning']>0)
377
+ echo ' <strong><span style="color:yellow;">'.$logvalue['warning'].' '.__('WARNING(S)','backwpup').'</span></strong>';
378
+ } else {
379
+ echo ' <strong><span style="color:green;">'.__('OK','backwpup').'</span></strong>';
380
+ }
381
+ echo '</a></li>';
382
+ }
383
+ } else {
384
+ echo '<li><i>'.__('none','backwpup').'</i></li>';
385
+ }
386
+ echo "</ul>";
387
+ $jobs=get_option('backwpup_jobs');
388
+ echo '<strong>'.__('Scheduled Jobs:','backwpup').'</strong><ul>';
389
+ if (is_array($jobs)) {
390
+ foreach ($jobs as $jobid => $jobvalue) {
391
+ if (wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
392
+ echo '<li><a href="'.wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job').'" title="'.__('Edit Job','backwpup').'"><strong>';
393
+ if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
394
+ $runtime=time()-$jobvalue['starttime'];
395
+ echo __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
396
+ } elseif ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
397
+ echo date(get_option('date_format'),$time).' '.date(get_option('time_format'),$time);
398
+ }
399
+ echo '</strong>: <span>'.$jobvalue['name'].'</span></a></li>';
400
+ }
401
+ }
402
+ } else {
403
+ echo '<li><i>'.__('none','backwpup').'</i></li>';
404
+ }
405
+ echo "</ul>";
406
+ }
407
+
408
+ //add dashboard widget
409
+ function add_dashboard() {
410
+ wp_add_dashboard_widget( 'backwpup_dashboard_widget', 'BackWPup', array ('BackWPupFunctions', 'dashboard_output') );
411
+ }
412
+
413
  // add all action and so on only if plugin loaded.
414
  function init() {
 
 
415
  //add Menu
416
  add_action('admin_menu', array('BackWPupFunctions', 'menu_entry'));
417
  //Additional links on the plugin page
420
  //add cron intervals
421
  add_filter('cron_schedules', array('BackWPupFunctions', 'intervals'));
422
  //Actions for Cron job
423
+ add_action('backwpup_cron', array('BackWPupFunctions', 'dojob'));
424
+ //add Dashboard widget
425
+ add_action( 'wp_dashboard_setup', array ('BackWPupFunctions', 'add_dashboard') );
426
  }
427
  }
428
 
app/options-db_restore.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-tools" class="icon32"><br /></div>
3
+ <h2><?php _e("BackWPup Restore Database", "backwpup"); ?></h2>
4
+ <ul class="subsubsub">
5
+ <li><a href="admin.php?page=BackWPup"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=db_restore" class="current"><?PHP _e('DB Restore','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 method="post" action="">
12
+ <input type="hidden" name="action" value="db_restore" />
13
+ <input type="hidden" name="page" value="BackWPup" />
14
+ <?php wp_nonce_field('backwpup-db_restore'); ?>
15
+
16
+ <table class="form-table">
17
+
18
+
19
+ </table>
20
+
21
+ <p class="submit">
22
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
23
+ </p>
24
+ </form>
app/options-edit.php CHANGED
@@ -11,11 +11,11 @@ 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') {
@@ -33,11 +33,12 @@ if ($jobs[$jobid]['type']=='FILE') {
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>
@@ -48,7 +49,7 @@ if ($jobs[$jobid]['type']=='FILE') {
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
@@ -60,7 +61,8 @@ if (!isset($jobs[$jobid]['dbexclude'])) { //def.
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
  ?>
@@ -140,7 +142,7 @@ 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
 
@@ -164,6 +166,27 @@ _e('Oldest files will deletet first.','backwpup');
164
  ?></span>
165
  </td>
166
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  <?PHP } ?>
168
 
169
 
11
  $jobs[$jobid]['type']='DB+FILE';
12
 
13
 
14
+ if ($jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {
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' or $jobs[$jobid]['type']=='CHECK') {
19
  echo '<input type="hidden" name="fileexclude" value="'.$jobs[$jobid]['fileexclude'].'" />';
20
  }
21
  if ($jobs[$jobid]['type']=='FILE') {
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
+ <?php
38
+ foreach (BackWPupFunctions::backup_types() as $type) {
39
+ echo '<option value="'.$type.'"'.selected($type,$jobs[$jobid]['type'],false).'>'.BackWPupFunctions::backup_types($type).'</option>';
40
+ }
41
+ ?>
42
  </select>
43
  <input type="submit" name="change" class="button" value="<?php _e('Change', 'backwpup'); ?>" />
44
  </td>
49
  <td><input name="name" type="text" id="jobname" value="<?PHP echo $jobs[$jobid]['name'];?>" class="regular-text" /></td>
50
  </tr>
51
 
52
+ <?PHP if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE' or $jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {?>
53
  <tr valign="top">
54
  <th scope="row"><label for="dbexclude"><?PHP _e('Exclude Databas Tabels:','backwpup'); ?></label></th><td>
55
  <?php
61
  }
62
  }
63
  foreach ($tables as $table) {
64
+ if ($wpdb->backwpup_logs<>$table)
65
+ echo ' <input class="checkbox" type="checkbox"'.checked(in_array($table,(array)$jobs[$jobid]['dbexclude']),true,false).' name="dbexclude[]" value="'.$table.'"/>'.$table;
66
  }
67
 
68
  ?>
142
  ?>
143
  <br />
144
  <span class="description"><?php _e('Activate:', 'backwpup'); ?></span>
145
+ <input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['activated'],true); ?> name="activated" />
146
  </td>
147
  </tr>
148
 
166
  ?></span>
167
  </td>
168
  </tr>
169
+
170
+
171
+ <tr valign="top">
172
+ <th scope="row"><label for="mailaddress"><?PHP _e('Place Backup to FTP Server:','backwpup'); ?></label></th>
173
+ <td>
174
+ <span class="description"><?PHP _e('Ftp Hostname:','backwpup'); ?></span><input name="ftphost" type="text" value="<?PHP echo $jobs[$jobid]['ftphost'];?>" class="regular-text" /><br />
175
+ <span class="description"><?PHP _e('Ftp Username:','backwpup'); ?></span><input name="ftpuser" type="text" value="<?PHP echo $jobs[$jobid]['ftpuser'];?>" class="user" size="10" /><br />
176
+ <span class="description"><?PHP _e('Ftp Password:','backwpup'); ?></span><input name="ftppass" type="password" value="<?PHP echo $jobs[$jobid]['ftppass'];?>" class="password" size="10" /><br />
177
+ <span class="description"><?PHP _e('Ftp directory:','backwpup'); ?></span><input name="ftpdir" type="text" value="<?PHP echo $jobs[$jobid]['ftpdir'];?>" class="regular-text" /><br />
178
+ <span class="description"><?PHP _e('Max Backup fieles on ftp:','backwpup'); ?></span>
179
+ <?PHP
180
+ echo '<select name="ftpmaxbackups">';
181
+ echo '<option value="0"'.selected(0,$jobs[$jobid]['ftpmaxbackups'],false).'>'.__('Off','backwpup').'</option>';
182
+ for ($i=1;$i<=50;$i++) {
183
+ echo '<option value="'.$i.'"'.selected($i,$jobs[$jobid]['ftpmaxbackups'],false).'>'.$i.'</option>';
184
+ }
185
+ echo '</select>';
186
+ ?><br />
187
+ </td>
188
+ </tr>
189
+
190
  <?PHP } ?>
191
 
192
 
app/options-logs.php CHANGED
@@ -2,9 +2,10 @@
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">
@@ -52,30 +53,18 @@
52
 
53
  <tbody id="the-list" class="list:post">
54
 
55
- <?PHP if (is_array($logs)) {
56
- $logs=array_reverse($logs,true);
57
- foreach ($logs as $timestamp => $logvalue) {?>
 
58
  <tr id="post-16" class="alternate author-self status-inherit" valign="top">
59
  <th scope="row" class="check-column">
60
- <input type="checkbox" name="logs[]" value="<?PHP echo $timestamp;?>" />
61
  </th>
62
  <td class="column-id"><?PHP echo $logvalue['jobid'];?></td>
63
  <td class="column-type">
64
  <?PHP
65
- switch($logvalue['type']) {
66
- case 'DB+FILE':
67
- _e('Database &amp; File Backup','backwpup');
68
- break;
69
- case 'DB':
70
- _e('Database Backup','backwpup');
71
- break;
72
- case 'FILE':
73
- _e('File Backup','backwpup');
74
- break;
75
- case 'OPTIMIZE':
76
- _e('Optimize Database Tabels','backwpup');
77
- break;
78
- }
79
  ?>
80
  </td>
81
  <td class="name column-log">
@@ -84,12 +73,12 @@
84
  if (is_file($logvalue['backupfile']))
85
  $name=basename($logvalue['backupfile']);
86
  ?>
87
- <strong><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=view_log&logtime='.$timestamp, 'view-log'); ?>" title="<?PHP _e('View log','backwpup'); ?>"><?PHP echo date(get_option('date_format'),$timestamp); ?> <?PHP echo date(get_option('time_format'),$timestamp); ?></a></strong>
88
  <p><div class="row-actions">
89
- <span class="view"><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=view_log&logtime='.$timestamp, 'view-log'); ?>"><?PHP _e('View','backwpup'); ?></a></span>
90
- <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>
91
  <?PHP if (!empty($logvalue['backupfile']) and is_file($logvalue['backupfile'])) { ?>
92
- <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>
93
  <?PHP } ?>
94
  </div></p>
95
  </td>
@@ -98,11 +87,11 @@
98
  <?PHP
99
  if($logvalue['error']>0 or $logvalue['warning']>0) {
100
  if ($logvalue['error']>0)
101
- echo '<span style="color:red;">'.$logvalue['error'].' '.__('ERROR(S)','backwpup').'</span>';
102
  if ($logvalue['warning']>0)
103
  echo '<span style="color:yellow;">'.$logvalue['warning'].' '.__('WARNING(S)','backwpup').'</span>';
104
  } else {
105
- _e('OK','backwpup');
106
  }
107
  ?>
108
  </strong>
@@ -116,7 +105,7 @@
116
  }
117
  ?>
118
  </td>
119
- <td class="column-logdate">
120
  <?PHP
121
  echo $logvalue['worktime'].' '.__('sec.','backwpup');
122
  ?>
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"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs" class="current"><?PHP _e('Logs','backwpup'); ?></a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=db_restore"><?PHP _e('DB Restore','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="logs-filter" action="" method="post">
53
 
54
  <tbody id="the-list" class="list:post">
55
 
56
+ <?PHP
57
+ $logs=$wpdb->get_results("SELECT * FROM ".$wpdb->backwpup_logs." ORDER BY logtime DESC", ARRAY_A);
58
+ if (is_array($logs)) {
59
+ foreach ($logs as $logvalue) {?>
60
  <tr id="post-16" class="alternate author-self status-inherit" valign="top">
61
  <th scope="row" class="check-column">
62
+ <input type="checkbox" name="logs[]" value="<?PHP echo $logvalue['logtime']?>" />
63
  </th>
64
  <td class="column-id"><?PHP echo $logvalue['jobid'];?></td>
65
  <td class="column-type">
66
  <?PHP
67
+ BackWPupFunctions::backup_types($logvalue['type'],true);
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  ?>
69
  </td>
70
  <td class="name column-log">
73
  if (is_file($logvalue['backupfile']))
74
  $name=basename($logvalue['backupfile']);
75
  ?>
76
+ <strong><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=view_log&logtime='.$logvalue['logtime'], 'view-log'); ?>" title="<?PHP _e('View log','backwpup'); ?>"><?PHP echo date(get_option('date_format'),$logvalue['logtime']); ?> <?PHP echo date(get_option('time_format'),$logvalue['logtime']); ?><?php if (!empty($logvalue['jobname'])) echo ': <i>'.$logvalue['jobname'].'</i>';?></a></strong>
77
  <p><div class="row-actions">
78
+ <span class="view"><a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=view_log&logtime='.$logvalue['logtime'], 'view-log'); ?>"><?PHP _e('View','backwpup'); ?></a></span>
79
+ <span class="delete"> | <a class="submitdelete" href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=delete-logs&log='.$logvalue['logtime'], 'delete-log_'.$logvalue['logtime']); ?>" onclick="if ( confirm('<?PHP echo esc_js(__("You are about to delete this Log and Backupfile. \n 'Cancel' to stop, 'OK' to delete.","backwpup")) ?>') ){return true;}return false;"><?PHP _e('Delete','backwpup'); ?></a></span>
80
  <?PHP if (!empty($logvalue['backupfile']) and is_file($logvalue['backupfile'])) { ?>
81
+ <span class="download"> | <a href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=download&log='.$logvalue['logtime'], 'download-backup_'.$logvalue['logtime']); ?>"><?PHP _e('Download','backwpup'); ?></a></span>
82
  <?PHP } ?>
83
  </div></p>
84
  </td>
87
  <?PHP
88
  if($logvalue['error']>0 or $logvalue['warning']>0) {
89
  if ($logvalue['error']>0)
90
+ echo '<span style="color:red;">'.$logvalue['error'].' '.__('ERROR(S)','backwpup').'</span><br />';
91
  if ($logvalue['warning']>0)
92
  echo '<span style="color:yellow;">'.$logvalue['warning'].' '.__('WARNING(S)','backwpup').'</span>';
93
  } else {
94
+ echo '<span style="color:green;">'.__('OK','backwpup').'</span>';
95
  }
96
  ?>
97
  </strong>
105
  }
106
  ?>
107
  </td>
108
+ <td class="column-runtime">
109
  <?PHP
110
  echo $logvalue['worktime'].' '.__('sec.','backwpup');
111
  ?>
app/options-runnow.php CHANGED
@@ -2,15 +2,12 @@
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 $logtime=BackWPupFunctions::dojob(array('jobid'=>$jobid,'returnlogfile'=>true)); ?>
11
  <pre>
12
- <?PHP
13
- $logs=get_option('backwpup_log');
14
- echo $logs[$logtime]['log'];
15
- ?>
16
  </pre>
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"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=db_restore"><?PHP _e('DB Restore','backwpup'); ?></a> |</li>
8
+ <li><a href="admin.php?page=BackWPup&amp;action=settings"><?PHP _e('Settings','backwpup'); ?></a></li>
9
  </ul>
10
  <br class="clear" />
 
11
  <pre>
12
+ <?PHP BackWPupFunctions::dojob($jobid); ?>
 
 
 
13
  </pre>
app/options-save.php CHANGED
@@ -11,12 +11,12 @@ class BackWPupOptions {
11
  }
12
  }
13
 
14
- function delete_log($timestamp) {
15
- $logs=get_option('backwpup_log'); //Load Settings
16
- if (is_file($logs[$timestamp]['backupfile']))
17
- unlink($logs[$timestamp]['backupfile']);
18
- unset($logs[$timestamp]);
19
- update_option('backwpup_log',$logs); //Save Settings
20
  }
21
 
22
  function copy_job($jobid) {
@@ -40,19 +40,20 @@ class BackWPupOptions {
40
  update_option('backwpup',$cfg); //Save Settings
41
  }
42
 
43
- function download_backup($timestamp) {
44
- $logs=get_option('backwpup_log'); //Load Settings
45
- if (is_file($logs[$timestamp]['backupfile'])) {
 
46
  header("Pragma: public");
47
  header("Expires: 0");
48
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
49
  header("Content-Type: application/force-download");
50
  header("Content-Type: application/octet-stream");
51
  header("Content-Type: application/download");
52
- header("Content-Disposition: attachment; filename=".basename($logs[$timestamp]['backupfile']).";");
53
  header("Content-Transfer-Encoding: binary");
54
- header("Content-Length: ".filesize($logs[$timestamp]['backupfile']));
55
- @readfile($logs[$timestamp]['backupfile']);
56
  } else {
57
  header('HTTP/1.0 404 Not Found');
58
  die(__('File does not exist.', 'backwpup'));
@@ -76,7 +77,7 @@ class BackWPupOptions {
76
 
77
  $jobs[$jobid]['type']= $_POST['type'];
78
  $jobs[$jobid]['name']= esc_html($_POST['name']);
79
- $jobs[$jobid]['activated']= $_POST['activated'];
80
  $jobs[$jobid]['scheduletime']=mktime($_POST['schedulehour'],$_POST['scheduleminute'],0,$_POST['schedulemonth'],$_POST['scheduleday'],$_POST['scheduleyear']);
81
  $jobs[$jobid]['scheduleintervaltype']=$_POST['scheduleintervaltype'];
82
  $jobs[$jobid]['scheduleintervalteimes']=$_POST['scheduleintervalteimes'];
@@ -87,10 +88,14 @@ class BackWPupOptions {
87
  $jobs[$jobid]['dbexclude']=array_unique((array)$_POST['dbexclude']);
88
  $jobs[$jobid]['fileexclude']=str_replace('\\','/',stripslashes($_POST['fileexclude']));
89
  $jobs[$jobid]['dirinclude']=str_replace('\\','/',stripslashes($_POST['dirinclude']));
90
- $jobs[$jobid]['backuproot']=isset($_POST['backuproot']);
91
- $jobs[$jobid]['backupcontent']=isset($_POST['backupcontent']);
92
- $jobs[$jobid]['backupplugins']=isset($_POST['backupplugins']);
93
-
 
 
 
 
94
 
95
  update_option('backwpup_jobs',$jobs); //Save Settings
96
  if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
11
  }
12
  }
13
 
14
+ function delete_log($logtime) {
15
+ global $wpdb;
16
+ $backupfile=$wpdb->get_var("SELECT backupfile FROM ".$wpdb->backwpup_logs." WHERE logtime=".$logtime);
17
+ if (is_file($backupfile))
18
+ unlink($backupfile);
19
+ $wpdb->query("DELETE FROM ".$wpdb->backwpup_logs." WHERE logtime=".$logtime);
20
  }
21
 
22
  function copy_job($jobid) {
40
  update_option('backwpup',$cfg); //Save Settings
41
  }
42
 
43
+ function download_backup($logtime) {
44
+ global $wpdb;
45
+ $backupfile=$wpdb->get_var("SELECT backupfile FROM ".$wpdb->backwpup_logs." WHERE logtime=".$logtime);
46
+ if (is_file($backupfile)) {
47
  header("Pragma: public");
48
  header("Expires: 0");
49
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
50
  header("Content-Type: application/force-download");
51
  header("Content-Type: application/octet-stream");
52
  header("Content-Type: application/download");
53
+ header("Content-Disposition: attachment; filename=".basename($backupfile).";");
54
  header("Content-Transfer-Encoding: binary");
55
+ header("Content-Length: ".filesize($backupfile));
56
+ @readfile($backupfile);
57
  } else {
58
  header('HTTP/1.0 404 Not Found');
59
  die(__('File does not exist.', 'backwpup'));
77
 
78
  $jobs[$jobid]['type']= $_POST['type'];
79
  $jobs[$jobid]['name']= esc_html($_POST['name']);
80
+ $jobs[$jobid]['activated']= $_POST['activated']==1 ? true : false;
81
  $jobs[$jobid]['scheduletime']=mktime($_POST['schedulehour'],$_POST['scheduleminute'],0,$_POST['schedulemonth'],$_POST['scheduleday'],$_POST['scheduleyear']);
82
  $jobs[$jobid]['scheduleintervaltype']=$_POST['scheduleintervaltype'];
83
  $jobs[$jobid]['scheduleintervalteimes']=$_POST['scheduleintervalteimes'];
88
  $jobs[$jobid]['dbexclude']=array_unique((array)$_POST['dbexclude']);
89
  $jobs[$jobid]['fileexclude']=str_replace('\\','/',stripslashes($_POST['fileexclude']));
90
  $jobs[$jobid]['dirinclude']=str_replace('\\','/',stripslashes($_POST['dirinclude']));
91
+ $jobs[$jobid]['backuproot']= $_POST['backuproot']==1 ? true : false;
92
+ $jobs[$jobid]['backupcontent']= $_POST['backupcontent']==1 ? true : false;
93
+ $jobs[$jobid]['backupplugins']= $_POST['backupplugins']==1 ? true : false;
94
+ $jobs[$jobid]['ftphost']=$_POST['ftphost'];
95
+ $jobs[$jobid]['ftpuser']=$_POST['ftpuser'];
96
+ $jobs[$jobid]['ftppass']=$_POST['ftppass'];
97
+ $jobs[$jobid]['ftpdir']=str_replace('\\','/',stripslashes($_POST['ftpdir']));
98
+ $jobs[$jobid]['ftpmaxbackups']=abs((int)$_POST['ftpmaxbackups']);
99
 
100
  update_option('backwpup_jobs',$jobs); //Save Settings
101
  if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
app/options-settings.php CHANGED
@@ -2,10 +2,10 @@
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="">
@@ -13,7 +13,15 @@
13
  <?php wp_nonce_field('backwpup-cfg'); ?>
14
 
15
  <table class="form-table">
16
-
 
 
 
 
 
 
 
 
17
 
18
  </table>
19
 
2
  <div id="icon-tools" class="icon32"><br /></div>
3
  <h2><?php _e("BackWPup Settings", "backwpup"); ?></h2>
4
  <ul class="subsubsub">
5
+ <li><a href="admin.php?page=BackWPup"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=db_restore"><?PHP _e('DB Restore','backwpup'); ?></a> |</li>
8
+ <li><a href="admin.php?page=BackWPup&amp;action=settings" class="current"><?PHP _e('Settings','backwpup'); ?></a></li>
9
  </ul>
10
 
11
  <form method="post" action="">
13
  <?php wp_nonce_field('backwpup-cfg'); ?>
14
 
15
  <table class="form-table">
16
+ <tr valign="top">
17
+ <tr valign="top">
18
+ <th scope="row"><label for="jobname"><?PHP _e('Script Runime','backwpup'); ?></label></th>
19
+ <td>
20
+ <?
21
+ echo __('PHP.ini execution time:','backwpup').' '.ini_get('max_execution_time').' '.__('sec.','backwpup').'<br />';
22
+ ?>
23
+ </td>
24
+ </tr>
25
 
26
  </table>
27
 
app/options-view_log.php CHANGED
@@ -2,14 +2,15 @@
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
- echo $logs[$logtime]['log'];
14
  ?>
15
  </pre>
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"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=db_restore"><?PHP _e('DB Restore','backwpup'); ?></a> |</li>
8
+ <li><a href="admin.php?page=BackWPup&amp;action=settings"><?PHP _e('Settings','backwpup'); ?></a></li>
9
  </ul>
10
  <br class="clear" />
11
 
12
  <pre>
13
  <?PHP
14
+ echo $wpdb->get_var("SELECT log FROM ".$wpdb->backwpup_logs." WHERE logtime=".$logtime);
15
  ?>
16
  </pre>
app/options.php CHANGED
@@ -2,9 +2,9 @@
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
 
@@ -68,20 +68,7 @@
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">
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
  <li><a href="admin.php?page=BackWPup" class="current"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
6
+ <li><a href="admin.php?page=BackWPup&amp;action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
7
+ <li><a href="admin.php?page=BackWPup&amp;action=db_restore"><?PHP _e('DB Restore','backwpup'); ?></a> |</li>
8
  <li><a href="admin.php?page=BackWPup&amp;action=settings"><?PHP _e('Settings','backwpup'); ?></a></li>
9
  </ul>
10
 
68
  </td>
69
  <td class="column-type">
70
  <?PHP
71
+ BackWPupFunctions::backup_types($jobvalue['type'],true);
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  ?>
73
  </td>
74
  <td class="column-next">
backwpup.php CHANGED
@@ -4,14 +4,14 @@ 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.5
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
@@ -25,33 +25,33 @@ Domain Path: /lang/
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.5');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  }
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.6.0
8
  Author URI: http://danielhuesken.de
9
  Text Domain: backwpup
10
  Domain Path: /lang/
11
  */
12
 
13
  /*
14
+ Copyright 2009 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
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 
 
 
 
 
29
  */
30
 
31
 
32
  //Set plugin dirname
33
  define('BACKWPUP_PLUGIN_DIR', dirname(plugin_basename(__FILE__)));
34
  //Set Plugin Version
35
+ define('BACKWPUP_VERSION', '0.6.0');
36
+ //BackWPup Log Table Name
37
+ global $wpdb;
38
+ $wpdb->backwpup_logs = $wpdb->prefix.'backwpup_logs';
39
+
40
+ //load Text Domain
41
+ load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_DIR.'/lang');
42
+ //Load functions file
43
+ require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/functions.php');
44
+ //Plugin activate
45
+ register_activation_hook(__FILE__, array('BackWPupFunctions', 'plugin_activate'));
46
+ //Plugin deactivate
47
+ register_deactivation_hook(__FILE__, array('BackWPupFunctions', 'plugin_deactivate'));
48
+ //Plugin uninstall
49
+ register_uninstall_hook(__FILE__, array('BackWPupFunctions', 'plugin_uninstall'));
50
 
51
  //Version check
52
  if (version_compare($wp_version, '2.8', '<')) { // Let only Activate on WordPress Version 2.8 or heiger
53
  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>\';'));
54
  } else {
 
 
 
 
 
 
 
 
55
  //Plugin init
56
  add_action('plugins_loaded', array('BackWPupFunctions', 'init'));
57
  }
lang/backwpup.pot CHANGED
@@ -8,7 +8,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-08 19:12+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"
@@ -20,138 +20,259 @@ msgstr ""
20
  msgid "Delete old backup files..."
21
  msgstr ""
22
 
23
- #: app/dojob/after.php:29
24
- msgid "Old backup files deleted!!!"
25
  msgstr ""
26
 
27
- #: app/dojob/after.php:37
 
 
 
 
28
  #, php-format
29
  msgid "Backup zip filesize is %1s"
30
  msgstr ""
31
 
32
- #: app/dojob/bevore.php:32 app/dojob/destination-mail.php:9
33
- #: app/functions.php:269
 
 
34
  msgid "WARNING:"
35
  msgstr ""
36
 
37
- #: app/dojob/bevore.php:32
38
  #, php-format
39
- msgid "Safe Mode is on!!! Max exec time is %1$s sec."
40
  msgstr ""
41
 
42
- #: app/dojob/bevore.php:38 app/dojob/bevore.php:44 app/dojob/bevore.php:66
43
- #: app/dojob/bevore.php:72 app/dojob/db.php:27
44
- #: app/dojob/destination-mail.php:11 app/dojob/destination-mail.php:20
45
- #: app/dojob/file.php:90 app/dojob/file.php:101 app/dojob/file.php:106
46
- #: app/dojob/optimize.php:20 app/dojob/optimize.php:27 app/functions.php:267
 
 
 
 
 
 
 
 
 
 
 
47
  msgid "ERROR:"
48
  msgstr ""
49
 
50
- #: app/dojob/bevore.php:38
51
  msgid "Can not create Temp dir"
52
  msgstr ""
53
 
54
- #: app/dojob/bevore.php:44
55
  msgid "Can not write to Temp dir"
56
  msgstr ""
57
 
58
- #: app/dojob/bevore.php:66
59
  msgid "Can not create Backup dir"
60
  msgstr ""
61
 
62
- #: app/dojob/bevore.php:72
63
  msgid "Can not write to Backup dir"
64
  msgstr ""
65
 
66
- #: app/dojob/bevore.php:88
67
  msgid "Backup zip file save to:"
68
  msgstr ""
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  #: app/dojob/db.php:2
71
  msgid "Run Database Backup..."
72
  msgstr ""
73
 
74
- #: app/dojob/db.php:15
75
- msgid "Tables to Backup: "
76
  msgstr ""
77
 
78
- #: app/dojob/db.php:30
79
- msgid "ERROR: No Tables to Backup"
80
  msgstr ""
81
 
82
- #: app/dojob/db.php:34
 
 
 
 
83
  msgid "Database backup done!"
84
  msgstr ""
85
 
86
- #: app/dojob/db.php:37
 
 
 
 
87
  msgid "Create Zip file from dump..."
88
  msgstr ""
89
 
90
- #: app/dojob/db.php:41
91
- msgid "ERROR: Database Zip file create:"
92
  msgstr ""
93
 
94
- #: app/dojob/db.php:44
95
  msgid "Zip file created..."
96
  msgstr ""
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  #: app/dojob/destination-mail.php:3
99
  msgid "Sendig mail..."
100
  msgstr ""
101
 
102
- #: app/dojob/destination-mail.php:9 app/dojob/destination-mail.php:11
 
 
 
 
103
  msgid "Backup Archive too big for sendig by mail"
104
  msgstr ""
105
 
106
- #: app/dojob/destination-mail.php:17
107
  msgid "BackWPup Job:"
108
  msgstr ""
109
 
110
- #: app/dojob/destination-mail.php:18
111
  msgid "Mail send!!!"
112
  msgstr ""
113
 
114
- #: app/dojob/destination-mail.php:20
115
  msgid "Can not send mail!!!"
116
  msgstr ""
117
 
118
- #: app/dojob/file.php:2
119
- msgid "Run File Backup..."
 
 
 
 
 
 
 
 
120
  msgstr ""
121
 
122
- #: app/dojob/file.php:3
123
- msgid "Make File List..."
124
  msgstr ""
125
 
126
- #: app/dojob/file.php:52
127
- msgid "Remove Excludes from file list..."
128
  msgstr ""
129
 
130
- #: app/dojob/file.php:90
131
  msgid "No files to Backup"
132
  msgstr ""
133
 
134
- #: app/dojob/file.php:96
135
- msgid "Files to Backup: "
136
  msgstr ""
137
 
138
- #: app/dojob/file.php:97
139
  msgid "Create Backup Zip file..."
140
  msgstr ""
141
 
142
- #: app/dojob/file.php:101
143
  msgid "Zip file create:"
144
  msgstr ""
145
 
146
- #: app/dojob/file.php:104
147
  msgid "Add Database dump to Backup Zip file..."
148
  msgstr ""
149
 
150
- #: app/dojob/file.php:106
151
  msgid "Zip file create Add Database dump:"
152
  msgstr ""
153
 
154
- #: app/dojob/file.php:112
155
  msgid "Backup Zip file create done!"
156
  msgstr ""
157
 
@@ -159,327 +280,416 @@ msgstr ""
159
  msgid "Run Database optimize..."
160
  msgstr ""
161
 
162
- #: app/dojob/optimize.php:14
163
- msgid "Tables to optimize: "
164
- msgstr ""
165
-
166
- #: app/dojob/optimize.php:20
167
  #, php-format
168
- msgid "BackWPup database error %1$s for query %2$s"
169
  msgstr ""
170
 
171
- #: app/dojob/optimize.php:25
172
  msgid "Database optimize done!"
173
  msgstr ""
174
 
175
- #: app/dojob/optimize.php:27
176
  msgid "No Tables to optimize"
177
  msgstr ""
178
 
179
  #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
180
  #. Plugin Name of an extension
181
- #: app/functions.php:44 app/options.php:3
182
  msgid "BackWPup"
183
  msgstr ""
184
 
185
- #: app/functions.php:52 app/functions.php:207
186
  msgid "Support"
187
  msgstr ""
188
 
189
- #: app/functions.php:53 app/functions.php:206
190
  msgid "FAQ"
191
  msgstr ""
192
 
193
- #: app/functions.php:54
194
  msgid "Plugin Homepage"
195
  msgstr ""
196
 
197
- #: app/functions.php:55
198
  msgid "Plugin Home on WordPress.org"
199
  msgstr ""
200
 
201
- #: app/functions.php:56 app/functions.php:208
202
  msgid "Donate"
203
  msgstr ""
204
 
205
- #: app/functions.php:59
206
  msgid "Version:"
207
  msgstr ""
208
 
209
- #: app/functions.php:60
210
  msgid "Author:"
211
  msgstr ""
212
 
213
- #: app/functions.php:198
214
  msgid "Go to Settings Page"
215
  msgstr ""
216
 
217
- #: app/functions.php:198 app/options.php:8
 
 
218
  msgid "Settings"
219
  msgstr ""
220
 
221
- #: app/functions.php:219
222
  msgid "BackWPup Job "
223
  msgstr ""
224
 
225
- #: app/options-edit.php:3
226
- msgid "Edit BackWPup Job"
 
227
  msgstr ""
228
 
229
- #: app/options-edit.php:34
230
- msgid "Job Type"
 
 
 
 
 
 
231
  msgstr ""
232
 
233
- #: app/options-edit.php:37 app/options-logs.php:67 app/options.php:73
234
  msgid "Database &amp; File Backup"
235
  msgstr ""
236
 
237
- #: app/options-edit.php:38 app/options-logs.php:70 app/options.php:76
238
  msgid "Database Backup"
239
  msgstr ""
240
 
241
- #: app/options-edit.php:39 app/options-logs.php:73 app/options.php:79
242
  msgid "File Backup"
243
  msgstr ""
244
 
245
- #: app/options-edit.php:40 app/options-logs.php:76 app/options.php:82
246
  msgid "Optimize Database Tabels"
247
  msgstr ""
248
 
249
- #: app/options-edit.php:42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  msgid "Change"
251
  msgstr ""
252
 
253
- #: app/options-edit.php:47
254
  msgid "Job Name"
255
  msgstr ""
256
 
257
- #: app/options-edit.php:53
258
  msgid "Exclude Databas Tabels:"
259
  msgstr ""
260
 
261
- #: app/options-edit.php:72
262
  msgid "Backup Blog dirs"
263
  msgstr ""
264
 
265
- #: app/options-edit.php:73
266
  msgid "Blog root and WP Files"
267
  msgstr ""
268
 
269
- #: app/options-edit.php:74
270
  msgid "Blog Content"
271
  msgstr ""
272
 
273
- #: app/options-edit.php:75
274
  msgid "Blog Plugins"
275
  msgstr ""
276
 
277
- #: app/options-edit.php:79
278
  msgid "Include extra dirs"
279
  msgstr ""
280
 
281
- #: app/options-edit.php:80
282
  msgid "Separate with ,. Full Path like:"
283
  msgstr ""
284
 
285
- #: app/options-edit.php:84
286
  msgid "Exclude files/dirs"
287
  msgstr ""
288
 
289
- #: app/options-edit.php:85
290
  msgid "Separate with ,"
291
  msgstr ""
292
 
293
- #: app/options-edit.php:90
294
  msgid "Schedule"
295
  msgstr ""
296
 
297
- #: app/options-edit.php:92
298
  msgid "Run Every:"
299
  msgstr ""
300
 
301
- #: app/options-edit.php:102
302
  msgid "Min(s)"
303
  msgstr ""
304
 
305
- #: app/options-edit.php:103
306
  msgid "Houer(s)"
307
  msgstr ""
308
 
309
- #: app/options-edit.php:104
310
  msgid "Day(s)"
311
  msgstr ""
312
 
313
- #: app/options-edit.php:108
314
  msgid "Start Time:"
315
  msgstr ""
316
 
317
- #: app/options-edit.php:123
318
  msgid "Start Date:"
319
  msgstr ""
320
 
321
- #: app/options-edit.php:129
322
  msgid "January"
323
  msgstr ""
324
 
325
- #: app/options-edit.php:129
326
  msgid "February"
327
  msgstr ""
328
 
329
- #: app/options-edit.php:129
330
  msgid "March"
331
  msgstr ""
332
 
333
- #: app/options-edit.php:129
334
  msgid "April"
335
  msgstr ""
336
 
337
- #: app/options-edit.php:129
338
  msgid "May"
339
  msgstr ""
340
 
341
- #: app/options-edit.php:129
342
  msgid "June"
343
  msgstr ""
344
 
345
- #: app/options-edit.php:129
346
  msgid "July"
347
  msgstr ""
348
 
349
- #: app/options-edit.php:129
350
  msgid "August"
351
  msgstr ""
352
 
353
- #: app/options-edit.php:129
354
  msgid "September"
355
  msgstr ""
356
 
357
- #: app/options-edit.php:129
358
  msgid "October"
359
  msgstr ""
360
 
361
- #: app/options-edit.php:129
362
  msgid "November"
363
  msgstr ""
364
 
365
- #: app/options-edit.php:129
366
  msgid "December"
367
  msgstr ""
368
 
369
- #: app/options-edit.php:142
370
  msgid "Activate:"
371
  msgstr ""
372
 
373
- #: app/options-edit.php:150
374
  msgid "Backup to Directory"
375
  msgstr ""
376
 
377
- #: app/options-edit.php:151
378
  msgid "Full Phath of Directory for Backup fiels"
379
  msgstr ""
380
 
381
- #: app/options-edit.php:154
382
  msgid "Max number of Backup Files"
383
  msgstr ""
384
 
385
- #: app/options-edit.php:158
386
  msgid "Off"
387
  msgstr ""
388
 
389
- #: app/options-edit.php:163
390
  msgid "Oldest files will deletet first."
391
  msgstr ""
392
 
393
- #: app/options-edit.php:171
394
- msgid "Send Mail to"
395
  msgstr ""
396
 
397
- #: app/options-edit.php:177 app/options-settings.php:21
398
- msgid "Save Changes"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  msgstr ""
400
 
401
  #: app/options-logs.php:3
402
  msgid "BackWPup Logs"
403
  msgstr ""
404
 
405
- #: app/options-logs.php:17 app/options-logs.php:132 app/options.php:18
406
- #: app/options.php:118
407
  msgid "Bulk Actions"
408
  msgstr ""
409
 
410
- #: app/options-logs.php:18 app/options-logs.php:90 app/options-logs.php:133
411
- #: app/options.php:19 app/options.php:64 app/options.php:119
412
  msgid "Delete"
413
  msgstr ""
414
 
415
- #: app/options-logs.php:20 app/options-logs.php:135 app/options.php:21
416
- #: app/options.php:121
417
  msgid "Apply"
418
  msgstr ""
419
 
420
- #: app/options-logs.php:32 app/options-logs.php:44
421
  msgid "Job"
422
  msgstr ""
423
 
424
- #: app/options-logs.php:33 app/options-logs.php:45 app/options.php:35
425
  #: app/options.php:46
426
  msgid "Type"
427
  msgstr ""
428
 
429
- #: app/options-logs.php:34 app/options-logs.php:46
430
  msgid "Backup/Log Date/Time"
431
  msgstr ""
432
 
433
- #: app/options-logs.php:35 app/options-logs.php:47
434
  msgid "Status"
435
  msgstr ""
436
 
437
- #: app/options-logs.php:36 app/options-logs.php:48
438
  msgid "Size"
439
  msgstr ""
440
 
441
- #: app/options-logs.php:37 app/options-logs.php:49
442
  msgid "Runtime"
443
  msgstr ""
444
 
445
- #: app/options-logs.php:87
446
  msgid "View log"
447
  msgstr ""
448
 
449
- #: app/options-logs.php:89
450
  msgid "View"
451
  msgstr ""
452
 
453
- #: app/options-logs.php:90 app/options.php:64
454
  msgid ""
455
- "You are about to delete this Job. \n"
456
  " 'Cancel' to stop, 'OK' to delete."
457
  msgstr ""
458
 
459
- #: app/options-logs.php:92
460
  msgid "Download"
461
  msgstr ""
462
 
463
- #: app/options-logs.php:101
464
- msgid "ERROR(S)"
465
- msgstr ""
466
-
467
- #: app/options-logs.php:103
468
- msgid "WARNING(S)"
469
- msgstr ""
470
-
471
- #: app/options-logs.php:105
472
- msgid "OK"
473
- msgstr ""
474
-
475
- #: app/options-logs.php:115
476
  msgid "only Log"
477
  msgstr ""
478
 
479
- #: app/options-logs.php:121 app/options.php:91 app/options.php:104
480
- msgid "sec."
481
- msgstr ""
482
-
483
  #: app/options-runnow.php:3
484
  msgid "BackWPup Job Running"
485
  msgstr ""
@@ -488,7 +698,7 @@ msgstr ""
488
  msgid "Copy of"
489
  msgstr ""
490
 
491
- #: app/options-save.php:58
492
  msgid "File does not exist."
493
  msgstr ""
494
 
@@ -496,20 +706,20 @@ msgstr ""
496
  msgid "BackWPup Settings"
497
  msgstr ""
498
 
499
- #: app/options-view_log.php:3
500
- msgid "BackWPup View Log"
501
  msgstr ""
502
 
503
- #: app/options.php:3
504
- msgid "Add New"
505
  msgstr ""
506
 
507
- #: app/options.php:6
508
- msgid "Jobs"
509
  msgstr ""
510
 
511
- #: app/options.php:7
512
- msgid "Logs"
513
  msgstr ""
514
 
515
  #: app/options.php:33 app/options.php:44
@@ -536,6 +746,12 @@ msgstr ""
536
  msgid "Edit"
537
  msgstr ""
538
 
 
 
 
 
 
 
539
  #: app/options.php:65
540
  msgid "Copy"
541
  msgstr ""
@@ -544,22 +760,18 @@ msgstr ""
544
  msgid "Run Now"
545
  msgstr ""
546
 
547
- #: app/options.php:91
548
- msgid "Running since:"
549
- msgstr ""
550
-
551
- #: app/options.php:95
552
  msgid "Inactive"
553
  msgstr ""
554
 
555
- #: app/options.php:104
556
  msgid "Runtime:"
557
  msgstr ""
558
 
559
- #: app/options.php:106
560
  msgid "None"
561
  msgstr ""
562
 
563
- #: backwpup.php:45
564
  msgid "Sorry, BackWPup works only under WordPress 2.8 or higher"
565
  msgstr ""
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-19 15:25+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"
20
  msgid "Delete old backup files..."
21
  msgstr ""
22
 
23
+ #: app/dojob/after.php:22
24
+ msgid "old backup files deleted!!!"
25
  msgstr ""
26
 
27
+ #: app/dojob/after.php:24
28
+ msgid "old logs deleted!!!"
29
+ msgstr ""
30
+
31
+ #: app/dojob/after.php:31
32
  #, php-format
33
  msgid "Backup zip filesize is %1s"
34
  msgstr ""
35
 
36
+ #: app/dojob/bevore.php:37 app/dojob/destination-ftp.php:26
37
+ #: app/dojob/destination-ftp.php:31 app/dojob/destination-mail.php:13
38
+ #: app/dojob/file.php:38 app/dojob/file.php:41 app/functions.php:293
39
+ #: app/functions.php:312
40
  msgid "WARNING:"
41
  msgstr ""
42
 
43
+ #: app/dojob/bevore.php:37
44
  #, php-format
45
+ msgid "PHP Safe Mode is on!!! Max exec time is %1$s sec."
46
  msgstr ""
47
 
48
+ #: app/dojob/bevore.php:41
49
+ #, php-format
50
+ msgid "Temp dir is %1$s."
51
+ msgstr ""
52
+
53
+ #: app/dojob/bevore.php:45 app/dojob/bevore.php:51 app/dojob/bevore.php:73
54
+ #: app/dojob/bevore.php:79 app/dojob/check.php:19 app/dojob/check.php:24
55
+ #: app/dojob/check.php:31 app/dojob/db.php:19 app/dojob/db.php:28
56
+ #: app/dojob/db.php:79 app/dojob/db.php:127 app/dojob/db.php:130
57
+ #: app/dojob/db.php:141 app/dojob/destination-ftp.php:36
58
+ #: app/dojob/destination-ftp.php:50 app/dojob/destination-ftp.php:57
59
+ #: app/dojob/destination-ftp.php:61 app/dojob/destination-mail.php:8
60
+ #: app/dojob/destination-mail.php:15 app/dojob/destination-mail.php:23
61
+ #: app/dojob/file.php:84 app/dojob/file.php:97 app/dojob/file.php:103
62
+ #: app/dojob/optimize.php:19 app/dojob/optimize.php:25 app/functions.php:300
63
+ #: app/functions.php:310
64
  msgid "ERROR:"
65
  msgstr ""
66
 
67
+ #: app/dojob/bevore.php:45
68
  msgid "Can not create Temp dir"
69
  msgstr ""
70
 
71
+ #: app/dojob/bevore.php:51
72
  msgid "Can not write to Temp dir"
73
  msgstr ""
74
 
75
+ #: app/dojob/bevore.php:73
76
  msgid "Can not create Backup dir"
77
  msgstr ""
78
 
79
+ #: app/dojob/bevore.php:79
80
  msgid "Can not write to Backup dir"
81
  msgstr ""
82
 
83
+ #: app/dojob/bevore.php:95
84
  msgid "Backup zip file save to:"
85
  msgstr ""
86
 
87
+ #: app/dojob/check.php:3
88
+ msgid "Run Database check..."
89
+ msgstr ""
90
+
91
+ #: app/dojob/check.php:17 app/dojob/check.php:22 app/dojob/optimize.php:17
92
+ msgid ":"
93
+ msgstr ""
94
+
95
+ #: app/dojob/check.php:17
96
+ #, php-format
97
+ msgid "Result of table check for %1$s is: %2$s"
98
+ msgstr ""
99
+
100
+ #: app/dojob/check.php:19 app/dojob/check.php:24 app/dojob/db.php:19
101
+ #: app/dojob/db.php:28 app/dojob/db.php:79 app/dojob/optimize.php:19
102
+ #, php-format
103
+ msgid "BackWPup database error %1$s for query %2$s"
104
+ msgstr ""
105
+
106
+ #: app/dojob/check.php:22
107
+ #, php-format
108
+ msgid "Result of table repair for %1$s is: %2$s "
109
+ msgstr ""
110
+
111
+ #: app/dojob/check.php:29
112
+ msgid "Database check done!"
113
+ msgstr ""
114
+
115
+ #: app/dojob/check.php:31
116
+ msgid "No Tables to check"
117
+ msgstr ""
118
+
119
  #: app/dojob/db.php:2
120
  msgid "Run Database Backup..."
121
  msgstr ""
122
 
123
+ #: app/dojob/db.php:111
124
+ msgid "Database table to Backup: "
125
  msgstr ""
126
 
127
+ #: app/dojob/db.php:127
128
+ msgid "Can not create Database Backup file"
129
  msgstr ""
130
 
131
+ #: app/dojob/db.php:130
132
+ msgid "No Tables to Backup"
133
+ msgstr ""
134
+
135
+ #: app/dojob/db.php:134
136
  msgid "Database backup done!"
137
  msgstr ""
138
 
139
+ #: app/dojob/db.php:137 app/dojob/file.php:100
140
+ msgid "Database file size:"
141
+ msgstr ""
142
+
143
+ #: app/dojob/db.php:138
144
  msgid "Create Zip file from dump..."
145
  msgstr ""
146
 
147
+ #: app/dojob/db.php:141
148
+ msgid "Database Zip file create:"
149
  msgstr ""
150
 
151
+ #: app/dojob/db.php:144
152
  msgid "Zip file created..."
153
  msgstr ""
154
 
155
+ #: app/dojob/destination-ftp.php:11
156
+ msgid "Connected by SSL to FTP server:"
157
+ msgstr ""
158
+
159
+ #: app/dojob/destination-ftp.php:16
160
+ msgid "Connected insecure to FTP server:"
161
+ msgstr ""
162
+
163
+ #: app/dojob/destination-ftp.php:21
164
+ msgid "Logt on to FTP server with user:"
165
+ msgstr ""
166
+
167
+ #: app/dojob/destination-ftp.php:24
168
+ msgid "FTP set to passiv."
169
+ msgstr ""
170
+
171
+ #: app/dojob/destination-ftp.php:26
172
+ msgid "Can not set FTP Server to passiv!"
173
+ msgstr ""
174
+
175
+ #: app/dojob/destination-ftp.php:29
176
+ msgid "Space successfully allocated on FTP server. Sending backup file."
177
+ msgstr ""
178
+
179
+ #: app/dojob/destination-ftp.php:31
180
+ msgid "Unable to allocate space on server. FTP Server said:"
181
+ msgstr ""
182
+
183
+ #: app/dojob/destination-ftp.php:34
184
+ msgid "Backup File transfered to FTP Server:"
185
+ msgstr ""
186
+
187
+ #: app/dojob/destination-ftp.php:36
188
+ msgid "Can not tranfer backup to FTP server."
189
+ msgstr ""
190
+
191
+ #: app/dojob/destination-ftp.php:50
192
+ msgid "Can not delete file on FTP Server:"
193
+ msgstr ""
194
+
195
+ #: app/dojob/destination-ftp.php:53
196
+ msgid "files deleted on FTP Server:"
197
+ msgstr ""
198
+
199
+ #: app/dojob/destination-ftp.php:57
200
+ msgid "Can not login to FTP server with user:"
201
+ msgstr ""
202
+
203
+ #: app/dojob/destination-ftp.php:61
204
+ msgid "Can not connect to FTP server:"
205
+ msgstr ""
206
+
207
  #: app/dojob/destination-mail.php:3
208
  msgid "Sendig mail..."
209
  msgstr ""
210
 
211
+ #: app/dojob/destination-mail.php:8
212
+ msgid "Out of Memory for sending Backup Archive by mail"
213
+ msgstr ""
214
+
215
+ #: app/dojob/destination-mail.php:13 app/dojob/destination-mail.php:15
216
  msgid "Backup Archive too big for sendig by mail"
217
  msgstr ""
218
 
219
+ #: app/dojob/destination-mail.php:20
220
  msgid "BackWPup Job:"
221
  msgstr ""
222
 
223
+ #: app/dojob/destination-mail.php:21
224
  msgid "Mail send!!!"
225
  msgstr ""
226
 
227
+ #: app/dojob/destination-mail.php:23
228
  msgid "Can not send mail!!!"
229
  msgstr ""
230
 
231
+ #: app/dojob/file.php:4
232
+ msgid "Run file backup..."
233
+ msgstr ""
234
+
235
+ #: app/dojob/file.php:5
236
+ msgid "Get files to backup..."
237
+ msgstr ""
238
+
239
+ #: app/dojob/file.php:36
240
+ msgid "File to Backup:"
241
  msgstr ""
242
 
243
+ #: app/dojob/file.php:38
244
+ msgid "Can not read file:"
245
  msgstr ""
246
 
247
+ #: app/dojob/file.php:41
248
+ msgid "Is not a file or directory:"
249
  msgstr ""
250
 
251
+ #: app/dojob/file.php:84
252
  msgid "No files to Backup"
253
  msgstr ""
254
 
255
+ #: app/dojob/file.php:87
256
+ msgid "Size off all files:"
257
  msgstr ""
258
 
259
+ #: app/dojob/file.php:94
260
  msgid "Create Backup Zip file..."
261
  msgstr ""
262
 
263
+ #: app/dojob/file.php:97
264
  msgid "Zip file create:"
265
  msgstr ""
266
 
267
+ #: app/dojob/file.php:101
268
  msgid "Add Database dump to Backup Zip file..."
269
  msgstr ""
270
 
271
+ #: app/dojob/file.php:103
272
  msgid "Zip file create Add Database dump:"
273
  msgstr ""
274
 
275
+ #: app/dojob/file.php:109
276
  msgid "Backup Zip file create done!"
277
  msgstr ""
278
 
280
  msgid "Run Database optimize..."
281
  msgstr ""
282
 
283
+ #: app/dojob/optimize.php:17
 
 
 
 
284
  #, php-format
285
+ msgid "Result of table optimize for %1$s is: %2$s"
286
  msgstr ""
287
 
288
+ #: app/dojob/optimize.php:23
289
  msgid "Database optimize done!"
290
  msgstr ""
291
 
292
+ #: app/dojob/optimize.php:25
293
  msgid "No Tables to optimize"
294
  msgstr ""
295
 
296
  #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
297
  #. Plugin Name of an extension
298
+ #: app/functions.php:19 app/options.php:3
299
  msgid "BackWPup"
300
  msgstr ""
301
 
302
+ #: app/functions.php:27 app/functions.php:218
303
  msgid "Support"
304
  msgstr ""
305
 
306
+ #: app/functions.php:28 app/functions.php:217
307
  msgid "FAQ"
308
  msgstr ""
309
 
310
+ #: app/functions.php:29
311
  msgid "Plugin Homepage"
312
  msgstr ""
313
 
314
+ #: app/functions.php:30
315
  msgid "Plugin Home on WordPress.org"
316
  msgstr ""
317
 
318
+ #: app/functions.php:31 app/functions.php:219
319
  msgid "Donate"
320
  msgstr ""
321
 
322
+ #: app/functions.php:34
323
  msgid "Version:"
324
  msgstr ""
325
 
326
+ #: app/functions.php:35
327
  msgid "Author:"
328
  msgstr ""
329
 
330
+ #: app/functions.php:209
331
  msgid "Go to Settings Page"
332
  msgstr ""
333
 
334
+ #: app/functions.php:209 app/options-db_restore.php:8 app/options-logs.php:8
335
+ #: app/options-runnow.php:8 app/options-settings.php:8
336
+ #: app/options-view_log.php:8 app/options.php:8
337
  msgid "Settings"
338
  msgstr ""
339
 
340
+ #: app/functions.php:230
341
  msgid "BackWPup Job "
342
  msgstr ""
343
 
344
+ #: app/functions.php:293
345
+ #, php-format
346
+ msgid "PHP Safe Mode is on!!! Can not increse Memory Limit is %1$s"
347
  msgstr ""
348
 
349
+ #: app/functions.php:298
350
+ #, php-format
351
+ msgid "Memory incresed from %1$s to %2$s"
352
+ msgstr ""
353
+
354
+ #: app/functions.php:300
355
+ #, php-format
356
+ msgid "Can not increse Memory Limit is %1$s"
357
  msgstr ""
358
 
359
+ #: app/functions.php:335
360
  msgid "Database &amp; File Backup"
361
  msgstr ""
362
 
363
+ #: app/functions.php:338
364
  msgid "Database Backup"
365
  msgstr ""
366
 
367
+ #: app/functions.php:341
368
  msgid "File Backup"
369
  msgstr ""
370
 
371
+ #: app/functions.php:344
372
  msgid "Optimize Database Tabels"
373
  msgstr ""
374
 
375
+ #: app/functions.php:347
376
+ msgid "Check Database Tabels"
377
+ msgstr ""
378
+
379
+ #: app/functions.php:362
380
+ msgid "Logs:"
381
+ msgstr ""
382
+
383
+ #: app/functions.php:367
384
+ msgid "View Log"
385
+ msgstr ""
386
+
387
+ #: app/functions.php:375 app/options-logs.php:90
388
+ msgid "ERROR(S)"
389
+ msgstr ""
390
+
391
+ #: app/functions.php:377 app/options-logs.php:92
392
+ msgid "WARNING(S)"
393
+ msgstr ""
394
+
395
+ #: app/functions.php:379 app/options-logs.php:94
396
+ msgid "OK"
397
+ msgstr ""
398
+
399
+ #: app/functions.php:384 app/functions.php:403
400
+ msgid "none"
401
+ msgstr ""
402
+
403
+ #: app/functions.php:388
404
+ msgid "Scheduled Jobs:"
405
+ msgstr ""
406
+
407
+ #: app/functions.php:392
408
+ msgid "Edit Job"
409
+ msgstr ""
410
+
411
+ #: app/functions.php:395 app/options.php:78
412
+ msgid "Running since:"
413
+ msgstr ""
414
+
415
+ #: app/functions.php:395 app/options-logs.php:110 app/options-settings.php:21
416
+ #: app/options.php:78 app/options.php:91
417
+ msgid "sec."
418
+ msgstr ""
419
+
420
+ #: app/options-db_restore.php:3
421
+ msgid "BackWPup Restore Database"
422
+ msgstr ""
423
+
424
+ #: app/options-db_restore.php:5 app/options-logs.php:5
425
+ #: app/options-runnow.php:5 app/options-settings.php:5
426
+ #: app/options-view_log.php:5 app/options.php:5
427
+ msgid "Jobs"
428
+ msgstr ""
429
+
430
+ #: app/options-db_restore.php:6 app/options-logs.php:6
431
+ #: app/options-runnow.php:6 app/options-settings.php:6
432
+ #: app/options-view_log.php:6 app/options.php:6
433
+ msgid "Logs"
434
+ msgstr ""
435
+
436
+ #: app/options-db_restore.php:7 app/options-logs.php:7
437
+ #: app/options-runnow.php:7 app/options-settings.php:7
438
+ #: app/options-view_log.php:7 app/options.php:7
439
+ msgid "DB Restore"
440
+ msgstr ""
441
+
442
+ #: app/options-db_restore.php:22 app/options-edit.php:200
443
+ #: app/options-settings.php:29
444
+ msgid "Save Changes"
445
+ msgstr ""
446
+
447
+ #: app/options-edit.php:3
448
+ msgid "Edit BackWPup Job"
449
+ msgstr ""
450
+
451
+ #: app/options-edit.php:34
452
+ msgid "Job Type"
453
+ msgstr ""
454
+
455
+ #: app/options-edit.php:43
456
  msgid "Change"
457
  msgstr ""
458
 
459
+ #: app/options-edit.php:48
460
  msgid "Job Name"
461
  msgstr ""
462
 
463
+ #: app/options-edit.php:54
464
  msgid "Exclude Databas Tabels:"
465
  msgstr ""
466
 
467
+ #: app/options-edit.php:74
468
  msgid "Backup Blog dirs"
469
  msgstr ""
470
 
471
+ #: app/options-edit.php:75
472
  msgid "Blog root and WP Files"
473
  msgstr ""
474
 
475
+ #: app/options-edit.php:76
476
  msgid "Blog Content"
477
  msgstr ""
478
 
479
+ #: app/options-edit.php:77
480
  msgid "Blog Plugins"
481
  msgstr ""
482
 
483
+ #: app/options-edit.php:81
484
  msgid "Include extra dirs"
485
  msgstr ""
486
 
487
+ #: app/options-edit.php:82
488
  msgid "Separate with ,. Full Path like:"
489
  msgstr ""
490
 
491
+ #: app/options-edit.php:86
492
  msgid "Exclude files/dirs"
493
  msgstr ""
494
 
495
+ #: app/options-edit.php:87
496
  msgid "Separate with ,"
497
  msgstr ""
498
 
499
+ #: app/options-edit.php:92
500
  msgid "Schedule"
501
  msgstr ""
502
 
503
+ #: app/options-edit.php:94
504
  msgid "Run Every:"
505
  msgstr ""
506
 
507
+ #: app/options-edit.php:104
508
  msgid "Min(s)"
509
  msgstr ""
510
 
511
+ #: app/options-edit.php:105
512
  msgid "Houer(s)"
513
  msgstr ""
514
 
515
+ #: app/options-edit.php:106
516
  msgid "Day(s)"
517
  msgstr ""
518
 
519
+ #: app/options-edit.php:110
520
  msgid "Start Time:"
521
  msgstr ""
522
 
523
+ #: app/options-edit.php:125
524
  msgid "Start Date:"
525
  msgstr ""
526
 
527
+ #: app/options-edit.php:131
528
  msgid "January"
529
  msgstr ""
530
 
531
+ #: app/options-edit.php:131
532
  msgid "February"
533
  msgstr ""
534
 
535
+ #: app/options-edit.php:131
536
  msgid "March"
537
  msgstr ""
538
 
539
+ #: app/options-edit.php:131
540
  msgid "April"
541
  msgstr ""
542
 
543
+ #: app/options-edit.php:131
544
  msgid "May"
545
  msgstr ""
546
 
547
+ #: app/options-edit.php:131
548
  msgid "June"
549
  msgstr ""
550
 
551
+ #: app/options-edit.php:131
552
  msgid "July"
553
  msgstr ""
554
 
555
+ #: app/options-edit.php:131
556
  msgid "August"
557
  msgstr ""
558
 
559
+ #: app/options-edit.php:131
560
  msgid "September"
561
  msgstr ""
562
 
563
+ #: app/options-edit.php:131
564
  msgid "October"
565
  msgstr ""
566
 
567
+ #: app/options-edit.php:131
568
  msgid "November"
569
  msgstr ""
570
 
571
+ #: app/options-edit.php:131
572
  msgid "December"
573
  msgstr ""
574
 
575
+ #: app/options-edit.php:144
576
  msgid "Activate:"
577
  msgstr ""
578
 
579
+ #: app/options-edit.php:152
580
  msgid "Backup to Directory"
581
  msgstr ""
582
 
583
+ #: app/options-edit.php:153
584
  msgid "Full Phath of Directory for Backup fiels"
585
  msgstr ""
586
 
587
+ #: app/options-edit.php:156
588
  msgid "Max number of Backup Files"
589
  msgstr ""
590
 
591
+ #: app/options-edit.php:160 app/options-edit.php:181
592
  msgid "Off"
593
  msgstr ""
594
 
595
+ #: app/options-edit.php:165
596
  msgid "Oldest files will deletet first."
597
  msgstr ""
598
 
599
+ #: app/options-edit.php:172
600
+ msgid "Place Backup to FTP Server:"
601
  msgstr ""
602
 
603
+ #: app/options-edit.php:174
604
+ msgid "Ftp Hostname:"
605
+ msgstr ""
606
+
607
+ #: app/options-edit.php:175
608
+ msgid "Ftp Username:"
609
+ msgstr ""
610
+
611
+ #: app/options-edit.php:176
612
+ msgid "Ftp Password:"
613
+ msgstr ""
614
+
615
+ #: app/options-edit.php:177
616
+ msgid "Ftp directory:"
617
+ msgstr ""
618
+
619
+ #: app/options-edit.php:178
620
+ msgid "Max Backup fieles on ftp:"
621
+ msgstr ""
622
+
623
+ #: app/options-edit.php:194
624
+ msgid "Send Mail to"
625
  msgstr ""
626
 
627
  #: app/options-logs.php:3
628
  msgid "BackWPup Logs"
629
  msgstr ""
630
 
631
+ #: app/options-logs.php:18 app/options-logs.php:121 app/options.php:18
632
+ #: app/options.php:105
633
  msgid "Bulk Actions"
634
  msgstr ""
635
 
636
+ #: app/options-logs.php:19 app/options-logs.php:79 app/options-logs.php:122
637
+ #: app/options.php:19 app/options.php:64 app/options.php:106
638
  msgid "Delete"
639
  msgstr ""
640
 
641
+ #: app/options-logs.php:21 app/options-logs.php:124 app/options.php:21
642
+ #: app/options.php:108
643
  msgid "Apply"
644
  msgstr ""
645
 
646
+ #: app/options-logs.php:33 app/options-logs.php:45
647
  msgid "Job"
648
  msgstr ""
649
 
650
+ #: app/options-logs.php:34 app/options-logs.php:46 app/options.php:35
651
  #: app/options.php:46
652
  msgid "Type"
653
  msgstr ""
654
 
655
+ #: app/options-logs.php:35 app/options-logs.php:47
656
  msgid "Backup/Log Date/Time"
657
  msgstr ""
658
 
659
+ #: app/options-logs.php:36 app/options-logs.php:48
660
  msgid "Status"
661
  msgstr ""
662
 
663
+ #: app/options-logs.php:37 app/options-logs.php:49
664
  msgid "Size"
665
  msgstr ""
666
 
667
+ #: app/options-logs.php:38 app/options-logs.php:50
668
  msgid "Runtime"
669
  msgstr ""
670
 
671
+ #: app/options-logs.php:76
672
  msgid "View log"
673
  msgstr ""
674
 
675
+ #: app/options-logs.php:78
676
  msgid "View"
677
  msgstr ""
678
 
679
+ #: app/options-logs.php:79
680
  msgid ""
681
+ "You are about to delete this Log and Backupfile. \n"
682
  " 'Cancel' to stop, 'OK' to delete."
683
  msgstr ""
684
 
685
+ #: app/options-logs.php:81
686
  msgid "Download"
687
  msgstr ""
688
 
689
+ #: app/options-logs.php:104
 
 
 
 
 
 
 
 
 
 
 
 
690
  msgid "only Log"
691
  msgstr ""
692
 
 
 
 
 
693
  #: app/options-runnow.php:3
694
  msgid "BackWPup Job Running"
695
  msgstr ""
698
  msgid "Copy of"
699
  msgstr ""
700
 
701
+ #: app/options-save.php:59
702
  msgid "File does not exist."
703
  msgstr ""
704
 
706
  msgid "BackWPup Settings"
707
  msgstr ""
708
 
709
+ #: app/options-settings.php:18
710
+ msgid "Script Runime"
711
  msgstr ""
712
 
713
+ #: app/options-settings.php:21
714
+ msgid "PHP.ini execution time:"
715
  msgstr ""
716
 
717
+ #: app/options-view_log.php:3
718
+ msgid "BackWPup View Log"
719
  msgstr ""
720
 
721
+ #: app/options.php:3
722
+ msgid "Add New"
723
  msgstr ""
724
 
725
  #: app/options.php:33 app/options.php:44
746
  msgid "Edit"
747
  msgstr ""
748
 
749
+ #: app/options.php:64
750
+ msgid ""
751
+ "You are about to delete this Job. \n"
752
+ " 'Cancel' to stop, 'OK' to delete."
753
+ msgstr ""
754
+
755
  #: app/options.php:65
756
  msgid "Copy"
757
  msgstr ""
760
  msgid "Run Now"
761
  msgstr ""
762
 
763
+ #: app/options.php:82
 
 
 
 
764
  msgid "Inactive"
765
  msgstr ""
766
 
767
+ #: app/options.php:91
768
  msgid "Runtime:"
769
  msgstr ""
770
 
771
+ #: app/options.php:93
772
  msgid "None"
773
  msgstr ""
774
 
775
+ #: backwpup.php:53
776
  msgid "Sorry, BackWPup works only under WordPress 2.8 or higher"
777
  msgstr ""
readme.txt CHANGED
@@ -1,10 +1,10 @@
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.5
8
 
9
  Backup and more of your WordPress Blog Database and Files
10
 
@@ -14,13 +14,17 @@ 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
 
@@ -43,8 +47,16 @@ You must import the Database Dump with Charaktercoding:latin1
43
 
44
  1. Job Page
45
 
46
-
47
  == Changelog ==
 
 
 
 
 
 
 
 
 
48
 
49
  = 0.5.5 =
50
  * removed log files. Log now stred in Database
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.6.0
8
 
9
  Backup and more of your WordPress Blog Database and Files
10
 
14
 
15
  Backup and more your Blog.
16
 
17
+ * Database Backup
18
+ * Optimize Database
19
+ * Check\Repair Database
20
  * File Backup
21
  * Uses PCLZIP class of Wordpress
22
+ * Store backup to Folder
23
+ * Store backup to FTP Server
24
+ * Send Log/Backup by eMail
25
 
26
 
27
+ I can give no WARRANTY to any backups...
28
 
29
  == Installation ==
30
 
47
 
48
  1. Job Page
49
 
 
50
  == Changelog ==
51
+ = 0.6.0 dev.=
52
+ * Add Dashboard Widget
53
+ * Add Database Check
54
+ * Add Backup file transfer to FTP Server
55
+ * Save log fieles in own database table
56
+ * Optimize Memory usage
57
+ * Optimize File system access
58
+ * DB dump with own function
59
+ * fixed some Bugs
60
 
61
  = 0.5.5 =
62
  * removed log files. Log now stred in Database