Version Description
- 02/02/2013 =
- Prefer PHP's native zip functions if available - 25% speed-up on zip creation
Download this release
Release Info
Developer | DavidAnderson |
Plugin | UpdraftPlus WordPress Backup Plugin |
Version | 1.3.23 |
Comparing to | |
See all releases |
Code changes from version 1.3.22 to 1.3.23
- options.php +2 -2
- readme.txt +4 -1
- updraftplus.php +83 -12
options.php
CHANGED
@@ -76,7 +76,7 @@ class UpdraftPlus_Options {
|
|
76 |
|
77 |
global $updraftplus;
|
78 |
|
79 |
-
$updraftplus->show_admin_warning('<strong>UpdraftPlus warning:</strong> This is a WordPress multi-site (a.k.a. network) installation. <a href="http://updraftplus.com">WordPress Multisite is supported by UpdraftPlus Premium</a>. Non-premium UpdraftPlus does not support multi-site installations securely. <strong>Every</strong> blog admin can both back up (and hence access the data, including passwords, from) and restore (including with customised modifications, e.g. changed passwords) <strong>the entire network</strong>. Unless you are the only blog admin user across the entire network, you should immediately de-
|
80 |
|
81 |
}
|
82 |
|
@@ -86,4 +86,4 @@ class UpdraftPlus_Options {
|
|
86 |
add_action('admin_init', array('UpdraftPlus_Options', 'admin_init'));
|
87 |
add_action('admin_menu', array('UpdraftPlus_Options', 'add_admin_pages'));
|
88 |
|
89 |
-
?>
|
76 |
|
77 |
global $updraftplus;
|
78 |
|
79 |
+
$updraftplus->show_admin_warning('<strong>UpdraftPlus warning:</strong> This is a WordPress multi-site (a.k.a. network) installation. <a href="http://updraftplus.com">WordPress Multisite is supported by UpdraftPlus Premium</a>. Non-premium UpdraftPlus does not support multi-site installations securely. <strong>Every</strong> blog admin can both back up (and hence access the data, including passwords, from) and restore (including with customised modifications, e.g. changed passwords) <strong>the entire network</strong>. Unless you are the only blog admin user across the entire network, you should immediately de-activate UpdraftPlus. (This applies to all WordPress backup plugins unless they have been explicitly coded for multisite compatibility).', "error");
|
80 |
|
81 |
}
|
82 |
|
86 |
add_action('admin_init', array('UpdraftPlus_Options', 'admin_init'));
|
87 |
add_action('admin_menu', array('UpdraftPlus_Options', 'add_admin_pages'));
|
88 |
|
89 |
+
?>
|
readme.txt
CHANGED
@@ -8,7 +8,7 @@ Donate link: http://david.dw-perspective.org.uk/donate
|
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
== Upgrade Notice ==
|
11 |
-
1.
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -141,6 +141,9 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
|
|
|
|
|
|
144 |
= 1.3.22 - 01/31/2013 =
|
145 |
* More help for really large uploads; dynamically alter the maximum number of resumption attempts if something useful is still happening
|
146 |
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
== Upgrade Notice ==
|
11 |
+
1. Even more help for really large backup sets. 2. Prevent potential endless logging loop in S3 method.
|
12 |
|
13 |
== Description ==
|
14 |
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= 1.3.23 - 02/02/2013 =
|
145 |
+
* Prefer PHP's native zip functions if available - 25% speed-up on zip creation
|
146 |
+
|
147 |
= 1.3.22 - 01/31/2013 =
|
148 |
* More help for really large uploads; dynamically alter the maximum number of resumption attempts if something useful is still happening
|
149 |
|
updraftplus.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/updraftplus
|
5 |
Description: Backup and restore: your content and database can be automatically backed up to Amazon S3, Dropbox, Google Drive, FTP or email, on separate schedules.
|
6 |
Author: David Anderson.
|
7 |
-
Version: 1.3.
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Author URI: http://wordshell.net
|
@@ -27,12 +27,14 @@ TODO
|
|
27 |
// Resuming partial FTP uploads
|
28 |
// Provide backup/restoration for UpdraftPlus's settings, to allow 'bootstrap' on a fresh WP install - some kind of single-use code which a remote UpdraftPlus can use to authenticate
|
29 |
// Multiple jobs
|
|
|
30 |
// Don't stop at 10 retries if something useful is still measurably being done (in particular, chunked uploads are proceeding - set a flag to indicate "try it again")
|
31 |
// Change FTP to use SSL by default
|
32 |
// When looking for files to delete, is the current encryption setting used? Should not be.
|
33 |
// Create single zip, containing even WordPress itself
|
34 |
// When a new backup starts, AJAX-update the 'Last backup' display in the admin page.
|
35 |
// Remove the recurrence of admin notices when settings are saved due to _wp_referer
|
|
|
36 |
//http://w-shadow.com/blog/2010/09/02/automatic-updates-for-any-plugin/
|
37 |
|
38 |
Encrypt filesystem, if memory allows (and have option for abort if not); split up into multiple zips when needed
|
@@ -72,7 +74,7 @@ if (!$updraftplus->memory_check(192)) {
|
|
72 |
|
73 |
define('UPDRAFTPLUS_DIR', dirname(__FILE__));
|
74 |
define('UPDRAFTPLUS_URL', plugins_url('', __FILE__));
|
75 |
-
define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php,backup');
|
76 |
// This is used in various places, based on our assumption of the maximum time any job should take. May need lengthening in future if we get reports which show enormous sets hitting the limit.
|
77 |
// Also one section requires at least 1% progress each run, so on a 5-minute schedule, that equals just under 9 hours
|
78 |
define('UPDRAFT_TRANSTIME', 3600*9);
|
@@ -83,7 +85,7 @@ if (!class_exists('UpdraftPlus_Options')) require_once(UPDRAFTPLUS_DIR.'/options
|
|
83 |
|
84 |
class UpdraftPlus {
|
85 |
|
86 |
-
var $version = '1.3.
|
87 |
var $plugin_title = 'UpdraftPlus Backup/Restore';
|
88 |
|
89 |
// Choices will be shown in the admin menu in the order used here
|
@@ -182,7 +184,9 @@ class UpdraftPlus {
|
|
182 |
$this->opened_log_time = microtime(true);
|
183 |
$this->log("Opened log file at time: ".date('r'));
|
184 |
global $wp_version;
|
185 |
-
$
|
|
|
|
|
186 |
}
|
187 |
|
188 |
# Logs the given line, adding (relative) time stamp and newline
|
@@ -710,12 +714,10 @@ class UpdraftPlus {
|
|
710 |
die;
|
711 |
}
|
712 |
|
713 |
-
$zip_object = new PclZip($zip_name);
|
714 |
-
|
715 |
$microtime_start = microtime(true);
|
716 |
# The paths in the zip should then begin with '$whichone', having removed WP_CONTENT_DIR from the front
|
717 |
-
if (!$
|
718 |
-
$this->log("ERROR:
|
719 |
$this->error("Could not create $whichone zip. Consult the log file for more information.");
|
720 |
return false;
|
721 |
} else {
|
@@ -734,8 +736,6 @@ class UpdraftPlus {
|
|
734 |
|
735 |
if(!$this->backup_time) $this->backup_time_nonce();
|
736 |
|
737 |
-
if(!class_exists('PclZip')) require_once(ABSPATH.'/wp-admin/includes/class-pclzip.php');
|
738 |
-
|
739 |
$updraft_dir = $this->backups_dir_location();
|
740 |
if(!is_writable($updraft_dir)) {
|
741 |
$this->log('Backup directory is not writable, or does not exist');
|
@@ -1584,7 +1584,7 @@ class UpdraftPlus {
|
|
1584 |
<input type="checkbox" name="updraft_include_plugins" value="1" <?php echo $include_plugins; ?> /> Plugins<br>
|
1585 |
<input type="checkbox" name="updraft_include_themes" value="1" <?php echo $include_themes; ?> /> Themes<br>
|
1586 |
<input type="checkbox" name="updraft_include_uploads" value="1" <?php echo $include_uploads; ?> /> Uploads<br>
|
1587 |
-
<input type="checkbox" name="updraft_include_others" value="1" <?php echo $include_others; ?> /> Any other directories found inside wp-content <?php if (is_multisite()) echo "(which on a multisite install includes users' blog contents) "; ?>- but exclude these directories: <input type="text" name="updraft_include_others_exclude" size="
|
1588 |
Include all of these, unless you are backing them up outside of UpdraftPlus. The above directories are usually everything (except for WordPress core itself which you can download afresh from WordPress.org). But if you have made customised modifications outside of these directories, you need to back them up another way. (<a href="http://wordshell.net">Use WordShell</a> for automatic backup, version control and patching).<br></td>
|
1589 |
</td>
|
1590 |
</tr>
|
@@ -1951,7 +1951,7 @@ class UpdraftPlus {
|
|
1951 |
</tr>
|
1952 |
<tr>
|
1953 |
<td></td><td class="download-backups" style="display:none">
|
1954 |
-
<em>Click on a button to download the corresponding file to your computer. If you are using the <a href="http://opera.com">Opera web browser</a> then you should turn Turbo mode off.</em>
|
1955 |
<table>
|
1956 |
<?php
|
1957 |
foreach($backup_history as $key=>$value) {
|
@@ -2107,6 +2107,77 @@ class UpdraftPlus {
|
|
2107 |
$this->show_admin_warning('<strong>UpdraftPlus notice:</strong> <a href="options-general.php?page=updraftplus&action=updraftmethod-googledrive-auth&updraftplus_googleauth=doit">Click here to authenticate your Google Drive account (you will not be able to back up to Google Drive without it).</a>');
|
2108 |
}
|
2109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2110 |
}
|
2111 |
|
2112 |
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/updraftplus
|
5 |
Description: Backup and restore: your content and database can be automatically backed up to Amazon S3, Dropbox, Google Drive, FTP or email, on separate schedules.
|
6 |
Author: David Anderson.
|
7 |
+
Version: 1.3.23
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Author URI: http://wordshell.net
|
27 |
// Resuming partial FTP uploads
|
28 |
// Provide backup/restoration for UpdraftPlus's settings, to allow 'bootstrap' on a fresh WP install - some kind of single-use code which a remote UpdraftPlus can use to authenticate
|
29 |
// Multiple jobs
|
30 |
+
// Expert setting: force PCLZip
|
31 |
// Don't stop at 10 retries if something useful is still measurably being done (in particular, chunked uploads are proceeding - set a flag to indicate "try it again")
|
32 |
// Change FTP to use SSL by default
|
33 |
// When looking for files to delete, is the current encryption setting used? Should not be.
|
34 |
// Create single zip, containing even WordPress itself
|
35 |
// When a new backup starts, AJAX-update the 'Last backup' display in the admin page.
|
36 |
// Remove the recurrence of admin notices when settings are saved due to _wp_referer
|
37 |
+
// Auto-detect what the real execution time is (max_execution_time is just one of the upper limits, there can be others, some insivible directly), and tweak our resumption time accordingly
|
38 |
//http://w-shadow.com/blog/2010/09/02/automatic-updates-for-any-plugin/
|
39 |
|
40 |
Encrypt filesystem, if memory allows (and have option for abort if not); split up into multiple zips when needed
|
74 |
|
75 |
define('UPDRAFTPLUS_DIR', dirname(__FILE__));
|
76 |
define('UPDRAFTPLUS_URL', plugins_url('', __FILE__));
|
77 |
+
define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php,backup,backups');
|
78 |
// This is used in various places, based on our assumption of the maximum time any job should take. May need lengthening in future if we get reports which show enormous sets hitting the limit.
|
79 |
// Also one section requires at least 1% progress each run, so on a 5-minute schedule, that equals just under 9 hours
|
80 |
define('UPDRAFT_TRANSTIME', 3600*9);
|
85 |
|
86 |
class UpdraftPlus {
|
87 |
|
88 |
+
var $version = '1.3.23';
|
89 |
var $plugin_title = 'UpdraftPlus Backup/Restore';
|
90 |
|
91 |
// Choices will be shown in the admin menu in the order used here
|
184 |
$this->opened_log_time = microtime(true);
|
185 |
$this->log("Opened log file at time: ".date('r'));
|
186 |
global $wp_version;
|
187 |
+
$logline = "UpdraftPlus: ".$this->version." WordPress: ".$wp_version." PHP: ".phpversion()." (".@php_uname().") PHP Max Execution Time: ".@ini_get("max_execution_time")." Zip extension: ";
|
188 |
+
$logline .= (extension_loaded('zip')) ? "Y" : "N";
|
189 |
+
$this->log($logline);
|
190 |
}
|
191 |
|
192 |
# Logs the given line, adding (relative) time stamp and newline
|
714 |
die;
|
715 |
}
|
716 |
|
|
|
|
|
717 |
$microtime_start = microtime(true);
|
718 |
# The paths in the zip should then begin with '$whichone', having removed WP_CONTENT_DIR from the front
|
719 |
+
if (!$this->make_zipfile($create_from_dir, $zip_name)) {
|
720 |
+
$this->log("ERROR: Zip failure: Could not create $whichone zip");
|
721 |
$this->error("Could not create $whichone zip. Consult the log file for more information.");
|
722 |
return false;
|
723 |
} else {
|
736 |
|
737 |
if(!$this->backup_time) $this->backup_time_nonce();
|
738 |
|
|
|
|
|
739 |
$updraft_dir = $this->backups_dir_location();
|
740 |
if(!is_writable($updraft_dir)) {
|
741 |
$this->log('Backup directory is not writable, or does not exist');
|
1584 |
<input type="checkbox" name="updraft_include_plugins" value="1" <?php echo $include_plugins; ?> /> Plugins<br>
|
1585 |
<input type="checkbox" name="updraft_include_themes" value="1" <?php echo $include_themes; ?> /> Themes<br>
|
1586 |
<input type="checkbox" name="updraft_include_uploads" value="1" <?php echo $include_uploads; ?> /> Uploads<br>
|
1587 |
+
<input type="checkbox" name="updraft_include_others" value="1" <?php echo $include_others; ?> /> Any other directories found inside wp-content <?php if (is_multisite()) echo "(which on a multisite install includes users' blog contents) "; ?>- but exclude these directories: <input type="text" name="updraft_include_others_exclude" size="44" value="<?php echo htmlspecialchars($include_others_exclude); ?>"/><br>
|
1588 |
Include all of these, unless you are backing them up outside of UpdraftPlus. The above directories are usually everything (except for WordPress core itself which you can download afresh from WordPress.org). But if you have made customised modifications outside of these directories, you need to back them up another way. (<a href="http://wordshell.net">Use WordShell</a> for automatic backup, version control and patching).<br></td>
|
1589 |
</td>
|
1590 |
</tr>
|
1951 |
</tr>
|
1952 |
<tr>
|
1953 |
<td></td><td class="download-backups" style="display:none">
|
1954 |
+
<em>Click on a button to download the corresponding file to your computer. If you are using the <a href="http://opera.com">Opera web browser</a> then you should turn Turbo mode off. <strong>Note</strong> - if you use remote storage (e.g. Amazon, Dropbox, FTP, Google Drive), then pressing a button will make UpdraftPlus try to bring a backup file back from the remote storage to your webserver, and from there to your computer. If the backup file is very big, then likely you will run out of time using this method. In that case you should get the file directly (i.e. visit Amazon S3's or Dropbox's website, etc.).</em>
|
1955 |
<table>
|
1956 |
<?php
|
1957 |
foreach($backup_history as $key=>$value) {
|
2107 |
$this->show_admin_warning('<strong>UpdraftPlus notice:</strong> <a href="options-general.php?page=updraftplus&action=updraftmethod-googledrive-auth&updraftplus_googleauth=doit">Click here to authenticate your Google Drive account (you will not be able to back up to Google Drive without it).</a>');
|
2108 |
}
|
2109 |
|
2110 |
+
// Caution: $source is allowed to be an array, not just a filename
|
2111 |
+
function make_zipfile($source, $destination) {
|
2112 |
+
|
2113 |
+
// Fallback to PclZip - which my tests show is 25% slower
|
2114 |
+
if (!extension_loaded('zip') || version_compare(phpversion(), '5.2.0', '<')) {
|
2115 |
+
if(!class_exists('PclZip')) require_once(ABSPATH.'/wp-admin/includes/class-pclzip.php');
|
2116 |
+
$zip_object = new PclZip($destination);
|
2117 |
+
return $zip_object->create($source, PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
|
2118 |
+
}
|
2119 |
+
|
2120 |
+
$zip = new ZipArchive();
|
2121 |
+
if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
|
2122 |
+
return false;
|
2123 |
+
}
|
2124 |
+
|
2125 |
+
if (is_array($source) || is_dir($source) === true || is_link($source)) {
|
2126 |
+
$iterators = array();
|
2127 |
+
if (is_array($source)) {
|
2128 |
+
$remove_path = realpath(WP_CONTENT_DIR);
|
2129 |
+
// Each is a full path
|
2130 |
+
foreach ($source as $entry) {
|
2131 |
+
// Strip off WP_CONTENT_DIR first, before we dereference
|
2132 |
+
$relative = str_replace(WP_CONTENT_DIR.'/', '', $entry.'/');
|
2133 |
+
$entry = str_replace('\\', '/', realpath($entry));
|
2134 |
+
if (is_file($entry)) {
|
2135 |
+
$iterators[] = array($entry);
|
2136 |
+
} elseif (is_dir($entry)) {
|
2137 |
+
$zip->addEmptyDir($relative);
|
2138 |
+
// TODO: This doesn't deal with symlinks inside a directory, e.g. uploads/2010 is a symlink
|
2139 |
+
$iterators[] = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($entry), RecursiveIteratorIterator::SELF_FIRST);
|
2140 |
+
}
|
2141 |
+
}
|
2142 |
+
} else {
|
2143 |
+
$remove_path = dirname(realpath($source));
|
2144 |
+
$source = str_replace('\\', '/', realpath($source));
|
2145 |
+
$iterators[] = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
|
2146 |
+
}
|
2147 |
+
|
2148 |
+
foreach ($iterators as $files) {
|
2149 |
+
foreach ($files as $file)
|
2150 |
+
{
|
2151 |
+
$file = str_replace('\\', '/', $file);
|
2152 |
+
|
2153 |
+
// Ignore "." and ".." folders - these don't seem to occur anyway, but some pages found on Google indicate that they can
|
2154 |
+
if (substr($file, -3, 3) == "/.." || substr($file, -2, 2) == '/.') continue;
|
2155 |
+
//if( in_array(substr($file, strrpos($file, '/')+1), array('.', '..')) )
|
2156 |
+
//continue;
|
2157 |
+
|
2158 |
+
// Remove prefix before de-referencing
|
2159 |
+
$usename = str_replace($remove_path . '/', '', $file);
|
2160 |
+
|
2161 |
+
// De-reference
|
2162 |
+
$file = realpath($file);
|
2163 |
+
|
2164 |
+
if (is_file($file) === true) {
|
2165 |
+
$zip->addFile($file, $usename);
|
2166 |
+
}
|
2167 |
+
elseif (is_dir($file) === true) {
|
2168 |
+
$zip->addEmptyDir($usename);
|
2169 |
+
}
|
2170 |
+
}
|
2171 |
+
}
|
2172 |
+
}
|
2173 |
+
else if (is_file($source) === true)
|
2174 |
+
{
|
2175 |
+
$zip->addFile($source, basename($source));
|
2176 |
+
}
|
2177 |
+
|
2178 |
+
return $zip->close();
|
2179 |
+
}
|
2180 |
+
|
2181 |
}
|
2182 |
|
2183 |
|