Backup and Restore WordPress – WPBackItUp Backup Plugin - Version 1.0.8

Version Description

  • Modified plugin administration and loaded menu tab in main toolbar.
Download this release

Release Info

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

Code changes from version 1.0.7 to 1.0.8

backups/status.log CHANGED
@@ -1 +1 @@
1
- <ul><li>Creating backup directory...Done!</li><li>Backing up your files...Done!</li><li>Backing up your database...Done!</li><li>Creating backup zip...Done!</li><li>Export file created successfully. You can download your export file using the link above.</li></ul>
1
+ <ul><li>Creating backup directory...Done!</li><li>Backing up your files...Done!</li><li>Backing up your database...Done!</li><li>Creating backup zip...Done!</li><li>Backup file created successfully. You can download your backup file using the link above.</li></ul>
css/wp-backitup.css CHANGED
@@ -2,6 +2,24 @@
2
 
3
  .error { color: #ff0000;}
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  input {padding: 0;}
6
 
7
  h3 {
@@ -21,21 +39,16 @@ iframe {
21
  width: 0;
22
  }
23
 
24
- .wp-backitup-section {clear:both;}
 
 
 
25
 
26
  #backup-button, #restore-form {
27
  float: left;
28
  margin: 0 5px 5px 0;
29
  }
30
 
31
- #backup-button a {
32
- display: block;
33
- padding: 3px 8px;
34
- -webkit-border-radius: 10px;
35
- -moz-border-radius: 10px;
36
- border-radius: 10px;
37
- }
38
-
39
  .status-icon {
40
  display: inline;
41
  height: 16px;
@@ -45,8 +58,6 @@ iframe {
45
 
46
  .status-icon img {margin-top: 3px;}
47
 
48
- #wp-backitup-restore .status-icon img {margin-top: 7px;}
49
-
50
  #restore_form {margin-right: 5px;}
51
 
52
  #restore-button {margin-top: 22px;}
2
 
3
  .error { color: #ff0000;}
4
 
5
+ p {
6
+ line-height: 1.4em;
7
+ }
8
+
9
+ #content {
10
+ float: left;
11
+ width: 65%;
12
+ }
13
+
14
+ #sidebar {
15
+ float: right;
16
+ width: 30%;
17
+ }
18
+
19
+ .widget {
20
+ padding: 1em;
21
+ }
22
+
23
  input {padding: 0;}
24
 
25
  h3 {
39
  width: 0;
40
  }
41
 
42
+ .wp-backitup-section {
43
+ border-bottom: 1px solid #ddd;
44
+ clear:both;
45
+ }
46
 
47
  #backup-button, #restore-form {
48
  float: left;
49
  margin: 0 5px 5px 0;
50
  }
51
 
 
 
 
 
 
 
 
 
