Backup and Restore WordPress – WPBackItUp Backup Plugin - Version 1.4.2

Version Description

Changed DB backup method to work on shared hosting.

Download this release

Release Info

Developer jcpeden
Plugin Icon 128x128 Backup and Restore WordPress – WPBackItUp Backup Plugin
Version 1.4.2
Comparing to
See all releases

Code changes from version 1.4.1 to 1.4.2

index.php CHANGED
@@ -7,13 +7,13 @@
7
  * @global object $wpdb
8
  *
9
  * @author jcpeden
10
- * @version 1.4.1
11
  */
12
  /*
13
  Plugin Name: WP Backitup
14
  Plugin URI: http://www.wpbackitup.com
15
  Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
16
- Version: 1.4.1
17
  Author: John Peden
18
  Author URI: http://www.johncpeden.com
19
  License: GPL3
7
  * @global object $wpdb
8
  *
9
  * @author jcpeden
10
+ * @version 1.4.2
11
  */
12
  /*
13
  Plugin Name: WP Backitup
14
  Plugin URI: http://www.wpbackitup.com
15
  Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
16
+ Version: 1.4.2
17
  Author: John Peden
18
  Author URI: http://www.johncpeden.com
19
  License: GPL3
languages/en-GB.mo CHANGED
Binary file
languages/en-GB.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP Backitup\n"
4
- "POT-Creation-Date: 2013-07-29 00:59-0000\n"
5
- "PO-Revision-Date: 2013-07-29 00:59-0000\n"
6
  "Last-Translator: John Peden <john.peden@britishcouncil.org>\n"
7
  "Language-Team: John Peden Ltd <mail@johncpeden.com>\n"
8
  "Language: English\n"
@@ -16,7 +16,7 @@ msgstr ""
16
  "X-Poedit-SearchPath-0: .\n"
17
  "X-Poedit-SearchPath-1: ..\n"
18
 
19
- #: ../index.php:313
20
  msgid "Manage"
21
  msgstr ""
22
 
@@ -60,37 +60,37 @@ msgstr ""
60
 
61
  #: ../views/options.php:45 ../views/options.php:46 ../views/options.php:47
62
  #: ../views/options.php:48 ../views/options.php:49 ../views/options.php:50
63
- #: ../views/options.php:66 ../views/options.php:67 ../views/options.php:68
64
- #: ../views/options.php:69 ../views/options.php:70 ../views/options.php:71
65
- #: ../views/options.php:72
66
  msgid "Done"
67
  msgstr ""
68
 
69
  #: ../views/options.php:45 ../views/options.php:46 ../views/options.php:47
70
  #: ../views/options.php:48 ../views/options.php:49 ../views/options.php:50
71
- #: ../views/options.php:66 ../views/options.php:67 ../views/options.php:68
72
- #: ../views/options.php:69 ../views/options.php:70 ../views/options.php:71
73
- #: ../views/options.php:72
74
  msgid "Failed"
75
  msgstr ""
76
 
77
  #: ../views/options.php:46
78
- msgid "Backing-up /wp-content/"
79
  msgstr ""
80
 
81
  #: ../views/options.php:47
82
- msgid "Backing-up database"
83
  msgstr ""
84
 
85
  #: ../views/options.php:48
86
- msgid "Creating backup directory"
87
  msgstr ""
88
 
89
  #: ../views/options.php:49
90
  msgid "Zipping backup directory"
91
  msgstr ""
92
 
93
- #: ../views/options.php:50 ../views/options.php:72
94
  msgid "Cleaning up"
95
  msgstr ""
96
 
@@ -121,206 +121,213 @@ msgid "Error: Unable to backup your database. Please try again"
121
  msgstr ""
122
 
123
  #: ../views/options.php:60
124
- msgid "Error: Unable to create site information file. Please try again"
 
 
 
125
  msgstr ""
126
 
127
  #: ../views/options.php:61
 
 
 
 
128
  msgid "Warning: Unable to cleanup your backup directory"
129
  msgstr ""
130
 
131
- #: ../views/options.php:66
132
  msgid "Uploading restoration zip"
133
  msgstr ""
134
 
135
- #: ../views/options.php:67
136
  msgid "Unzipping"
137
  msgstr ""
138
 
139
- #: ../views/options.php:68
140
  msgid "Validating restoration zip"
141
  msgstr ""
142
 
143
- #: ../views/options.php:69
144
  msgid "Setting checkpoint"
145
  msgstr ""
146
 
147
- #: ../views/options.php:70
148
  msgid "Importing database"
149
  msgstr ""
150
 
151
- #: ../views/options.php:71
152
  msgid "Importing /wp-content/ directory"
153
  msgstr ""
154
 
155
- #: ../views/options.php:73
156
  msgid ""
157
  "Restoration completed successfully. Please refresh the page and login to the "
158
  "site again (with your current username and password)"
159
  msgstr ""
160
 
161
- #: ../views/options.php:78
162
  msgid "Error: No file selected"
163
  msgstr ""
164
 
165
- #: ../views/options.php:79
166
  msgid "Error: Your file could not be uploaded"
167
  msgstr ""
168
 
169
- #: ../views/options.php:80
170
  msgid "Error: Your restoration file could not be unzipped"
171
  msgstr ""
172
 
173
- #: ../views/options.php:81
174
  msgid ""
175
  "Error: Your zip file appears to be invalid. Please ensure you chose the "
176
  "correct zip file"
177
  msgstr ""
178
 
179
- #: ../views/options.php:82
180
  msgid "Error: Cannot create restore point"
181
  msgstr ""
182
 
183
- #: ../views/options.php:83
184
  msgid "Error: Unable to connect to your database"
185
  msgstr ""
186
 
187
- #: ../views/options.php:84
188
  msgid "Error: Unable to get current site URL from database. Please try again"
189
  msgstr ""
190
 
191
- #: ../views/options.php:85
192
  msgid "Error: Unable to get current home URL from database. Please try again"
193
  msgstr ""
194
 
195
- #: ../views/options.php:86
196
  msgid "Error: Unable to get current user ID from database. Please try again"
197
  msgstr ""
198
 
199
- #: ../views/options.php:87
200
  msgid ""
201
  "Error: Unable to get current user password from database. Please try again"
202
  msgstr ""
203
 
204
- #: ../views/options.php:88
205
  msgid "Error: Unable to get current user email from database. Please try again"
206
  msgstr ""
207
 
208
- #: ../views/options.php:89
209
  msgid ""
210
  "Error: Unable to get import your database. This may require importing the "
211
  "file manually"
212
  msgstr ""
213
 
214
- #: ../views/options.php:90
215
  msgid ""
216
  "Error: Unable to update your current site URL value. This may require "
217
  "importing the file manually"
218
  msgstr ""
219
 
220
- #: ../views/options.php:91
221
  msgid ""
222
  "Error: Unable to update your current home URL value. This may require "
223
  "importing the file manually"
224
  msgstr ""
225
 
226
- #: ../views/options.php:92
227
  msgid ""
228
  "Error: Unable to update your user information. This may require importing "
229
  "the file manually"
230
  msgstr ""
231
 
232
- #: ../views/options.php:93
233
  msgid "Error: Warning: Database not detected in import file"
234
  msgstr ""
235
 
236
- #: ../views/options.php:94
237
  msgid ""
238
  "Error: Unable to remove existing wp-content directory for import. Please "
239
  "check your CHMOD settings in /wp-content/"
240
  msgstr ""
241
 
242
- #: ../views/options.php:95
243
  msgid ""
244
  "Error: Unable to create new wp-content directory for import. Please check "
245
  "your CHMOD settings in /wp-content/"
246
  msgstr ""
247
 
248
- #: ../views/options.php:96
249
  msgid "Error: Unable to import wp-content. Please try again"
250
  msgstr ""
251
 
252
- #: ../views/options.php:97
253
  msgid "Warning: Unable to cleanup import directory"
254
  msgstr ""
255
 
256
- #: ../views/options.php:108
257
  msgid "License Key"
258
  msgstr ""
259
 
260
- #: ../views/options.php:112
261
  msgid "Pro features and auto-updates enabled"
262
  msgstr ""
263
 
264
- #: ../views/options.php:114
265
  msgid "Activate auto-restore and auto-updates by entering your license key"
266
  msgstr ""
267
 
268
- #: ../views/options.php:119
269
  msgid "Active"
270
  msgstr ""
271
 
272
- #: ../views/options.php:120
273
  msgid "Update"
274
  msgstr ""
275
 
276
- #: ../views/options.php:122
277
  msgid "Inactive"
278
  msgstr ""
279
 
280
- #: ../views/options.php:123
281
  msgid "Activate"
282
  msgstr ""
283
 
284
- #: ../views/options.php:124
285
  msgid "Purchase a license key"
286
  msgstr ""
287
 
288
- #: ../views/options.php:131
289
  msgid "WP Backitup support system"
290
  msgstr ""
291
 
292
- #: ../views/options.php:134
293
  msgid "support system"
294
  msgstr ""
295
 
296
- #: ../views/options.php:137
297
  msgid "Need Help?"
298
  msgstr ""
299
 
300
- #: ../views/options.php:138
301
  msgid "Access the"
302
  msgstr ""
303
 
304
- #: ../views/options.php:142
305
  msgid "Spread the Word"
306
  msgstr ""
307
 
308
- #: ../views/options.php:143
309
  msgid "Rate WP Backitup"
310
  msgstr ""
311
 
312
- #: ../views/options.php:148
313
  msgid "Enable"
314
  msgstr ""
315
 
316
- #: ../views/options.php:149
317
  msgid "Disable"
318
  msgstr ""
319
 
320
- #: ../views/options.php:150
321
  msgid "Help to improve Easy Webtrends by enabling"
322
  msgstr ""
323
 
324
- #: ../views/options.php:151
325
  msgid "Save"
326
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP Backitup\n"
4
+ "POT-Creation-Date: 2013-09-07 19:24-0000\n"
5
+ "PO-Revision-Date: 2013-09-07 19:24-0000\n"
6
  "Last-Translator: John Peden <john.peden@britishcouncil.org>\n"
7
  "Language-Team: John Peden Ltd <mail@johncpeden.com>\n"
8
  "Language: English\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
  "X-Poedit-SearchPath-1: ..\n"
18
 
19
+ #: ../index.php:312
20
  msgid "Manage"
21
  msgstr ""
22
 
60
 
61
  #: ../views/options.php:45 ../views/options.php:46 ../views/options.php:47
62
  #: ../views/options.php:48 ../views/options.php:49 ../views/options.php:50
63
+ #: ../views/options.php:67 ../views/options.php:68 ../views/options.php:69
64
+ #: ../views/options.php:70 ../views/options.php:71 ../views/options.php:72
65
+ #: ../views/options.php:73
66
  msgid "Done"
67
  msgstr ""
68
 
69
  #: ../views/options.php:45 ../views/options.php:46 ../views/options.php:47
70
  #: ../views/options.php:48 ../views/options.php:49 ../views/options.php:50
71
+ #: ../views/options.php:67 ../views/options.php:68 ../views/options.php:69
72
+ #: ../views/options.php:70 ../views/options.php:71 ../views/options.php:72
73
+ #: ../views/options.php:73
74
  msgid "Failed"
75
  msgstr ""
76
 
77
  #: ../views/options.php:46
78
+ msgid "Backing-up database"
79
  msgstr ""
80
 
81
  #: ../views/options.php:47
82
+ msgid "Backing-up /wp-content/"
83
  msgstr ""
84
 
85
  #: ../views/options.php:48
86
+ msgid "Creating backup information file"
87
  msgstr ""
88
 
89
  #: ../views/options.php:49
90
  msgid "Zipping backup directory"
91
  msgstr ""
92
 
93
+ #: ../views/options.php:50 ../views/options.php:73
94
  msgid "Cleaning up"
95
  msgstr ""
96
 
121
  msgstr ""
122
 
123
  #: ../views/options.php:60
124
+ msgid ""
125
+ "Error: Your database was accesible but a dump could not be created. Please "
126
+ "contact support by clicking the link on the right, stating your web host "
127
+ "when you submit the form."
128
  msgstr ""
129
 
130
  #: ../views/options.php:61
131
+ msgid "Error: Unable to create site information file. Please try again"
132
+ msgstr ""
133
+
134
+ #: ../views/options.php:62
135
  msgid "Warning: Unable to cleanup your backup directory"
136
  msgstr ""
137
 
138
+ #: ../views/options.php:67
139
  msgid "Uploading restoration zip"
140
  msgstr ""
141
 
142
+ #: ../views/options.php:68
143
  msgid "Unzipping"
144
  msgstr ""
145
 
146
+ #: ../views/options.php:69
147
  msgid "Validating restoration zip"
148
  msgstr ""
149
 
150
+ #: ../views/options.php:70
151
  msgid "Setting checkpoint"
152
  msgstr ""
153
 
154
+ #: ../views/options.php:71
155
  msgid "Importing database"
156
  msgstr ""
157
 
158
+ #: ../views/options.php:72
159
  msgid "Importing /wp-content/ directory"
160
  msgstr ""
161
 
162
+ #: ../views/options.php:74
163
  msgid ""
164
  "Restoration completed successfully. Please refresh the page and login to the "
165
  "site again (with your current username and password)"
166
  msgstr ""
167
 
168
+ #: ../views/options.php:79
169
  msgid "Error: No file selected"
170
  msgstr ""
171
 
172
+ #: ../views/options.php:80
173
  msgid "Error: Your file could not be uploaded"
174
  msgstr ""
175
 
176
+ #: ../views/options.php:81
177
  msgid "Error: Your restoration file could not be unzipped"
178
  msgstr ""
179
 
180
+ #: ../views/options.php:82
181
  msgid ""
182
  "Error: Your zip file appears to be invalid. Please ensure you chose the "
183
  "correct zip file"
184
  msgstr ""
185
 
186
+ #: ../views/options.php:83
187
  msgid "Error: Cannot create restore point"
188
  msgstr ""
189
 
190
+ #: ../views/options.php:84
191
  msgid "Error: Unable to connect to your database"
192
  msgstr ""
193
 
194
+ #: ../views/options.php:85
195
  msgid "Error: Unable to get current site URL from database. Please try again"
196
  msgstr ""
197
 
198
+ #: ../views/options.php:86
199
  msgid "Error: Unable to get current home URL from database. Please try again"
200
  msgstr ""
201
 
202
+ #: ../views/options.php:87
203
  msgid "Error: Unable to get current user ID from database. Please try again"
204
  msgstr ""
205
 
206
+ #: ../views/options.php:88
207
  msgid ""
208
  "Error: Unable to get current user password from database. Please try again"
209
  msgstr ""
210
 
211
+ #: ../views/options.php:89
212
  msgid "Error: Unable to get current user email from database. Please try again"
213
  msgstr ""
214
 
215
+ #: ../views/options.php:90
216
  msgid ""
217
  "Error: Unable to get import your database. This may require importing the "
218
  "file manually"
219
  msgstr ""
220
 
221
+ #: ../views/options.php:91
222
  msgid ""
223
  "Error: Unable to update your current site URL value. This may require "
224
  "importing the file manually"
225
  msgstr ""
226
 
227
+ #: ../views/options.php:92
228
  msgid ""
229
  "Error: Unable to update your current home URL value. This may require "
230
  "importing the file manually"
231
  msgstr ""
232
 
233
+ #: ../views/options.php:93
234
  msgid ""
235
  "Error: Unable to update your user information. This may require importing "
236
  "the file manually"
237
  msgstr ""
238
 
239
+ #: ../views/options.php:94
240
  msgid "Error: Warning: Database not detected in import file"
241
  msgstr ""
242
 
243
+ #: ../views/options.php:95
244
  msgid ""
245
  "Error: Unable to remove existing wp-content directory for import. Please "
246
  "check your CHMOD settings in /wp-content/"
247
  msgstr ""
248
 
249
+ #: ../views/options.php:96
250
  msgid ""
251
  "Error: Unable to create new wp-content directory for import. Please check "
252
  "your CHMOD settings in /wp-content/"
253
  msgstr ""
254
 
255
+ #: ../views/options.php:97
256
  msgid "Error: Unable to import wp-content. Please try again"
257
  msgstr ""
258
 
259
+ #: ../views/options.php:98
260
  msgid "Warning: Unable to cleanup import directory"
261
  msgstr ""
262
 
263
+ #: ../views/options.php:109
264
  msgid "License Key"
265
  msgstr ""
266
 
267
+ #: ../views/options.php:113
268
  msgid "Pro features and auto-updates enabled"
269
  msgstr ""
270
 
271
+ #: ../views/options.php:115
272
  msgid "Activate auto-restore and auto-updates by entering your license key"
273
  msgstr ""
274
 
275
+ #: ../views/options.php:120
276
  msgid "Active"
277
  msgstr ""
278
 
279
+ #: ../views/options.php:121
280
  msgid "Update"
281
  msgstr ""
282
 
283
+ #: ../views/options.php:123
284
  msgid "Inactive"
285
  msgstr ""
286
 
287
+ #: ../views/options.php:124
288
  msgid "Activate"
289
  msgstr ""
290
 
291
+ #: ../views/options.php:125
292
  msgid "Purchase a license key"
293
  msgstr ""
294
 
295
+ #: ../views/options.php:132
296
  msgid "WP Backitup support system"
297
  msgstr ""
298
 
299
+ #: ../views/options.php:135
300
  msgid "support system"
301
  msgstr ""
302
 
303
+ #: ../views/options.php:138
304
  msgid "Need Help?"
305
  msgstr ""
306
 
307
+ #: ../views/options.php:139
308
  msgid "Access the"
309
  msgstr ""
310
 
311
+ #: ../views/options.php:143
312
  msgid "Spread the Word"
313
  msgstr ""
314
 
315
+ #: ../views/options.php:144
316
  msgid "Rate WP Backitup"
317
  msgstr ""
318
 
319
+ #: ../views/options.php:149
320
  msgid "Enable"
321
  msgstr ""
322
 
323
+ #: ../views/options.php:150
324
  msgid "Disable"
325
  msgstr ""
326
 
327
+ #: ../views/options.php:151
328
  msgid "Help to improve Easy Webtrends by enabling"
329
  msgstr ""
330
 
331
+ #: ../views/options.php:152
332
  msgid "Save"
333
  msgstr ""
lib/constants.php CHANGED
@@ -5,11 +5,11 @@
5
  * @package WP Backitup
6
  *
7
  * @author jcpeden
8
- * @version 1.4.1
9
  * @since 1.0.1
10
  */
