Version Description
New features: selective restoration, importing remote backups; plus many tweaks, optimisations + small bug-fixes: recommended upgrade for all
Download this release
Release Info
Developer | DavidAnderson |
Plugin | UpdraftPlus WordPress Backup Plugin |
Version | 1.5.8 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 1.5.8
- updraftplus.php +31 -6
updraftplus.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
|
|
4 |
Plugin URI: http://updraftplus.com
|
5 |
Description: Backup and restore: your site can be backed up locally or to Amazon S3, Dropbox, Google Drive, (S)FTP, WebDAV & email, on automatic schedules.
|
6 |
Author: UpdraftPlus.Com, DavidAnderson
|
7 |
-
Version: 1.5.
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Text Domain: updraftplus
|
@@ -368,6 +368,24 @@ class UpdraftPlus {
|
|
368 |
$this->current_resumption = $resumption_no;
|
369 |
$this->log("Backup run: resumption=$resumption_no, nonce=$bnonce, begun at=$btime (${time_ago}s ago), job type: $job_type");
|
370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
// Schedule again, to run in 5 minutes again, in case we again fail
|
372 |
// The actual interval can be increased (for future resumptions) by other code, if it detects apparent overlapping
|
373 |
$resume_interval = $this->jobdata_get('resume_interval');
|
@@ -381,7 +399,7 @@ class UpdraftPlus {
|
|
381 |
wp_schedule_single_event($schedule_for, 'updraft_backup_resume', array($next_resumption, $bnonce));
|
382 |
$this->newresumption_scheduled = $schedule_for;
|
383 |
} else {
|
384 |
-
$this->log(sprintf('The current run is attempt number %d - will not schedule a further attempt until we see something useful happening'
|
385 |
}
|
386 |
|
387 |
// Sanity check
|
@@ -3088,7 +3106,7 @@ class UpdraftPlus {
|
|
3088 |
if (file_exists($zipfile)) {
|
3089 |
$opencode = $zip->open($zipfile);
|
3090 |
$original_size = filesize($zipfile);
|
3091 |
-
clearstatcache(
|
3092 |
} else {
|
3093 |
$opencode = $zip->open($zipfile, ZIPARCHIVE::CREATE);
|
3094 |
$original_size = 0;
|
@@ -3111,7 +3129,7 @@ class UpdraftPlus {
|
|
3111 |
if ($data_added_since_reopen > 26214400 || (time() - $this->zipfiles_lastwritetime) > 2) {
|
3112 |
|
3113 |
$before_size = filesize($zipfile);
|
3114 |
-
clearstatcache(
|
3115 |
|
3116 |
if ($data_added_since_reopen > 26214400) {
|
3117 |
$this->log("Adding batch to zip file: over 25Mb added on this batch (".round($data_added_since_reopen/1048576,1)." Mb); re-opening (prior size: ".round($before_size/1024,1).' Kb)');
|
@@ -3129,7 +3147,7 @@ class UpdraftPlus {
|
|
3129 |
$this->zipfiles_lastwritetime = time();
|
3130 |
// Call here, in case we've got so many big files that we don't complete the whole routine
|
3131 |
if (filesize($zipfile) > $before_size) $this->something_useful_happened();
|
3132 |
-
clearstatcache(
|
3133 |
}
|
3134 |
}
|
3135 |
$this->zipfiles_added++;
|
@@ -3141,11 +3159,18 @@ class UpdraftPlus {
|
|
3141 |
$ret = $zip->close();
|
3142 |
$this->zipfiles_lastwritetime = time();
|
3143 |
if (filesize($zipfile) > $original_size) $this->something_useful_happened();
|
3144 |
-
clearstatcache(
|
3145 |
return $ret;
|
3146 |
}
|
3147 |
|
3148 |
function something_useful_happened() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3149 |
if ($this->current_resumption >= 9 && $this->newresumption_scheduled == false) {
|
3150 |
$resume_interval = $this->jobdata_get('resume_interval');
|
3151 |
if (!is_numeric($resume_interval) || $resume_interval<$this->minimum_resume_interval()) { $resume_interval = $this->minimum_resume_interval(); }
|
4 |
Plugin URI: http://updraftplus.com
|
5 |
Description: Backup and restore: your site can be backed up locally or to Amazon S3, Dropbox, Google Drive, (S)FTP, WebDAV & email, on automatic schedules.
|
6 |
Author: UpdraftPlus.Com, DavidAnderson
|
7 |
+
Version: 1.5.8
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Text Domain: updraftplus
|
368 |
$this->current_resumption = $resumption_no;
|
369 |
$this->log("Backup run: resumption=$resumption_no, nonce=$bnonce, begun at=$btime (${time_ago}s ago), job type: $job_type");
|
370 |
|
371 |
+
if ($resumption_no == 8) {
|
372 |
+
$time_passed = $this->jobdata_get('run_times');
|
373 |
+
if (!is_array($time_passed)) $time_passed = array();
|
374 |
+
$timings_string = "";
|
375 |
+
$run_times_known=0;
|
376 |
+
for ($i=0; $i<=7; $i++) {
|
377 |
+
$timings_string .= "$i:";
|
378 |
+
if (isset($time_passed[$i])) {
|
379 |
+
$timings_string .= round($time_passed[$i], 1).' ';
|
380 |
+
$run_times_known++;
|
381 |
+
} else {
|
382 |
+
$timings_string .= '? ';
|
383 |
+
}
|
384 |
+
}
|
385 |
+
$this->log("Time passed on previous resumptions: $passed");
|
386 |
+
// TODO: If there's sufficient data and an upper limit clearly lower than our present resume_interval, then decrease the resume_interval
|
387 |
+
}
|
388 |
+
|
389 |
// Schedule again, to run in 5 minutes again, in case we again fail
|
390 |
// The actual interval can be increased (for future resumptions) by other code, if it detects apparent overlapping
|
391 |
$resume_interval = $this->jobdata_get('resume_interval');
|
399 |
wp_schedule_single_event($schedule_for, 'updraft_backup_resume', array($next_resumption, $bnonce));
|
400 |
$this->newresumption_scheduled = $schedule_for;
|
401 |
} else {
|
402 |
+
$this->log(sprintf('The current run is attempt number %d - will not schedule a further attempt until we see something useful happening', 10));
|
403 |
}
|
404 |
|
405 |
// Sanity check
|
3106 |
if (file_exists($zipfile)) {
|
3107 |
$opencode = $zip->open($zipfile);
|
3108 |
$original_size = filesize($zipfile);
|
3109 |
+
clearstatcache();
|
3110 |
} else {
|
3111 |
$opencode = $zip->open($zipfile, ZIPARCHIVE::CREATE);
|
3112 |
$original_size = 0;
|
3129 |
if ($data_added_since_reopen > 26214400 || (time() - $this->zipfiles_lastwritetime) > 2) {
|
3130 |
|
3131 |
$before_size = filesize($zipfile);
|
3132 |
+
clearstatcache();
|
3133 |
|
3134 |
if ($data_added_since_reopen > 26214400) {
|
3135 |
$this->log("Adding batch to zip file: over 25Mb added on this batch (".round($data_added_since_reopen/1048576,1)." Mb); re-opening (prior size: ".round($before_size/1024,1).' Kb)');
|
3147 |
$this->zipfiles_lastwritetime = time();
|
3148 |
// Call here, in case we've got so many big files that we don't complete the whole routine
|
3149 |
if (filesize($zipfile) > $before_size) $this->something_useful_happened();
|
3150 |
+
clearstatcache();
|
3151 |
}
|
3152 |
}
|
3153 |
$this->zipfiles_added++;
|
3159 |
$ret = $zip->close();
|
3160 |
$this->zipfiles_lastwritetime = time();
|
3161 |
if (filesize($zipfile) > $original_size) $this->something_useful_happened();
|
3162 |
+
clearstatcache();
|
3163 |
return $ret;
|
3164 |
}
|
3165 |
|
3166 |
function something_useful_happened() {
|
3167 |
+
|
3168 |
+
// First, update the record of maximum detected runtime on each run
|
3169 |
+
$time_passed = $this->jobdata_get('run_times');
|
3170 |
+
if (!is_array($time_passed)) $time_passed = array();
|
3171 |
+
$time_passed[$this->current_resumption] = microtime(true)-$this->opened_log_time;
|
3172 |
+
$this->jobdata_set('run_times', $time_passed);
|
3173 |
+
|
3174 |
if ($this->current_resumption >= 9 && $this->newresumption_scheduled == false) {
|
3175 |
$resume_interval = $this->jobdata_get('resume_interval');
|
3176 |
if (!is_numeric($resume_interval) || $resume_interval<$this->minimum_resume_interval()) { $resume_interval = $this->minimum_resume_interval(); }
|