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.24 |
Comparing to | |
See all releases |
Code changes from version 1.3.23 to 1.3.24
- readme.txt +1 -1
- updraftplus.php +72 -49
readme.txt
CHANGED
@@ -141,7 +141,7 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
-
= 1.3.
|
145 |
* Prefer PHP's native zip functions if available - 25% speed-up on zip creation
|
146 |
|
147 |
= 1.3.22 - 01/31/2013 =
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= 1.3.24 - 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 =
|
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
|
@@ -85,7 +85,7 @@ if (!class_exists('UpdraftPlus_Options')) require_once(UPDRAFTPLUS_DIR.'/options
|
|
85 |
|
86 |
class UpdraftPlus {
|
87 |
|
88 |
-
var $version = '1.3.
|
89 |
var $plugin_title = 'UpdraftPlus Backup/Restore';
|
90 |
|
91 |
// Choices will be shown in the admin menu in the order used here
|
@@ -184,8 +184,8 @@ class UpdraftPlus {
|
|
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")."
|
188 |
-
$logline .= (
|
189 |
$this->log($logline);
|
190 |
}
|
191 |
|
@@ -2111,7 +2111,7 @@ class UpdraftPlus {
|
|
2111 |
function make_zipfile($source, $destination) {
|
2112 |
|
2113 |
// Fallback to PclZip - which my tests show is 25% slower
|
2114 |
-
if (!
|
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);
|
@@ -2122,60 +2122,83 @@ class UpdraftPlus {
|
|
2122 |
return false;
|
2123 |
}
|
2124 |
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
$
|
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 |
-
|
2149 |
-
foreach ($files as $file)
|
2150 |
-
{
|
2151 |
-
$file = str_replace('\\', '/', $file);
|
2152 |
|
2153 |
-
|
2154 |
-
|
2155 |
-
//if( in_array(substr($file, strrpos($file, '/')+1), array('.', '..')) )
|
2156 |
-
//continue;
|
2157 |
|
2158 |
-
|
2159 |
-
|
2160 |
|
2161 |
-
|
2162 |
-
|
|
|
|
|
|
|
|
|
2163 |
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
}
|
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.24
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Author URI: http://wordshell.net
|
85 |
|
86 |
class UpdraftPlus {
|
87 |
|
88 |
+
var $version = '1.3.24';
|
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")." ZipArchive::addFile exists: ";
|
188 |
+
$logline .= (method_exists('ZipArchive', 'addFile')) ? "Y" : "N";
|
189 |
$this->log($logline);
|
190 |
}
|
191 |
|
2111 |
function make_zipfile($source, $destination) {
|
2112 |
|
2113 |
// Fallback to PclZip - which my tests show is 25% slower
|
2114 |
+
if (!method_exists('ZipArchive', 'addFile')) {
|
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);
|
2122 |
return false;
|
2123 |
}
|
2124 |
|
2125 |
+
$files_added = 0;
|
2126 |
+
if (is_array($source)) {
|
2127 |
+
foreach ($source as $element) {
|
2128 |
+
$files_added += $this->makezip_recursive_add($zip, $element, basename($element), $element);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2129 |
}
|
2130 |
+
} else {
|
2131 |
+
$files_added += $this->makezip_recursive_add($zip, $source, basename($source), $source);
|
2132 |
+
}
|
2133 |
+
|
2134 |
+
return $zip->close();
|
2135 |
|
2136 |
+
}
|
|
|
|
|
|
|
2137 |
|
2138 |
+
// This function recursively packs the zip, dereferencing symlinks but packing into a single-parent tree for universal unpacking
|
2139 |
+
function makezip_recursive_add($zip, $fullpath, $use_path_when_storing, $original_fullpath, $files_added_so_far = 0) {
|
|
|
|
|
2140 |
|
2141 |
+
// De-reference
|
2142 |
+
$fullpath = realpath($fullpath);
|
2143 |
|
2144 |
+
// Is the place we've ended up above the original base? That leads to infinite recursion
|
2145 |
+
if (($fullpath !== $original_fullpath && strpos($original_fullpath, $fullpath) === 0) || ($original_fullpath == $fullpath && strpos($use_path_when_storing, '/') !== false) ) {
|
2146 |
+
$this->log("Infinite recursion: symlink lead us to $fullpath, which is within $original_fullpath");
|
2147 |
+
$this->error("Infinite recursion: consult your log for more information");
|
2148 |
+
return false;
|
2149 |
+
}
|
2150 |
|
2151 |
+
if(is_file($fullpath)) {
|
2152 |
+
if (is_readable($fullpath)) {
|
2153 |
+
$zip->addFile($fullpath, $use_path_when_storing.'/'.basename($fullpath));
|
2154 |
+
$files_added_so_far++;
|
2155 |
+
if ($files_added_so_far % 100 == 0) $this->log("Zip: $files_added_so_far files added");
|
2156 |
+
return true;
|
2157 |
+
} else {
|
2158 |
+
$this->log("$fullpath: unreadable file");
|
2159 |
+
$this->error("$fullpath: unreadable file");
|
2160 |
+
}
|
2161 |
+
} elseif (is_dir($fullpath)) {
|
2162 |
+
$zip->addEmptyDir($use_path_when_storing);
|
2163 |
+
if (!$dir_handle = @opendir($fullpath)) {
|
2164 |
+
$this->log("Failed to open directory: $fullpath");
|
2165 |
+
$this->error("Failed to open directory: $fullpath");
|
2166 |
+
return;
|
2167 |
+
}
|
2168 |
+
while ($e = readdir($dir_handle)) {
|
2169 |
+
if ($e != '.' && $e != '..') {
|
2170 |
+
if (is_link($fullpath.'/'.$e)) {
|
2171 |
+
$deref = realpath($fullpath.'/'.$e);
|
2172 |
+
if (is_file($deref)) {
|
2173 |
+
if (is_readable($deref)) {
|
2174 |
+
$zip->addFile($deref, $use_path_when_storing.'/'.$e);
|
2175 |
+
$files_added_so_far++;
|
2176 |
+
if ($files_added_so_far % 100 == 0) $this->log("Zip: $files_added_so_far files added");
|
2177 |
+
} else {
|
2178 |
+
$this->log("$deref: unreadable file");
|
2179 |
+
$this->error("$deref: unreadable file");
|
2180 |
+
}
|
2181 |
+
} elseif (is_dir($deref)) {
|
2182 |
+
$this->makezip_recursive_add($zip, $deref, $use_path_when_storing.'/'.$e, $original_fullpath, $files_added_so_far);
|
2183 |
+
}
|
2184 |
+
} elseif (is_file($fullpath.'/'.$e)) {
|
2185 |
+
if (is_readable($fullpath.'/'.$e)) {
|
2186 |
+
$zip->addFile($fullpath.'/'.$e, $use_path_when_storing.'/'.$e);
|
2187 |
+
$files_added_so_far++;
|
2188 |
+
if ($files_added_so_far % 100 == 0) $this->log("Zip: $files_added_so_far files added");
|
2189 |
+
} else {
|
2190 |
+
$this->log("$fullpath/$e: unreadable file");
|
2191 |
+
$this->error("$fullpath/$e: unreadable file");
|
2192 |
+
}
|
2193 |
+
} elseif (is_dir($fullpath.'/'.$e)) {
|
2194 |
+
// no need to addEmptyDir here, as it gets done when we recurse
|
2195 |
+
$this->makezip_recursive_add($zip, $fullpath.'/'.$e, $use_path_when_storing.'/'.$e, $original_fullpath, $files_added_so_far);
|
2196 |
+
}
|
2197 |
}
|
2198 |
}
|
2199 |
+
closedir($dir_handle);
|
2200 |
}
|
|
|
|
|
|
|
|
|
|
|
2201 |
|
|
|
2202 |
}
|
2203 |
|
2204 |
}
|