11
 
12
- if( !defined( 'WPBACKITUP_VERSION' ) ) define( 'WPBACKITUP_VERSION', '1.4.1' );
13
 
14
  if( !defined( 'WPBACKITUP_DIRNAME' ) ) define( 'WPBACKITUP_DIRNAME', dirname( dirname( __FILE__ ) ) );
15
 
5
  * @package WP Backitup
6
  *
7
  * @author jcpeden
8
+ * @version 1.4.2
9
  * @since 1.0.1
10
  */
11
 
12
+ if( !defined( 'WPBACKITUP_VERSION' ) ) define( 'WPBACKITUP_VERSION', '1.4.2' );
13
 
14
  if( !defined( 'WPBACKITUP_DIRNAME' ) ) define( 'WPBACKITUP_DIRNAME', dirname( dirname( __FILE__ ) ) );
15
 
lib/functions.php CHANGED
@@ -5,8 +5,8 @@
5
  * @package WP Backitup
6
  *
7
  * @author jcpeden
8
- * @version 1.4.0
9
- * @since 1.0.1
10
  */
11
 
12
  // localize the plugin
@@ -21,20 +21,15 @@ if( !class_exists( 'recurseZip' ) ) {
21
  include_once 'includes/recurse_zip.php';
22
  }
23
 