52
  .status-icon {
53
  display: inline;
54
  height: 16px;
58
 
59
  .status-icon img {margin-top: 3px;}
60
 
 
 
61
  #restore_form {margin-right: 5px;}
62
 
63
  #restore-button {margin-top: 22px;}
images/icon.png ADDED
Binary file
images/icon32.png ADDED
Binary file
includes/admin_page.php CHANGED
@@ -1 +1 @@
1
- <?php
1
+ <?php
includes/backup.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // 5 minutes per image should be PLENTY
3
  @set_time_limit(900);
4
 
5
  //Define variables
@@ -31,7 +31,7 @@ if(!is_writeable(BACKUP_PATH)) {
31
  //Backup content to project dir
32
  fwrite($fh, '<li>Backing up your files...');
33
  //Backup with copy
34
- if(recursive_copy($wp_content_path, $backup_project_path, $ignore = array( 'cgi-bin','.','..','._',$backup_project_dirname ) ) ) {
35
  fwrite($fh, 'Done!</li>');
36
  } else {
37
  fwrite($fh, '</li><li class="error">Unable to backup your files. Please try again.</li></ul>');
@@ -70,7 +70,7 @@ if(!recursive_delete($backup_project_path)) {
70
  }
71
 
72
  //close log file
73
- fwrite($fh, '<li>Export file created successfully. You can download your export file using the link above.</li>');
74
  fwrite($fh, '</ul>');
75
  fclose($fh);
76
 
1
  <?php
2
+ //limite process to 5 minutes
3
  @set_time_limit(900);
4
 
5
  //Define variables
31
  //Backup content to project dir
32
  fwrite($fh, '<li>Backing up your files...');
33
  //Backup with copy
34
+ if(recursive_copy($wp_content_path, $backup_project_path, $ignore = array( 'cgi-bin','.','..','._',$backup_project_dirname,'backupbuddy_backups','*.zip' ) ) ) {
35
  fwrite($fh, 'Done!</li>');
36
  } else {
37
  fwrite($fh, '</li><li class="error">Unable to backup your files. Please try again.</li></ul>');
70
  }
71
 
72
  //close log file
73
+ fwrite($fh, '<li>Backup file created successfully. You can download your backup file using the link above.</li>');
74
  fwrite($fh, '</ul>');
75
  fclose($fh);
76
 
includes/functions.php CHANGED
@@ -15,13 +15,13 @@ if(!function_exists('recursive_copy')) {
15
  if ($dh = opendir($dir) ) {
16
  while(($file = readdir($dh)) !== false) { //While there are files in the directory
17
  if ( !in_array($file, $ignore) && substr($file, 0, 1) != '.') { //Check the file is not in the ignore array
18
- if (!is_dir( $dir.$file ) ) { //If $file is a file
19
- //Copy files to destination directory
20
- $fsrc = fopen($dir .$file,'r');
21
- $fdest = fopen($target_path .$file,'w+');
22
- $len = stream_copy_to_stream($fsrc,$fdest);
23
- fclose($fsrc);
24
- fclose($fdest);
25
  } else { //If $file is a directory
26
  $destdir = $target_path .$file; //Modify the destination dir
27
  if(!is_dir($destdir)) { //Create the destdir if it doesn't exist
@@ -112,37 +112,6 @@ if(!function_exists('recursive_delete')){
112
  }
113
  }
114
 
115
- //defube db_import function
116
- if(!function_exists('db_import')) {
117
- function db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc) {
118
- global $wpdb;
119
- $sql_files = glob($restoration_dir_path . "/*.sql");
120
- foreach($sql_files as $sql_file) {
121
- $templine = ''; // Temporary variable, used to store current query
122
- $lines = file($sql_file); // Read in entire file
123
- foreach ($lines as $line) { // Loop through each line
124
- if (substr($line, 0, 2) == '--' || $line == '') continue; // Skip it if it's a comment
125
- $templine .= $line; // Add this line to the current segment
126
- if (substr(trim($line), -1, 1) == ';') { // If it has a semicolon at the end, it's the end of the query
127
- //replace imported site url with current site url
128
- if( strstr( trim($templine), trim($import_siteurl) ) == TRUE ) //If import site url is found
129
- $templine = str_replace( trim($import_siteurl), trim($current_siteurl), $templine ); // Replace import site url with current site url
130
- //if the table prefixes are different, replace the imported site prefixes with the current prefixes
131
- if ($table_prefix != $import_table_prefix) {
132
- if( strstr( trim($templine), trim($import_table_prefix) ) == TRUE ) //If import table prefix is found
133
- $templine = str_replace( trim($import_table_prefix), trim($table_prefix), $templine ); // Replace import site table prefix with current site table prefix
134
- }
135
- // Perform the query
136
- if( mysqli_query($dbc, $templine) === FALSE)
137
- print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
138
- $templine = ''; // Reset temp variable to empty
139
- }
140
- }
141
- }
142
- return true;
143
- }
144
- }
145
-
146
  //Define zip function
147
  function zip($source, $destination, $ignore) {
148
  if (is_string($source)) $source_arr = array($source); // convert it to array
15
  if ($dh = opendir($dir) ) {
16
  while(($file = readdir($dh)) !== false) { //While there are files in the directory
17
  if ( !in_array($file, $ignore) && substr($file, 0, 1) != '.') { //Check the file is not in the ignore array
18
+ if (!is_dir( $dir.$file ) ) {
19
+ //Copy files to destination directory
20
+ $fsrc = fopen($dir .$file,'r');
21
+ $fdest = fopen($target_path .$file,'w+');
22
+ $len = stream_copy_to_stream($fsrc,$fdest);
23
+ fclose($fsrc);
24
+ fclose($fdest);
25
  } else { //If $file is a directory
26
  $destdir = $target_path .$file; //Modify the destination dir
27
  if(!is_dir($destdir)) { //Create the destdir if it doesn't exist
112
  }
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  //Define zip function
116
  function zip($source, $destination, $ignore) {
117
  if (is_string($source)) $source_arr = array($source); // convert it to array
includes/restore.php DELETED
@@ -1,312 +0,0 @@
1
- <?php
2
- //define constants
3
- define("WP_BACKITUP_DIRNAME", basename(dirname(dirname(__FILE__))) );
4
- define("BACKUP_PATH", dirname(dirname(__FILE__)) .'/backups/' );
5
- define('WP_CONTENT_PATH', dirname(dirname(dirname(dirname(__FILE__)))));
6
-
7
- //create log file
8
- $log = BACKUP_PATH . "status.log";
9
- $fh = fopen($log, 'w') or die("can't open file");
10
- fwrite($fh, '<ul>');
11
-
12
- //include functions
13
- require('functions.php');
14
-
15
- // 5 minutes per image should be PLENTY
16
- @set_time_limit(900);
17
-
18
-
19
- //Delete any zips in the upload directory first
20
- foreach (glob(BACKUP_PATH .'*.zip') as $file) {
21
- unlink($file);
22
- }
23
-
24
- //Move the uploaded zip to the plugin directory
25
- fwrite($fh, "<li>Uploading restoration file...");
26
- $restore_file_name = basename( $_FILES['wpbackitup-zip']['name']);
27
- $restore_path = BACKUP_PATH . $restore_file_name;
28
- if(move_uploaded_file($_FILES['wpbackitup-zip']['tmp_name'], $restore_path)) {
29
- fwrite($fh, "Done!</li>");
30
- } else {
31
- fwrite($fh, "</li><li class=\"error\">Your file could not be uploaded.</li></ul>");
32
- recursive_delete($restoration_dir_path);
33
- unlink(BACKUP_PATH . $restore_file_name);
34
- fclose($fh);
35
- die();
36
-
37
- }
38
-
39
- //Unzip the uploaded restore file
40
- fwrite($fh, "<li>Unzipping...");
41
- $zip = new ZipArchive;
42
- $res = $zip->open(BACKUP_PATH . $restore_file_name);
43
- if ($res === TRUE) {
44
- $zip->extractTo(BACKUP_PATH);
45
- $zip->close();
46
- fwrite($fh, "Done!</li>");
47
- } else {
48
- fwrite($fh, "</li><li class=\"error\">Your restoration file could not be unzipped.</li></ul>");
49
- recursive_delete($restoration_dir_path);
50
- unlink(BACKUP_PATH . $restore_file_name);
51
- fclose($fh);
52
- die();
53
- }
54
-
55
- //Identify the restoration directory
56
- fwrite($fh, "<li>Validating zip...");
57
- if(count(glob(BACKUP_PATH . "*", GLOB_ONLYDIR)) == 1) { //does this need wilcard?
58
- foreach(glob(BACKUP_PATH . "*", GLOB_ONLYDIR) as $dir) { //does this need wilcard?
59
- $restoration_dir_path = $dir;
60
- }
61
- }
62
- if(glob($restoration_dir_path .'/backupsiteinfo.txt') ){
63
- fwrite($fh, "Done!</li>");
64
- } else {
65
- fwrite($fh, "</li><li class=\"error\">Your zip file does not contain backupsiteinfo.txt. Please choose another file.</li></ul>");
66
- recursive_delete($restoration_dir_path);
67
- unlink(BACKUP_PATH . $restore_file_name);
68
- fclose($fh);
69
- die();
70
- }
71
-
72
- //If themes dir is present, restore it to wp-content
73
- if(glob($restoration_dir_path . "/themes")) {
74
- fwrite($fh, "<li>Restoring themes...");
75
- $themes_dir = WP_CONTENT_PATH .'/themes';
76
- if(!recursive_delete($themes_dir)) {
77
- fwrite($fh, "</li><li class=\"error\">Unable to remove existing themes directory for import. Please check your CHMOD settings in /wp-content/themes.</li></ul>");
78
- recursive_delete($restoration_dir_path);
79
- unlink(BACKUP_PATH . $restore_file_name);
80
- fclose($fh);
81
- die();
82
- }
83
- if(!create_dir($themes_dir)) {
84
- fwrite($fh, "</li><li class=\"error\">Unable to create new themes directory for import. Please check your CHMOD settings in /wp-content/themes.</li></ul>");
85
- recursive_delete($restoration_dir_path);
86
- unlink(BACKUP_PATH . $restore_file_name);
87
- fclose($fh);
88
- die();
89
- }
90
- if(recusive_copy($restoration_dir_path .'/themes', $themes_dir, array( 'cgi-bin', '.', '..','._', $restore_file_name )) ) {
91
- fwrite($fh, "Done!</li>");
92
- } else {
93
- fwrite($fh, "</li><li class=\"error\">Unable to import themes. Please try again.</li></ul>");
94
- recursive_delete($restoration_dir_path);
95
- unlink(BACKUP_PATH . $restore_file_name);
96
- fclose($fh);
97
- die();
98
- }
99
- } else {
100
- fwrite($fh, "<li class=\"error\">Warning: Themes directory not detected in import file.</li>");
101
- }
102
-
103
- //If uploads dir is present, restore it to wp-content
104
- if(glob($restoration_dir_path . "/uploads")) {
105
- fwrite($fh, "<li>Restoring uploads...");
106
- $uploads_dir = WP_CONTENT_PATH .'/uploads';
107
- if(!recursive_delete($uploads_dir) ){
108
- fwrite($fh, "</li><li class=\"error\">Unable to create new uploads directory for import. Please check your CHMOD settings in /wp-content/uploads.</li></ul>");
109
- recursive_delete($restoration_dir_path);
110
- unlink(BACKUP_PATH . $restore_file_name);
111
- fclose($fh);
112
- die();
113
- }
114
- if(!create_dir($uploads_dir) ) {
115
- fwrite($fh, "</li><li class=\"error\">Unable to create new uploads directory for import. Please check your CHMOD settings in /wp-content/uploads.</li></ul>");
116
- recursive_delete($restoration_dir_path);
117
- unlink(BACKUP_PATH . $restore_file_name);
118
- fclose($fh);
119
- die();
120
- }
121
- if (recusive_copy($restoration_dir_path .'/uploads', $uploads_dir, array( 'cgi-bin', '.', '..','._', $restore_file_name )) ) {
122
- fwrite($fh, "Done!</li>");
123
- } else {
124
- fwrite($fh, "</li><li class=\"error\">Unable to import uploads. Please try again.</li></ul>");
125
- recursive_delete($restoration_dir_path);
126
- unlink(BACKUP_PATH . $restore_file_name);
127
- fclose($fh);
128
- die();
129
- }
130
- } else {
131
- fwrite($fh, "<li class=\"error\">Warning: Uploads directory not detected in import file.</li>");
132
- }
133
-
134
- //If plugins dir is present, restore it to wp-content (exclude wp-backitup)
135
- if(glob($restoration_dir_path . "/plugins")) {
136
- fwrite($fh, "<li>Restoring plugins...");
137
- $plugins_dir = WP_CONTENT_PATH .'/plugins';
138
- if(!recursive_delete($plugins_dir, array('cgi-bin','.','..','._', WP_BACKITUP_DIRNAME) ) ) {
139
- fwrite($fh, "</li><li class=\"error\">Unable to create new plugins directory for import. Please check your CHMOD settings in /wp-content/plugins.</li></ul>");
140
- recursive_delete($restoration_dir_path);
141
- unlink(BACKUP_PATH . $restore_file_name);
142
- fclose($fh);
143
- die();
144
- }
145
- if(!create_dir($plugins_dir) ){
146
- fwrite($fh, "</li><li class=\"error\">Unable to create new plugins directory for import. Please check your CHMOD settings in /wp-content/plugins.</li></ul>");
147
- recursive_delete($restoration_dir_path);
148
- unlink(BACKUP_PATH . $restore_file_name);
149
- fclose($fh);
150
- die();
151
- }
152
- if( recusive_copy($restoration_dir_path .'/plugins', $plugins_dir, array( 'cgi-bin', '.', '..','._', $restore_file_name )) ) {
153
- fwrite($fh, "Done!</li>");
154
- } else {
155
- fwrite($fh, "</li><li class=\"error\">Unable to import plugins. Please try again.</li></ul>");
156
- recursive_delete($restoration_dir_path);
157
- unlink(BACKUP_PATH . $restore_file_name);
158
- fclose($fh);
159
- die();
160
- }
161
- } else {
162
- fwrite($fh, "<li class=\"error\">Warning: Plugins directory not detected in import file.</li>");
163
- }
164
-
165
- //if there is a database dump to restore
166
- if(glob($restoration_dir_path . "/*.sql")) {
167
- //collect connection information from form
168
- fwrite($fh, "<li>Restoring database...");
169
- $db_name = $_POST['db_name'];
170
- $db_user = $_POST['db_user'];
171
- $db_pass = $_POST['db_pass'];
172
- $db_host = $_POST['db_host'];
173
- $table_prefix = $_POST['table_prefix'];
174
- $user_id = $_POST['user_id'];
175
- //Connect to DB
176
- $dbc = mysqli_connect($db_host, $db_user, $db_pass, $db_name); //OR die ('Could not connect to your database: ' . );
177
- if ( !$dbc ) {
178
- fwrite($fh, "</li><li class=\"error\">Unable to connect to your current database: " .mysqli_connect_error() ."</li></ul>");
179
- recursive_delete($restoration_dir_path);
180
- unlink(BACKUP_PATH . $restore_file_name);
181
- fclose($fh);
182
- die();
183
- }
184
- //get siteurl
185
- $q1 = "SELECT option_value FROM " .$table_prefix ."options WHERE option_name =\"siteurl\";";
186
- if ($result = mysqli_query($dbc, $q1)) {
187
- while ($row = mysqli_fetch_row($result)) {
188
- $siteurl = $row[0];
189
- }
190
- mysqli_free_result($result);
191
- } else {
192
- fwrite($fh, "</li><li class=\"error\">Unable to get current site URL from database. Please try again.</li></ul>");
193
- recursive_delete($restoration_dir_path);
194
- unlink(BACKUP_PATH . $restore_file_name);
195
- fclose($fh);
196
- die();
197
- }
198
- //get homeurl
199
- $q2 = "SELECT option_value FROM " .$table_prefix ."options WHERE option_name =\"home\";";
200
- if ($result = mysqli_query($dbc, $q2)) {
201
- while ($row = mysqli_fetch_row($result)) {
202
- $homeurl = $row[0];
203
- }
204
- mysqli_free_result($result);
205
- } else {
206
- fwrite($fh, "</li><li class=\"error\">Unable to get current home URL from database. Please try again.</li></ul>");
207
- recursive_delete($restoration_dir_path);
208
- unlink(BACKUP_PATH . $restore_file_name);
209
- fclose($fh);
210
- die();
211
- }
212
- //get user login
213
- $q3 = "SELECT user_login FROM ". $table_prefix ."users WHERE ID=" .$user_id .";";
214
- if ($result = mysqli_query($dbc, $q3)) {
215
- while ($row = mysqli_fetch_row($result)) {
216
- $user_login = $row[0];
217
- }
218
- mysqli_free_result($result);
219
- } else {
220
- fwrite($fh, "</li><li class=\"error\">Unable to get current user ID from database. Please try again.</li></ul>");
221
- recursive_delete($restoration_dir_path);
222
- unlink(BACKUP_PATH . $restore_file_name);
223
- fclose($fh);
224
- die();
225
- }
226
- //get user pass
227
- $q4 = "SELECT user_pass FROM ". $table_prefix ."users WHERE ID=" .$user_id .";";
228
- if ($result = mysqli_query($dbc, $q4)) {
229
- while ($row = mysqli_fetch_row($result)) {
230
- $user_pass = $row[0];
231
- }
232
- mysqli_free_result($result);
233
- } else {
234
- fwrite($fh, "</li><li class=\"error\">Unable to get current user password from database. Please try again.</li></ul>");
235
- recursive_delete($restoration_dir_path);
236
- unlink(BACKUP_PATH . $restore_file_name);
237
- fclose($fh);
238
- die();
239
- }
240
- //get user email
241
- $q5 = "SELECT user_email FROM ". $table_prefix ."users WHERE ID=" .$user_id ."";
242
- if ($result = mysqli_query($dbc, $q5)) {
243
- while ($row = mysqli_fetch_row($result)) {
244
- $user_email = $row[0];
245
- }
246
- mysqli_free_result($result);
247
- } else {
248
- fwrite($fh, "</li><li class=\"error\">Unable to get current user email from database. Please try again.</li></ul>");
249
- recursive_delete($restoration_dir_path);
250
- unlink(BACKUP_PATH . $restore_file_name);
251
- fclose($fh);
252
- die();
253
- }
254
- //Collect previous backup site url start
255
- $import_siteinfo_lines = file($restoration_dir_path .'/backupsiteinfo.txt');
256
- $import_siteurl = trim($import_siteinfo_lines[0]);
257
- $current_siteurl = trim($siteurl ,'/');
258
- $import_table_prefix = $import_siteinfo_lines[1];
259
- //import the database
260
- if(!db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc)) {
261
- fwrite($fh, "</li><li class=\"error\">Unable to get import your database. This may require importing the file manually.</li></ul>");
262
- recursive_delete($restoration_dir_path);
263
- unlink(BACKUP_PATH . $restore_file_name);
264
- fclose($fh);
265
- die();
266
- }
267
- //update the database
268
- $q6 = "UPDATE ". $table_prefix ."options SET option_value=\"" .$current_siteurl ."\" WHERE option_name=\"siteurl\"";
269
- $q7 = "UPDATE ". $table_prefix ."options SET option_value=\"" .$homeurl ."\" WHERE option_name=\"home\"";
270
- $q8 = "UPDATE ". $table_prefix ."users SET user_login=\"" .$user_login ."\", user_pass=\"" .$user_pass ."\", user_email=\"" .$user_email ."\" WHERE ID=\"" .$user_id ."\"";
271
- if(!mysqli_query($dbc, $q6) ) {
272
- fwrite($fh, "</li><li class=\"error\">Unable to update your current site URL value. This may require importing the file manually.</li></ul>");
273
- recursive_delete($restoration_dir_path);
274
- unlink(BACKUP_PATH . $restore_file_name);
275
- fclose($fh);
276
- die();
277
- }
278
- if(!mysqli_query($dbc, $q7) ) {
279
- fwrite($fh, "</li><li class=\"error\">Unable to update your current home URL value. This may require importing the file manually.</li></ul>");
280
- recursive_delete($restoration_dir_path);
281
- unlink(BACKUP_PATH . $restore_file_name);
282
- fclose($fh);
283
- die();
284
- }
285
- if(!mysqli_query($dbc, $q8) ) {
286
- fwrite($fh, "</li><li class=\"error\">Unable to update your user information. This may require importing the file manually.</li></ul>");
287
- recursive_delete($restoration_dir_path);
288
- unlink(BACKUP_PATH . $restore_file_name);
289
- fclose($fh);
290
- die();
291
- }
292
- fwrite($fh, "Done!</li>");
293
- } else {
294
- fwrite($fh, "<li class=\"error\">Warning: Database not detected in import file.</li>");
295
- }
296
-
297
- //Disconnect
298
- mysqli_close($dbc);
299
-
300
- //Delete the restoration directory
301
- recursive_delete($restoration_dir_path);
302
-
303
- //Delete zip
304
- unlink(BACKUP_PATH . $restore_file_name);
305
-
306
- //close log file
307
- fwrite($fh, '<li>Restoration complete. Please refresh the page.</li>');
308
- fwrite($fh, '</ul>');
309
- fclose($fh);
310
-
311
- //End backup function
312
- die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/ajaxfileupload.js DELETED
@@ -1,201 +0,0 @@
1
-
2
- jQuery.extend({
3
-
4
-
5
- createUploadIframe: function(id, uri)
6
- {
7
- //create frame
8
- var frameId = 'jUploadFrame' + id;
9
- var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
10
- if(window.ActiveXObject)
11
- {
12
- if(typeof uri== 'boolean'){
13
- iframeHtml += ' src="' + 'javascript:false' + '"';
14
-
15
- }
16
- else if(typeof uri== 'string'){
17
- iframeHtml += ' src="' + uri + '"';
18
-
19
- }
20
- }
21
- iframeHtml += ' />';
22
- jQuery(iframeHtml).appendTo(document.body);
23
-
24
- return jQuery('#' + frameId).get(0);
25
- },
26
- createUploadForm: function(id, fileElementId, data)
27
- {
28
- //create form
29
- var formId = 'jUploadForm' + id;
30
- var fileId = 'jUploadFile' + id;
31
- var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
32
- if(data)
33
- {
34
- for(var i in data)
35
- {
36
- jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
37
- }
38
- }
39
- var oldElement = jQuery('#' + fileElementId);
40
- var newElement = jQuery(oldElement).clone();
41
- jQuery(oldElement).attr('id', fileId);
42
- jQuery(oldElement).before(newElement);
43
- jQuery(oldElement).appendTo(form);
44
-
45
-
46
-
47
- //set attributes
48
- jQuery(form).css('position', 'absolute');
49
- jQuery(form).css('top', '-1200px');
50
- jQuery(form).css('left', '-1200px');
51
- jQuery(form).appendTo('body');
52
- return form;
53
- },
54
-
55
- ajaxFileUpload: function(s) {
56
- // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
57
- s = jQuery.extend({}, jQuery.ajaxSettings, s);
58
- var id = new Date().getTime()
59
- var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
60
- var io = jQuery.createUploadIframe(id, s.secureuri);
61
- var frameId = 'jUploadFrame' + id;
62
- var formId = 'jUploadForm' + id;
63
- // Watch for a new set of requests
64
- if ( s.global && ! jQuery.active++ )
65
- {
66
- jQuery.event.trigger( "ajaxStart" );
67
- }
68
- var requestDone = false;
69
- // Create the request object
70
- var xml = {}
71
- if ( s.global )
72
- jQuery.event.trigger("ajaxSend", [xml, s]);
73
- // Wait for a response to come back
74
- var uploadCallback = function(isTimeout)
75
- {
76
- var io = document.getElementById(frameId);
77
- try
78
- {
79
- if(io.contentWindow)
80
- {
81
- xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
82
- xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
83
-
84
- }else if(io.contentDocument)
85
- {
86
- xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
87
- xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
88
- }
89
- }catch(e)
90
- {
91
- jQuery.handleError(s, xml, null, e);
92
- }
93
- if ( xml || isTimeout == "timeout")
94
- {
95
- requestDone = true;
96
- var status;
97
- try {
98
- status = isTimeout != "timeout" ? "success" : "error";
99
- // Make sure that the request was successful or notmodified
100
- if ( status != "error" )
101
- {
102
- // process the data (runs the xml through httpData regardless of callback)
103
- var data = jQuery.uploadHttpData( xml, s.dataType );
104
- // If a local callback was specified, fire it and pass it the data
105
- if ( s.success )
106
- s.success( data, status );
107
-
108
- // Fire the global callback
109
- if( s.global )
110
- jQuery.event.trigger( "ajaxSuccess", [xml, s] );
111
- } else
112
- jQuery.handleError(s, xml, status);
113
- } catch(e)
114
- {
115
- status = "error";
116
- jQuery.handleError(s, xml, status, e);
117
- }
118
-
119
- // The request was completed
120
- if( s.global )
121
- jQuery.event.trigger( "ajaxComplete", [xml, s] );
122
-
123
- // Handle the global AJAX counter
124
- if ( s.global && ! --jQuery.active )
125
- jQuery.event.trigger( "ajaxStop" );
126
-
127
- // Process result
128
- if ( s.complete )
129
- s.complete(xml, status);
130
-
131
- jQuery(io).unbind()
132
-
133
- setTimeout(function()
134
- { try
135
- {
136
- jQuery(io).remove();
137
- jQuery(form).remove();
138
-
139
- } catch(e)
140
- {
141
- jQuery.handleError(s, xml, null, e);
142
- }
143
-
144
- }, 100)
145
-
146
- xml = null
147
-
148
- }
149
- }
150
- // Timeout checker
151
- if ( s.timeout > 0 )
152
- {
153
- setTimeout(function(){
154
- // Check to see if the request is still happening
155
- if( !requestDone ) uploadCallback( "timeout" );
156
- }, s.timeout);
157
- }
158
- try
159
- {
160
-
161
- var form = jQuery('#' + formId);
162
- jQuery(form).attr('action', s.url);
163
- jQuery(form).attr('method', 'POST');
164
- jQuery(form).attr('target', frameId);
165
- if(form.encoding)
166
- {
167
- jQuery(form).attr('encoding', 'multipart/form-data');
168
- }
169
- else
170
- {
171
- jQuery(form).attr('enctype', 'multipart/form-data');
172
- }
173
- jQuery(form).submit();
174
-
175
- } catch(e)
176
- {
177
- jQuery.handleError(s, xml, null, e);
178
- }
179
-
180
- jQuery('#' + frameId).load(uploadCallback );
181
- return {abort: function () {}};
182
-
183
- },
184
-
185
- uploadHttpData: function( r, type ) {
186
- var data = !type;
187
- data = type == "xml" || data ? r.responseXML : r.responseText;
188
- // If the type is "script", eval it in global context
189
- if ( type == "script" )
190
- jQuery.globalEval( data );
191
- // Get the JavaScript object, if JSON is used.
192
- if ( type == "json" )
193
- eval( "data = " + data );
194
- // evaluate scripts within html
195
- if ( type == "html" )
196
- jQuery("<div>").html(data).evalScripts();
197
-
198
- return data;
199
- }
200
- })
201
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,54 +1,74 @@
1
- === Plugin Name ===
2
  Contributors: jcpeden
3
  Donate link: http://www.wpbackitup.com
4
- Tags: backup, restore, clone, database, wp-content, files
5
  Requires at least: 3.4
6
- Tested up to: 3.4.2
7
- Stable tag: 1.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- WP BackItUp allows you to backup your database and wp-content folder. This allows you to quickly clone, backup and restore any of your Wordpress sites.
12
 
13
  == Description ==
14
 
15
- WP BackItUp uses nothing but PHP to allow you to backup and restore your Wordpress database, plugins, themes and uploads directories. You can create a
16
- backup of any site and, using WP BackItUp, quickly import your files, settings and content into a new site.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  == Installation ==
19
 
20
  Installation of the plugin is straightforward:
21
 
22
- 1. Upload the directory `wp-backitup` to the `/wp-content/plugins/` directory.
23
- 1. Activate the plugin through the `Plugins` menu in WordPress.
24
- 1. Through the Wordpress dashboard, browse to Tools > WP BackItUp.
 
25
 
26
  == Frequently Asked Questions ==
27
 
 
 
 
 
 
28
 
29
  = Will the plugin work on shared hosting/sub domains/webhost xxx? =
30
- Yes
31
 
32
  = Will WP Backitup work on Windows hosting? =
33
- Yes
34
 
35
  = Are you going to be making progress bars both for backing up and restoring with this plugin? =
36
- Not at this time.
37
 
38
- = Can this plugin back to Amazon S3? =
39
- Not at this time.
40
 
41
  = Is there an auto back up schedule feature? =
42
- Not at this time.
43
 
44
  = Will the plugin work with Wordpres version x.x? =
45
- The plugin works on the latest release of WordPress and is updated to function with all new releases.
46
 
47
  = Can this backup one version of WordPress to a different version? =
48
  No. It is absolutely critical that your WordPress versions are exactly the same.
49
 
50
  = Will WP Backitup work on WordPress Multisite? =
51
- It is untested with Wordpress multisite and probably will not work.
52
 
53
  = Does the plugin copy the database details as well? =
54
  Yes, a database dump is created with each backup.
@@ -63,18 +83,24 @@ Yes. You must install the WP Backitup plugin on the site you wish to backup and
63
  WP Backitup creates a database dump and a backup of all your themes, plugins and uploads.
64
 
65
  = Do you have any ideas about how large a blog is too big for WP Backitup to handle? =
66
- I`ve tested up to 5 themes, 20 plugins and 100 posts/pages without any issues.
67
 
68
  = Do you do regularly update this product to match with WP version updates? =
69
  Yes.
70
 
71
  == Screenshots ==
72
- 1. Once activated, the plugin loads a new menu into Tools > WP Backitup.
73
- 2. Simply click 'Export' to generate a backup of your site. The plugin will update you on its progress.
74
  3. When the backup has been created, click the download link to access a zipped backup of your site.
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
 
78
  = 1.0.6 =
79
  * Initial free version of the plugin distributed on Wordpress. This version can only backup.
80
 
@@ -98,6 +124,12 @@ Yes.
98
 
99
  == Upgrade Notice ==
100
 
 
 
 
 
 
 
101
  = 1.0.6 =
102
  * Non-critical upgrade.
103
 
1
+ === WP Backitup ===
2
  Contributors: jcpeden
3
  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
6
+ Tested up to: 3.5
7
+ Stable tag: 1.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Create a backup zip of your content and settings with a single click that can be used to restore your site quickly and easily.
12
 
13
  == Description ==
14
 
15
+ = The Simple Way to Backup Your Site =
16
+ WP Backitup creates a backup zip of your site&apos;s content and configuration in just a single click, right from your Wordpress dashboard. There is no need to FTP into your site and no knowledge of MySQL or PHPMyAdmin is required.
17
+
18
+ You can use your backup zip to restore your site or to clone a site&apos;s content and settings when setting up a new one.
19
+
20
+ = Automatically Restore Your Backup Zips =
21
+ The optional <a href="http://www.wpbackitup.com/addons/" title="WP Backitup Restoration Addon">WP Backitup Restoration Addon</a> can be purchased from the plugin site and allows you to import your backup zips in seconds, right from the Wordpress Dashboard (<a href="http://wordpress.org/extend/plugins/wp-backitup/screenshots/" title="WP Backitup Screenshots">screenshots</a>).
22
+
23
+ = Manually Restore Your Backup Zips =
24
+ WP Backitup generates a zip file containing a copy of your wp-content directory and a database dump. You can unzip it and <a href="http://codex.wordpress.org/Restoring_Your_Database_From_Backup">import your database</a> and files manually but this requires knowledge of FTP and MySQL.
25
+
26
+ = Easy To Install and Use =
27
+ Simply install the plugin directly to Wordpress and browse to the new menu 'Backup/Restore'. From there, just follow the on-screen instructions and watch as WP Backitup creates a backup of you site's plugins, themes and uploads as well as you content and settings (including all custom widgets and settings for any additional plugins).
28
+
29
+ = More questions? =
30
+ Why not head over to the <a href="http://www.wpbackitup.com/" title="WP Backitup">WP Backitup site</a> or take a look at the <a href="http://wordpress.org/extend/plugins/wp-backitup/faq/" title="WP Backitup FAQ">FAQ page</a>?
31
 
32
  == Installation ==
33
 
34
  Installation of the plugin is straightforward:
35
 
36
+ 1. Upload the plugin to your plugins directory via FTP or through the Wordpress dashboard.
37
+ 1. Activate the plugin.
38
+ 1. A new menu called 'Backup/Restore' will be added to your toolbar.
39
+ 1. Click 'Backup/Restore' to access WP-Backitup
40
 
41
  == Frequently Asked Questions ==
42
 
43
+ = Can I manually restore my backup zips? =
44
+ Sure! The backup zips generated by WP Backitup contain a database dump and a copy of your wp-content directory. Simply upload your files and import your database.
45
+
46
+ = Is there an easier way to restore my backup zips? =
47
+ Yes, purchase and download the <a href="http://www.wpbackitup.com/addons/" title="WP Backitup Restoration Addon">WP Backitup Restoration Addon</a>. Once installed, you'll be able to restore you backup zips without FTP or MySQL.
48
 
49
  = Will the plugin work on shared hosting/sub domains/webhost xxx? =
50
+ It is tested on a wide variety of hosting environments and site configurations. Please use the <a href="http://wordpress.org/support/plugin/wp-backitup">support forum</a> if you are having trouble.
51
 
52
  = Will WP Backitup work on Windows hosting? =
53
+ Yes.
54
 
55
  = Are you going to be making progress bars both for backing up and restoring with this plugin? =
56
+ This will be available in a future release.
57
 
58
+ = Can this plugin back to Amazon S3/Dropbox? =
59
+ This will be available in a future release.
60
 
61
  = Is there an auto back up schedule feature? =
62
+ This will be available in a future release.
63
 
64
  = Will the plugin work with Wordpres version x.x? =
65
+ WP Backitup is untested on older versions of Wordpress. Please feel free to try it and use the <a href="http://wordpress.org/support/plugin/wp-backitup">support forum</a> or the voting system on the <a href="http://wordpress.org/support/plugin/wp-backitup">plugin page</a> to tell others.
66
 
67
  = Can this backup one version of WordPress to a different version? =
68
  No. It is absolutely critical that your WordPress versions are exactly the same.
69
 
70
  = Will WP Backitup work on WordPress Multisite? =
71
+ The plugin can be network-activated within WPMS but sites must be backed-up individually.
72
 
73
  = Does the plugin copy the database details as well? =
74
  Yes, a database dump is created with each backup.
83
  WP Backitup creates a database dump and a backup of all your themes, plugins and uploads.
84
 
85
  = Do you have any ideas about how large a blog is too big for WP Backitup to handle? =
86
+ I`ve tested up to 15 themes, 40 plugins and 350 posts/pages without any issues.
87
 
88
  = Do you do regularly update this product to match with WP version updates? =
89
  Yes.
90
 
91
  == Screenshots ==
92
+ 1. Once activated, the plugin loads a new menu into your toolbar.
93
+ 2. Simply click 'Backup' to generate a backup of your site. The plugin will update you on its progress.
94
  3. When the backup has been created, click the download link to access a zipped backup of your site.
95
 
96
  == Changelog ==
97
 
98
+ = 1.0.8 =
99
+ * Modified plugin administration and loaded menu tab in main toolbar.
100
+
101
+ = 1.0.7 =
102
+ * Added hooks to plugin to allow addons to be built and loaded into the free version of the theme, distributed through the Wordpress plugin repository. Backups were also limited to 20MB to ensure that the processes actually complete.
103
+
104
  = 1.0.6 =
105
  * Initial free version of the plugin distributed on Wordpress. This version can only backup.
106
 
124
 
125
  == Upgrade Notice ==
126
 
127
+ = 1.0.8 =
128
+ * Recommended upgrade. Added links to admin menu.
129
+
130
+ = 1.0.7 =
131
+ * Critical upgrade. Totally overhauled the plugin's construction, stability and features.
132
+
133
  = 1.0.6 =
134
  * Non-critical upgrade.
135
 
screenshots/screenshot-1.png CHANGED
Binary file
screenshots/screenshot-2.png CHANGED
Binary file
screenshots/screenshot-3.png CHANGED
Binary file
wp-backitup.php CHANGED
@@ -1,17 +1,17 @@
1
  <?php
2
  /**
3
- * Plugin Name: WP BackItUp
4
- * Plugin URI: http://www.wpbackitup.com
5
  * Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
6
- * Version: 1.0.7
7
  * Author: John Peden
8
- * Author URI: http://www.johncpeden.com
9
  * License: GPLv2 or later
10
  * Text Domain: wp-backitup
11
  */
12
 
13
  /*
14
- Copyright 2012-current John C. Peden ( email : mail@johncpeden.com )
15
  */
16
 
17
  //define constants
@@ -20,15 +20,9 @@ define("WPBACKITUP_PLUGIN_PATH", WP_PLUGIN_DIR."/wp-backitup/");
20
  define("WPBACKITUP_DIRNAME", "wp-backitup");
21
  define("BACKUP_PATH", WPBACKITUP_PLUGIN_PATH .'backups/');
22
 
23
- //add plugin options
24
- function wpbackitup_options_init() {
25
- register_setting ('wpbackitup_options', 'wpbackitup', 'wpbackitup_options_validate');
26
- }
27
- add_action('admin_init', 'wpbackitup_options_init' );
28
-
29
  //load admin menu
30
  function wpbackitup_admin_menus() {
31
- $wpbackituppage = add_submenu_page( 'tools.php', 'WP BackItUp', 'WP BackItUp', 'manage_options', 'wp-backitup', 'wpbackitup_admin' );
32
  add_action('admin_print_scripts-'.$wpbackituppage, 'wpbackitup_javascript');
33
  add_action('admin_print_styles-' .$wpbackituppage, 'wpbackitup_stylesheet' );
34
  }
@@ -37,6 +31,7 @@ add_action('admin_menu', 'wpbackitup_admin_menus');
37
  //enqueue javascript
38
  function wpbackitup_javascript() {
39
  wp_enqueue_script('wpbackitup-javascript', WPBACKITUP_PLUGIN_URL.'/js/wp-backitup.js');
 
40
  wp_enqueue_script('ajaxfileupload', WPBACKITUP_PLUGIN_URL.'/js/ajaxfileupload.js');
41
  }
42
 
@@ -72,4 +67,11 @@ function wpbackitup_logreader() {
72
  }
73
  die();
74
  }
75
- add_action('wp_ajax_wpbackitup_logreader', 'wpbackitup_logreader');
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * Plugin Name: WP Backitup
4
+ * Plugin URI: http://wordpress.org/extend/plugins/wp-backitup/
5
  * Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
6
+ * Version: 1.0.8
7
  * Author: John Peden
8
+ * Author URI: http://www.wpbackitup.com
9
  * License: GPLv2 or later
10
  * Text Domain: wp-backitup
11
  */
12
 
13
  /*
14
+ Copyright 2012-current John Peden Ltd ( email : support@wpbackitup.com )
15
  */
16
 
17
  //define constants
20
  define("WPBACKITUP_DIRNAME", "wp-backitup");
21
  define("BACKUP_PATH", WPBACKITUP_PLUGIN_PATH .'backups/');
22
 
 
 
 
 
 
 
23
  //load admin menu
24
  function wpbackitup_admin_menus() {
25
+ $wpbackituppage = add_menu_page( __( 'WP Backitup', 'wpBackitup' ), __( 'Backup/Restore', 'wpBackitup' ), 'manage_options', 'wp-backitup', 'wpbackitup_admin', plugin_dir_url(__FILE__ ) .'images/icon.png', 77);
26
  add_action('admin_print_scripts-'.$wpbackituppage, 'wpbackitup_javascript');
27
  add_action('admin_print_styles-' .$wpbackituppage, 'wpbackitup_stylesheet' );
28
  }
31
  //enqueue javascript
32
  function wpbackitup_javascript() {
33
  wp_enqueue_script('wpbackitup-javascript', WPBACKITUP_PLUGIN_URL.'/js/wp-backitup.js');
34
+ //this needs moved to addon dir (as above)
35
  wp_enqueue_script('ajaxfileupload', WPBACKITUP_PLUGIN_URL.'/js/ajaxfileupload.js');
36
  }
37
 
67
  }
68
  die();
69
  }
70
+ add_action('wp_ajax_wpbackitup_logreader', 'wpbackitup_logreader');
71
+
72
+ //load addons
73
+ if(is_dir(WPBACKITUP_PLUGIN_PATH . "addons")){
74
+ foreach(glob(WPBACKITUP_PLUGIN_PATH . "addons/*/") as $addon) {
75
+ include_once $addon .'index.php';
76
+ }
77
+ }