24
- // include auto-update class
25
- if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
26
- include_once 'includes/auto_update.php';
27
- }
28
-
29
  // retrieve our license key from the DB
30
  $license_key = trim( $this->get_option( 'license_key' ) );
31
 
32
  //define dbSize function
33
  function dbSize($dbname) {
34
- mysql_select_db($dbname);
35
- $result = mysql_query("SHOW TABLE STATUS");
36
  $dbsize = 0;
37
- while($row = mysql_fetch_array($result)) {
38
  $dbsize += $row["Data_length"] + $row["Index_length"];
39
  }
40
  return $dbsize;
@@ -158,34 +153,105 @@ if(!function_exists('recursive_copy')) {
158
 
159
  //Define DB backup function
160
  if(!function_exists('db_backup')) {
161
- function db_backup($path) {
162
-
163
- $handle = fopen($path .'db-backup.sql', 'w+');
164
-
165
- $path_sql = $path .'/db-backup.sql';
166
- $db_name = DB_NAME;
167
- $db_user = DB_USER;
168
- $db_pass = DB_PASSWORD;
169
- $db_host = DB_HOST;
170
-
171
- $output = shell_exec("mysqldump --user $db_user --password=$db_pass $db_name");
172
- fwrite($handle,$output);
173
- fclose($handle);
174
- return true;
175
- }
176
- }
177
 
178
- //define dbDumpFileSize function
179
- if(!function_exists('dbDumpFileSize')) {
180
- function dbDumpFileSize($path) {
181
- if(glob($path . "*.sql")) {
182
- foreach (glob($path . "*.sql") as $db) {
183
- $filesize = filesize($db);
184
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
- if ($filesize > 1) {
187
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  }
 
 
 
 
 
 
 
 
 
 
 
 
189
  }
190
  }
191
 
5
  * @package WP Backitup
6
  *
7
  * @author jcpeden
8
+ * @version 1.4.2
9
+ * @since 1.0.2
10
  */
11
 
12
  // localize the plugin
21
  include_once 'includes/recurse_zip.php';
22
  }
23
 
 
 
 
 
 
24
  // retrieve our license key from the DB
25
  $license_key = trim( $this->get_option( 'license_key' ) );
26
 
27
  //define dbSize function
28
  function dbSize($dbname) {
29
+ mysqli_select_db($dbname);
30
+ $result = mysqli_query("SHOW TABLE STATUS");
31
  $dbsize = 0;
32
+ while($row = mysqli_fetch_array($result)) {
33
  $dbsize += $row["Data_length"] + $row["Index_length"];
34
  }
35
  return $dbsize;
153
 
154
  //Define DB backup function
155
  if(!function_exists('db_backup')) {
156
+ function db_backup($user, $pass, $host, $db_name, $path) {
157
+
158
+ //set fileName
159
+ $fileName = 'db-backup.sql' ;
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
+ // Check if directory is already created and has the proper permissions
162
+ if (!file_exists($path)) {
163
+ if(!mkdir($path , 0755) ){
164
+ return false;
 
 
165
  }
166
+ }
167
+
168
+ if (!is_writable($path)) {
169
+ if (!chmod($path , 0755) ) {
170
+ return false;
171
+ }
172
+ }
173
+
174
+ $mysqli = new mysqli($host , $user , $pass , $db_name) ;
175
+ if (mysqli_connect_errno()) {
176
+ return false;
177
+ }
178
+
179
+ // Introduction information
180
+ $return = '';
181
+ $return .= "--\n";
182
+ $return .= "-- WP Backitup Database Backup \n";
183
+ $return .= "--\n";
184
+ $return .= '-- Created: ' . date("Y/m/d") . ' on ' . date("h:i") . "\n\n\n";
185
+ $return = "--\n";
186
+ $return .= "-- Database : " . $db_name . "\n";
187
+ $return .= "--\n";
188
+ $return .= "-- --------------------------------------------------\n";
189
+ $return .= "-- ---------------------------------------------------\n";
190
+ $return .= 'SET AUTOCOMMIT = 0 ;' ."\n" ;
191
+ $return .= 'SET FOREIGN_KEY_CHECKS=0 ;' ."\n" ;
192
+ $tables = array() ;
193
+
194
+ // Exploring what tables this database has
195
+ $result = $mysqli->query('SHOW TABLES' ) ;
196
+
197
+ // Cycle through "$result" and put content into an array
198
+ while ($row = $result->fetch_row()) {
199
+ $tables[] = $row[0] ;
200
  }
201
+
202
+ // Cycle through each table
203
+ foreach($tables as $table) {
204
+ // Get content of each table
205
+ $result = $mysqli->query('SELECT * FROM '. $table) ;
206
+
207
+ // Get number of fields (columns) of each table
208
+ $num_fields = $mysqli->field_count ;
209
+
210
+ // Add table information
211
+ $return .= "--\n" ;
212
+ $return .= '-- Tabel structure for table `' . $table . '`' . "\n" ;
213
+ $return .= "--\n" ;
214
+ $return.= 'DROP TABLE IF EXISTS `'.$table.'`;' . "\n" ;
215
+
216
+ // Get the table-shema
217
+ $shema = $mysqli->query('SHOW CREATE TABLE '.$table) ;
218
+
219
+ // Extract table shema
220
+ $tableshema = $shema->fetch_row() ;
221
+
222
+ // Append table-shema into code
223
+ $return.= $tableshema[1].";" . "\n\n" ;
224
+
225
+ // Cycle through each table-row
226
+ while($rowdata = $result->fetch_row()) {
227
+
228
+ // Prepare code that will insert data into table
229
+ $return .= 'INSERT INTO `'.$table .'` VALUES ( ' ;
230
+
231
+ // Extract data of each row
232
+ for($i=0; $i<$num_fields; $i++) {
233
+ $return .= '"'.$rowdata[$i] . "\"," ;
234
+ }
235
+
236
+ // Let's remove the last comma
237
+ $return = substr("$return", 0, -1) ;
238
+ $return .= ");" ."\n" ;
239
+
240
+ }
241
+ $return .= "\n\n" ;
242
  }
243
+
244
+ // Close the connection
245
+ $mysqli->close() ;
246
+ $return .= 'SET FOREIGN_KEY_CHECKS = 1 ; ' . "\n" ;
247
+ $return .= 'COMMIT ; ' . "\n" ;
248
+ $return .= 'SET AUTOCOMMIT = 1 ; ' . "\n" ;
249
+
250
+ //save file
251
+ $handle = fopen($path . $fileName,'w+');
252
+ fwrite($handle,$return);
253
+ fclose($handle);
254
+ return true;
255
  }
256
  }
257
 
lib/includes/backup.php CHANGED
@@ -6,7 +6,7 @@
6
  * @package WP Backitup Pro
7
  *
8
  * @author jcpeden
9
- * @version 1.4.0
10
  * @since 1.0.1
11
  */
12
 
@@ -51,17 +51,8 @@ if(!is_writeable(WPBACKITUP_DIRNAME ."/backups/")) {
51
  fwrite($fh, '<div class="prerequisites">1</div>');
52
  }
53
 
54
- //Backup with copy
55
- if(recursive_copy(WPBACKITUP_CONTENT_PATH, $backup_project_path, $ignore = array( 'cgi-bin','.','..','._',$backup_project_dirname,'backupbuddy_backups','*.zip','cache' ) ) ) {
56
- fwrite($fh, '<div class="backupfiles">1</div>');
57
- } else {
58
- fwrite($fh, '<div class="backupfiles">0</div>');
59
- fwrite($fh, '<div class="error103">1</div>');
60
- die();
61
- }
62
-
63
  //Dump DB to project dir
64
- if( db_backup($backup_project_path) ) {
65
  fwrite($fh, '<div class="backupdb">1</div>');
66
  } else {
67
  fwrite($fh, '<div class="backupdb">0</div>');
@@ -70,11 +61,12 @@ if( db_backup($backup_project_path) ) {
70
  die();
71
  }
72
 
73
- //Check DB filesize
74
- if (!dbDumpFileSize($backup_project_path)) {
75
- fwrite($fh, '<div class="backupdb">0</div>');
76
- fwrite($fh, '<div class="error114">1</div>');
77
- recursive_delete($backup_project_path);
 
78
  die();
79
  }
80
 
6
  * @package WP Backitup Pro
7
  *
8
  * @author jcpeden
9
+ * @version 1.4.2
10
  * @since 1.0.1
11
  */
12
 
51
  fwrite($fh, '<div class="prerequisites">1</div>');
52
  }
53
 
 
 
 
 
 
 
 
 
 
54
  //Dump DB to project dir
55
+ if( db_backup(DB_USER, DB_PASSWORD, DB_HOST, DB_NAME, $backup_project_path) ) {
56
  fwrite($fh, '<div class="backupdb">1</div>');
57
  } else {
58
  fwrite($fh, '<div class="backupdb">0</div>');
61
  die();
62
  }
63
 
64
+ //Backup with copy
65
+ if(recursive_copy(WPBACKITUP_CONTENT_PATH, $backup_project_path, $ignore = array( 'cgi-bin','.','..','._',$backup_project_dirname,'backupbuddy_backups','*.zip','cache' ) ) ) {
66
+ fwrite($fh, '<div class="backupfiles">1</div>');
67
+ } else {
68
+ fwrite($fh, '<div class="backupfiles">0</div>');
69
+ fwrite($fh, '<div class="error103">1</div>');
70
  die();
71
  }
72
 
lib/includes/recurse_zip.php CHANGED
@@ -1 +1 @@
1
- <?php
2
  * WP Backitup Recurse Zip Function
3
  *
4
  * @package WP Backitup
5
  *
6
  * @author jcpeden
7
  * @version 1.4.0
8
  * @since 1.0.1
9
  */
 
10
  * WP Backitup Recurse Zip Function
11
  *
12
  * @package WP Backitup
13
  *
14
  * @author jcpeden
15
  * @version 1.4.0
16
  * @since 1.0.1
17
  */
 
1
  * WP Backitup Recurse Zip Function
2
  *
3
  * @package WP Backitup
4
  *
5
  * @author jcpeden
6
  * @version 1.4.0
7
  * @since 1.0.1
8
  */
9
+ <?php
10
  * WP Backitup Recurse Zip Function
11
  *
12
  * @package WP Backitup
13
  *
14
  * @author jcpeden
15
  * @version 1.4.0
16
  * @since 1.0.1
17
  */
logs/status.log CHANGED
@@ -1 +1 @@
1
- <div class="prerequisites">1</div><div class="backupfiles">1</div><div class="backupdb">1</div><div class="infofile">1</div><div class="zipfile">1</div><div class="cleanup">1</div><div class="finalinfo">1</div>
1
+ <div class="prerequisites">1</div><div class="backupdb">1</div><div class="backupfiles">1</div><div class="infofile">1</div><div class="zipfile">1</div><div class="cleanup">1</div><div class="finalinfo">1</div>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.wpbackitup.com
4
  Tags: backup wordpress, database backup, backup database, download database, backup and restore, restoring wordpress, restore wordpress, restore wordpress backup,
5
  Requires at least: 3.4.2
6
  Tested up to: 3.6.0
7
- Stable tag: 1.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -93,6 +93,9 @@ Yes.
93
 
94
  == Changelog ==
95
 
 
 
 
96
  = 1.4.1 =
97
  Setup alert if DB is 0 bytes.
98
 
@@ -146,6 +149,9 @@ Initial version of the plugin released.
146
 
147
  == Upgrade Notice ==
148
 
 
 
 
149
  = 1.4.1 =
150
  Recommended upgrade: Backitup will now alert and halt if your database is 0 bytes on backup.
151
 
4
  Tags: backup wordpress, database backup, backup database, download database, backup and restore, restoring wordpress, restore wordpress, restore wordpress backup,
5
  Requires at least: 3.4.2
6
  Tested up to: 3.6.0
7
+ Stable tag: 1.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
93
 
94
  == Changelog ==
95
 
96
+ = 1.4.2 =
97
+ Changed DB backup method to work on shared hosting.
98
+
99
  = 1.4.1 =
100
  Setup alert if DB is 0 bytes.
101
 
149
 
150
  == Upgrade Notice ==
151
 
152
+ = 1.4.2 =
153
+ Recommended upgrade: Many people on shared hosting will now be able to backup their database.
154
+
155
  = 1.4.1 =
156
  Recommended upgrade: Backitup will now alert and halt if your database is 0 bytes on backup.
157
 
views/options.php CHANGED
@@ -43,9 +43,9 @@
43
  <!--backup status messages-->
44
  <ul class="backup-status">
45
  <li class='prerequisites'><?php _e('Preparing to backup', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
46
- <li class='backupfiles'><?php _e('Backing-up /wp-content/', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
47
  <li class='backupdb'><?php _e('Backing-up database', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
48
- <li class='infofile'><?php _e('Creating backup directory', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
 
49
  <li class='zipfile'><?php _e('Zipping backup directory', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
50
  <li class='cleanup'><?php _e('Cleaning up', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
51
  <li class='finalinfo'><span class='status'><?php _e('Backup file created successfully. You can download your backup file using the link above', $namespace ); ?></span></li>
43
  <!--backup status messages-->
44
  <ul class="backup-status">
45
  <li class='prerequisites'><?php _e('Preparing to backup', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
 
46
  <li class='backupdb'><?php _e('Backing-up database', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
47
+ <li class='backupfiles'><?php _e('Backing-up /wp-content/', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
48
+ <li class='infofile'><?php _e('Creating backup information file', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
49
  <li class='zipfile'><?php _e('Zipping backup directory', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
50
  <li class='cleanup'><?php _e('Cleaning up', $namespace );?>...<span class='status'><?php _e('Done', $namespace );?></span><span class='fail error'><?php _e('Failed', $namespace );?></span></li>
51
  <li class='finalinfo'><span class='status'><?php _e('Backup file created successfully. You can download your backup file using the link above', $namespace ); ?></span></li>