Version Description
- Fixed: Could not restore websites in some cases.
- Fixed: The setting of PHP version that had been changed in .htaccess was lost after restoration.
- Added an option to merge all backup files into a package when a backup completes. This can increase backup and migration success rate in a website with insufficient server resources.
- Upgraded: Amazon S3 and DigitalOceanSpace have upgraded their connection methods, so you will need to delete the previous connections and re-add your Amazon S3/DigtalOcean Space accounts to make sure the connections work.
- Optimized the plugin code.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.25 |
Comparing to | |
See all releases |
Code changes from version 0.9.24 to 0.9.25
- admin/class-wpvivid-admin.php +45 -25
- admin/js/wpvivid-admin.js +10 -65
- admin/partials/wpvivid-admin-display.php +55 -5
- admin/partials/wpvivid-backup-restore-page-display.php +71 -4
- admin/partials/wpvivid-remote-storage-page-display.php +6 -4
- admin/partials/wpvivid-schedule-page-display.php +12 -4
- admin/partials/wpvivid-settings-page-display.php +35 -11
- includes/class-wpvivid-backup-uploader.php +0 -1
- includes/class-wpvivid-backup.php +94 -44
- includes/class-wpvivid-backuplist.php +1 -2
- includes/class-wpvivid-mail-report.php +5 -0
- includes/class-wpvivid-migrate.php +15 -3
- includes/class-wpvivid-remote-collection.php +1 -0
- includes/class-wpvivid-restore-data.php +12 -0
- includes/class-wpvivid-restore-database.php +4 -2
- includes/class-wpvivid-restore-site.php +26 -3
- includes/class-wpvivid-restore.php +1 -1
- includes/class-wpvivid-schedule.php +14 -1
- includes/class-wpvivid-setting.php +3 -1
- includes/class-wpvivid-tools.php +3 -6
- includes/class-wpvivid-zipclass.php +5 -0
- includes/class-wpvivid.php +280 -37
- includes/customclass/class-wpvivid-amazons3-plus.php +374 -137
- includes/customclass/class-wpvivid-base-s3.php +48 -0
- includes/customclass/class-wpvivid-dropbox.php +99 -4
- includes/customclass/class-wpvivid-ftpclass.php +196 -50
- includes/customclass/class-wpvivid-google-drive.php +89 -25
- includes/customclass/class-wpvivid-one-drive.php +93 -21
- includes/customclass/class-wpvivid-s3.php +133 -1
- includes/customclass/class-wpvivid-s3compat.php +316 -138
- includes/customclass/class-wpvivid-send-to-site.php +5 -6
- includes/customclass/class-wpvivid-sftpclass.php +194 -44
- readme.txt +38 -17
- wpvivid-backuprestore.php +2 -2
admin/class-wpvivid-admin.php
CHANGED
@@ -443,6 +443,7 @@ class WPvivid_Admin {
|
|
443 |
|
444 |
$this->wpvivid_show_add_my_review();
|
445 |
$this->wpvivid_check_extensions();
|
|
|
446 |
|
447 |
$loglist=$wpvivid_plugin->get_log_list_ex();
|
448 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
@@ -596,6 +597,36 @@ class WPvivid_Admin {
|
|
596 |
}
|
597 |
}
|
598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
public static function wpvivid_check_extensions(){
|
600 |
$need_php_extensions = array();
|
601 |
$need_extensions_count = 0;
|
@@ -834,17 +865,6 @@ class WPvivid_Admin {
|
|
834 |
</h2>
|
835 |
<?php do_action('wpvivid_settingpage_add_page'); ?>
|
836 |
<div><input class="button-primary" id="wpvivid_setting_general_save" type="submit" value="<?php esc_attr_e( 'Save Changes', 'wpvivid' ); ?>" style="float: right;" /></div>
|
837 |
-
<!--<table class="widefat">
|
838 |
-
<tbody>
|
839 |
-
<?php do_action('wpvivid_setting_add_cell'); ?>
|
840 |
-
<tfoot>
|
841 |
-
<tr>
|
842 |
-
<th class="row-title"><input class="button-primary storage-account-button" id="wpvivid_setting_general_save" type="submit" name="" value="<?php esc_attr_e( 'Save Changes', 'wpvivid' ); ?>" /></th>
|
843 |
-
<th></th>
|
844 |
-
</tr>
|
845 |
-
</tfoot>
|
846 |
-
</tbody>
|
847 |
-
</table>-->
|
848 |
</div>
|
849 |
</div>
|
850 |
<script>
|
@@ -1002,20 +1022,6 @@ class WPvivid_Admin {
|
|
1002 |
$loglist=$wpvivid_plugin->get_log_list_ex();
|
1003 |
?>
|
1004 |
<div id="logs-page" class="wrap-tab-content wpvivid_tab_log" name="tab-logs" style="display:none;">
|
1005 |
-
<div style="padding-bottom: 10px; float: right;">
|
1006 |
-
<select name="" id="wpvivid_display_log_count">
|
1007 |
-
<?php
|
1008 |
-
foreach ($display_log_count as $value){
|
1009 |
-
if($value == $max_log_diaplay){
|
1010 |
-
_e('<option selected="selected" value="' . $value . '">' . $value . '</option>', 'wpvivid');
|
1011 |
-
}
|
1012 |
-
else {
|
1013 |
-
_e('<option value="' . $value . '">' . $value . '</option>', 'wpvivid');
|
1014 |
-
}
|
1015 |
-
}
|
1016 |
-
?>
|
1017 |
-
</select>
|
1018 |
-
</div>
|
1019 |
<table class="wp-list-table widefat plugins">
|
1020 |
<thead class="log-head">
|
1021 |
<tr>
|
@@ -1046,6 +1052,20 @@ class WPvivid_Admin {
|
|
1046 |
</span>
|
1047 |
</div>
|
1048 |
<input class="button-secondary log-page" id="wpvivid_next_log_page" type="submit" value="<?php esc_attr_e( ' Next page > ', 'wpvivid' ); ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1049 |
</div>
|
1050 |
</div>
|
1051 |
<script>
|
443 |
|
444 |
$this->wpvivid_show_add_my_review();
|
445 |
$this->wpvivid_check_extensions();
|
446 |
+
$this->wpvivid_check_amazons3();
|
447 |
|
448 |
$loglist=$wpvivid_plugin->get_log_list_ex();
|
449 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
597 |
}
|
598 |
}
|
599 |
|
600 |
+
public function wpvivid_check_amazons3(){
|
601 |
+
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
602 |
+
$need_amazons3_notice = false;
|
603 |
+
if(isset($remoteslist) && !empty($remoteslist)){
|
604 |
+
foreach ($remoteslist as $remote_id => $value){
|
605 |
+
if($remote_id === 'remote_selected') {
|
606 |
+
continue;
|
607 |
+
}
|
608 |
+
if($value['type'] == 'amazons3' && isset($value['s3Path'])){
|
609 |
+
$need_amazons3_notice = true;
|
610 |
+
}
|
611 |
+
if($value['type'] == 's3compat' && isset($value['s3directory'])){
|
612 |
+
$need_amazons3_notice = true;
|
613 |
+
}
|
614 |
+
}
|
615 |
+
}
|
616 |
+
if($need_amazons3_notice){
|
617 |
+
$amazons3_notice = WPvivid_Setting::get_option('wpvivid_amazons3_notice', 'not init');
|
618 |
+
if($amazons3_notice === 'not init') {
|
619 |
+
$notice_message = 'As Amazon S3 and DigitalOcean Space have upgraded their connection methods, please delete the previous connections and re-add your Amazon S3/DigitalOcean Space accounts to make sure the connections work.';
|
620 |
+
_e('<div class="notice notice-warning" id="wpvivid_amazons3_notice">
|
621 |
+
<p>' . $notice_message . '</p>
|
622 |
+
<div style="padding-bottom: 10px;">
|
623 |
+
<span><input type="button" class="button-secondary" value="I Understand" onclick="wpvivid_click_amazons3_notice();" /></span>
|
624 |
+
</div>
|
625 |
+
</div>');
|
626 |
+
}
|
627 |
+
}
|
628 |
+
}
|
629 |
+
|
630 |
public static function wpvivid_check_extensions(){
|
631 |
$need_php_extensions = array();
|
632 |
$need_extensions_count = 0;
|
865 |
</h2>
|
866 |
<?php do_action('wpvivid_settingpage_add_page'); ?>
|
867 |
<div><input class="button-primary" id="wpvivid_setting_general_save" type="submit" value="<?php esc_attr_e( 'Save Changes', 'wpvivid' ); ?>" style="float: right;" /></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
</div>
|
869 |
</div>
|
870 |
<script>
|
1022 |
$loglist=$wpvivid_plugin->get_log_list_ex();
|
1023 |
?>
|
1024 |
<div id="logs-page" class="wrap-tab-content wpvivid_tab_log" name="tab-logs" style="display:none;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1025 |
<table class="wp-list-table widefat plugins">
|
1026 |
<thead class="log-head">
|
1027 |
<tr>
|
1052 |
</span>
|
1053 |
</div>
|
1054 |
<input class="button-secondary log-page" id="wpvivid_next_log_page" type="submit" value="<?php esc_attr_e( ' Next page > ', 'wpvivid' ); ?>" />
|
1055 |
+
<div style="float: right;">
|
1056 |
+
<select name="" id="wpvivid_display_log_count">
|
1057 |
+
<?php
|
1058 |
+
foreach ($display_log_count as $value){
|
1059 |
+
if($value == $max_log_diaplay){
|
1060 |
+
_e('<option selected="selected" value="' . $value . '">' . $value . '</option>', 'wpvivid');
|
1061 |
+
}
|
1062 |
+
else {
|
1063 |
+
_e('<option value="' . $value . '">' . $value . '</option>', 'wpvivid');
|
1064 |
+
}
|
1065 |
+
}
|
1066 |
+
?>
|
1067 |
+
</select>
|
1068 |
+
</div>
|
1069 |
</div>
|
1070 |
</div>
|
1071 |
<script>
|
admin/js/wpvivid-admin.js
CHANGED
@@ -57,8 +57,6 @@ var wpvivid_resotre_is_migrate=0;
|
|
57 |
$(document).ready(function () {
|
58 |
//wpvivid_getrequest();
|
59 |
|
60 |
-
wpvivid_activate_cron();
|
61 |
-
|
62 |
wpvivid_interface_flow_control();
|
63 |
|
64 |
$('input[option=review]').click(function(){
|
@@ -338,69 +336,6 @@ function wpvivid_check_runningtask(){
|
|
338 |
}
|
339 |
}
|
340 |
|
341 |
-
function wpvivid_read_log(action, param){
|
342 |
-
var tab_id = '';
|
343 |
-
var content_id = '';
|
344 |
-
var ajax_data = '';
|
345 |
-
var show_page = '';
|
346 |
-
if(typeof param === 'undefined') param = '';
|
347 |
-
switch(action){
|
348 |
-
case 'wpvivid_view_backup_task_log':
|
349 |
-
ajax_data = {
|
350 |
-
'action':action,
|
351 |
-
'id':running_backup_taskid
|
352 |
-
};
|
353 |
-
tab_id = 'wpvivid_tab_backup_log';
|
354 |
-
content_id = 'wpvivid_display_log_content';
|
355 |
-
show_page = 'backup_page';
|
356 |
-
break;
|
357 |
-
case 'wpvivid_read_last_backup_log':
|
358 |
-
var ajax_data = {
|
359 |
-
'action': action,
|
360 |
-
'log_file_name': param
|
361 |
-
};
|
362 |
-
tab_id = 'wpvivid_tab_backup_log';
|
363 |
-
content_id = 'wpvivid_display_log_content';
|
364 |
-
show_page = 'backup_page';
|
365 |
-
break;
|
366 |
-
case 'wpvivid_view_backup_log':
|
367 |
-
var ajax_data={
|
368 |
-
'action':action,
|
369 |
-
'id':param
|
370 |
-
};
|
371 |
-
tab_id = 'wpvivid_tab_backup_log';
|
372 |
-
content_id = 'wpvivid_display_log_content';
|
373 |
-
show_page = 'backup_page';
|
374 |
-
break;
|
375 |
-
case 'wpvivid_view_log':
|
376 |
-
var ajax_data={
|
377 |
-
'action':action,
|
378 |
-
'path':param
|
379 |
-
};
|
380 |
-
tab_id = 'wpvivid_tab_read_log';
|
381 |
-
content_id = 'wpvivid_read_log_content';
|
382 |
-
show_page = 'log_page';
|
383 |
-
break;
|
384 |
-
default:
|
385 |
-
break;
|
386 |
-
}
|
387 |
-
jQuery('#'+tab_id).show();
|
388 |
-
jQuery('#'+content_id).html("");
|
389 |
-
if(show_page === 'backup_page'){
|
390 |
-
//wpvivid_click_switch_backup_page(tab_id);
|
391 |
-
wpvivid_click_switch_page('backup', tab_id, true);
|
392 |
-
}
|
393 |
-
else if(show_page === 'log_page') {
|
394 |
-
wpvivid_click_switch_page('wrap', tab_id, true);
|
395 |
-
}
|
396 |
-
wpvivid_post_request(ajax_data, function(data){
|
397 |
-
wpvivid_show_log(data, content_id);
|
398 |
-
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
399 |
-
var div = 'Reading the log failed. Please try again.';
|
400 |
-
jQuery('#wpvivid_display_log_content').html(div);
|
401 |
-
});
|
402 |
-
}
|
403 |
-
|
404 |
/**
|
405 |
* This function will show the log on a text box.
|
406 |
*
|
@@ -689,6 +624,16 @@ function wpvivid_add_review_info(review){
|
|
689 |
});
|
690 |
}
|
691 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
692 |
function wpvivid_ajax_data_transfer(data_type){
|
693 |
var json = {};
|
694 |
jQuery('input:checkbox[option='+data_type+']').each(function() {
|
57 |
$(document).ready(function () {
|
58 |
//wpvivid_getrequest();
|
59 |
|
|
|
|
|
60 |
wpvivid_interface_flow_control();
|
61 |
|
62 |
$('input[option=review]').click(function(){
|
336 |
}
|
337 |
}
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
/**
|
340 |
* This function will show the log on a text box.
|
341 |
*
|
624 |
});
|
625 |
}
|
626 |
|
627 |
+
function wpvivid_click_amazons3_notice(){
|
628 |
+
var ajax_data={
|
629 |
+
'action': 'wpvivid_amazons3_notice'
|
630 |
+
};
|
631 |
+
jQuery('#wpvivid_amazons3_notice').hide();
|
632 |
+
wpvivid_post_request(ajax_data, function(res){
|
633 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
634 |
+
});
|
635 |
+
}
|
636 |
+
|
637 |
function wpvivid_ajax_data_transfer(data_type){
|
638 |
var json = {};
|
639 |
jQuery('input:checkbox[option='+data_type+']').each(function() {
|
admin/partials/wpvivid-admin-display.php
CHANGED
@@ -41,7 +41,17 @@ function wpvivid_schedule_module($html){
|
|
41 |
$html = '';
|
42 |
return $html;
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
add_filter('wpvivid_schedule_module', 'wpvivid_schedule_module', 10);
|
|
|
45 |
|
46 |
?>
|
47 |
|
@@ -57,7 +67,11 @@ foreach ($page_array as $page_name){
|
|
57 |
?>
|
58 |
|
59 |
<div class="wrap">
|
60 |
-
<h1><?php
|
|
|
|
|
|
|
|
|
61 |
<div id="wpvivid_backup_notice">
|
62 |
<?php
|
63 |
if($schedule['enable'] == true) {
|
@@ -70,6 +84,7 @@ foreach ($page_array as $page_name){
|
|
70 |
}
|
71 |
?>
|
72 |
</div>
|
|
|
73 |
<div id="wpvivid_remote_notice"></div>
|
74 |
</div>
|
75 |
<h2 class="nav-tab-wrapper">
|
@@ -78,7 +93,7 @@ foreach ($page_array as $page_name){
|
|
78 |
?>
|
79 |
</h2>
|
80 |
<div class="wrap" style="max-width:1720px;">
|
81 |
-
<div id="poststuff">
|
82 |
<div id="post-body" class="metabox-holder columns-2">
|
83 |
<div id="post-body-content">
|
84 |
<div class="inside" style="margin-top:0;">
|
@@ -92,14 +107,21 @@ foreach ($page_array as $page_name){
|
|
92 |
<div id="postbox-container-1" class="postbox-container">
|
93 |
<div class="meta-box-sortables">
|
94 |
<div class="postbox">
|
95 |
-
<h2><span>Current Version: <?php
|
|
|
|
|
|
|
96 |
</div>
|
97 |
-
<div>
|
98 |
<?php
|
99 |
$schedule_html = '';
|
100 |
echo apply_filters('wpvivid_schedule_module', $schedule_html);
|
101 |
?>
|
102 |
</div>
|
|
|
|
|
|
|
|
|
103 |
<div class="postbox">
|
104 |
<h2><span>Troubleshooting</span></h2>
|
105 |
<div class="inside">
|
@@ -155,6 +177,7 @@ foreach ($page_array as $page_name){
|
|
155 |
// Show the current tab, and add an "nav-tab-active" class to the button that opened the tab
|
156 |
document.getElementById(contentName).style.display = "block";
|
157 |
evt.currentTarget.className += " nav-tab-active";
|
|
|
158 |
}
|
159 |
function switchrestoreTabs(evt,contentName) {
|
160 |
// Declare all variables
|
@@ -201,10 +224,37 @@ foreach ($page_array as $page_name){
|
|
201 |
wpvivid_click_switch_page('wrap', wpvivid_page_request, false);
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
jQuery(document).ready(function ()
|
205 |
{
|
206 |
wpvivid_getrequest();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
wpvivid_manage_task();
|
|
|
|
|
|
|
208 |
});
|
209 |
|
210 |
-
</script>
|
41 |
$html = '';
|
42 |
return $html;
|
43 |
}
|
44 |
+
|
45 |
+
function wpvivid_join_pro_testing($html){
|
46 |
+
$html = '';
|
47 |
+
$html = '<div class="postbox">
|
48 |
+
<h2><a href="https://wpvivid.com/pro-version-beta-testing?utm_source=client_beta_testing&utm_medium=inner_link&utm_campaign=access">WPvivid Backup Pro Beta Testing</a></h2>
|
49 |
+
</div>';
|
50 |
+
return $html;
|
51 |
+
}
|
52 |
+
|
53 |
add_filter('wpvivid_schedule_module', 'wpvivid_schedule_module', 10);
|
54 |
+
add_filter('wpvivid_join_pro_testing', 'wpvivid_join_pro_testing', 10);
|
55 |
|
56 |
?>
|
57 |
|
67 |
?>
|
68 |
|
69 |
<div class="wrap">
|
70 |
+
<h1><?php
|
71 |
+
$plugin_display_name = 'WPvivid Backup Plugin';
|
72 |
+
$plugin_display_name = apply_filters('wpvivid_display_pro_name', $plugin_display_name);
|
73 |
+
_e($plugin_display_name);
|
74 |
+
?></h1>
|
75 |
<div id="wpvivid_backup_notice">
|
76 |
<?php
|
77 |
if($schedule['enable'] == true) {
|
84 |
}
|
85 |
?>
|
86 |
</div>
|
87 |
+
<?php do_action('wpvivid_add_schedule_notice'); ?>
|
88 |
<div id="wpvivid_remote_notice"></div>
|
89 |
</div>
|
90 |
<h2 class="nav-tab-wrapper">
|
93 |
?>
|
94 |
</h2>
|
95 |
<div class="wrap" style="max-width:1720px;">
|
96 |
+
<div id="poststuff" style="padding-top: 0;">
|
97 |
<div id="post-body" class="metabox-holder columns-2">
|
98 |
<div id="post-body-content">
|
99 |
<div class="inside" style="margin-top:0;">
|
107 |
<div id="postbox-container-1" class="postbox-container">
|
108 |
<div class="meta-box-sortables">
|
109 |
<div class="postbox">
|
110 |
+
<h2><span>Current Version: <?php
|
111 |
+
$wpvivid_version = apply_filters('wpvivid_display_pro_version', $wpvivid_version);
|
112 |
+
_e($wpvivid_version, 'wpvivid');
|
113 |
+
?></span></h2>
|
114 |
</div>
|
115 |
+
<div id="wpvivid_backup_schedule_part">
|
116 |
<?php
|
117 |
$schedule_html = '';
|
118 |
echo apply_filters('wpvivid_schedule_module', $schedule_html);
|
119 |
?>
|
120 |
</div>
|
121 |
+
<?php
|
122 |
+
$join_pro_testing = '';
|
123 |
+
echo apply_filters('wpvivid_join_pro_testing', $join_pro_testing);
|
124 |
+
?>
|
125 |
<div class="postbox">
|
126 |
<h2><span>Troubleshooting</span></h2>
|
127 |
<div class="inside">
|
177 |
// Show the current tab, and add an "nav-tab-active" class to the button that opened the tab
|
178 |
document.getElementById(contentName).style.display = "block";
|
179 |
evt.currentTarget.className += " nav-tab-active";
|
180 |
+
jQuery( document ).trigger( 'wpvivid-switch-tabs', contentName );
|
181 |
}
|
182 |
function switchrestoreTabs(evt,contentName) {
|
183 |
// Declare all variables
|
224 |
wpvivid_click_switch_page('wrap', wpvivid_page_request, false);
|
225 |
}
|
226 |
|
227 |
+
function wpvivid_task_monitor()
|
228 |
+
{
|
229 |
+
setTimeout(function () {
|
230 |
+
wpvivid_task_monitor();
|
231 |
+
}, 120000);
|
232 |
+
|
233 |
+
var ajax_data = {
|
234 |
+
'action': 'wpvivid_task_monitor'
|
235 |
+
};
|
236 |
+
|
237 |
+
wpvivid_post_request(ajax_data, function (data)
|
238 |
+
{
|
239 |
+
},function (XMLHttpRequest, textStatus, errorThrown)
|
240 |
+
{
|
241 |
+
});
|
242 |
+
}
|
243 |
+
|
244 |
jQuery(document).ready(function ()
|
245 |
{
|
246 |
wpvivid_getrequest();
|
247 |
+
wpvivid_task_monitor();
|
248 |
+
<?php
|
249 |
+
$default_task_type = array();
|
250 |
+
$default_task_type = apply_filters('wpvivid_get_task_type', $default_task_type);
|
251 |
+
if(empty($default_task_type)){
|
252 |
+
?>
|
253 |
+
wpvivid_activate_cron();
|
254 |
wpvivid_manage_task();
|
255 |
+
<?php
|
256 |
+
}
|
257 |
+
?>
|
258 |
});
|
259 |
|
260 |
+
</script>
|
admin/partials/wpvivid-backup-restore-page-display.php
CHANGED
@@ -4,15 +4,19 @@ function wpvivid_add_backup_type($html, $type_name)
|
|
4 |
{
|
5 |
$html .= '<label>
|
6 |
<input type="radio" option="backup" name="'.$type_name.'" value="files+db" checked />
|
7 |
-
<span>'.__( 'Database + Files (
|
8 |
</label><br>
|
9 |
<label>
|
10 |
<input type="radio" option="backup" name="'.$type_name.'" value="files" />
|
11 |
-
<span>'.__( '
|
12 |
</label><br>
|
13 |
<label>
|
14 |
<input type="radio" option="backup" name="'.$type_name.'" value="db" />
|
15 |
<span>'.__( 'Only Database', 'wpvivid' ).'</span>
|
|
|
|
|
|
|
|
|
16 |
</label><br>';
|
17 |
return $html;
|
18 |
}
|
@@ -40,8 +44,8 @@ function wpvivid_backup_do_js(){
|
|
40 |
$percent=$value['data']['progress'];
|
41 |
?>
|
42 |
jQuery('#wpvivid_postbox_backup_percent').show();
|
43 |
-
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': '
|
44 |
-
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': '
|
45 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', <?php echo $percent; ?>+'%');
|
46 |
jQuery('#wpvivid_backup_database_size').html('<?php echo $value['size']['db_size']; ?>');
|
47 |
jQuery('#wpvivid_backup_file_size').html('<?php echo $value['size']['files_size']['sum']; ?>');
|
@@ -278,6 +282,69 @@ function wpvivid_backuppage_add_page_backup(){
|
|
278 |
});
|
279 |
}
|
280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
function wpvivid_initialize_download(backup_id, list_name){
|
282 |
wpvivid_reset_backup_list(list_name);
|
283 |
jQuery('#wpvivid_download_loading_'+backup_id).addClass('is-active');
|
4 |
{
|
5 |
$html .= '<label>
|
6 |
<input type="radio" option="backup" name="'.$type_name.'" value="files+db" checked />
|
7 |
+
<span>'.__( 'Database + Files (WordPress Files)', 'wpvivid' ).'</span>
|
8 |
</label><br>
|
9 |
<label>
|
10 |
<input type="radio" option="backup" name="'.$type_name.'" value="files" />
|
11 |
+
<span>'.__( 'WordPress Files (Exclude Database)', 'wpvivid' ).'</span>
|
12 |
</label><br>
|
13 |
<label>
|
14 |
<input type="radio" option="backup" name="'.$type_name.'" value="db" />
|
15 |
<span>'.__( 'Only Database', 'wpvivid' ).'</span>
|
16 |
+
</label><br>
|
17 |
+
<label>
|
18 |
+
<input type="radio" disabled />
|
19 |
+
<a href="https://wpvivid.com/backup-migration-overview?utm_source=client_custom_backup&utm_medium=inner_link&utm_campaign=access">'.__('Custom Backup', 'wpvivid').'</a>
|
20 |
</label><br>';
|
21 |
return $html;
|
22 |
}
|
44 |
$percent=$value['data']['progress'];
|
45 |
?>
|
46 |
jQuery('#wpvivid_postbox_backup_percent').show();
|
47 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
48 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
49 |
jQuery('#wpvivid_action_progress_bar_percent').css('width', <?php echo $percent; ?>+'%');
|
50 |
jQuery('#wpvivid_backup_database_size').html('<?php echo $value['size']['db_size']; ?>');
|
51 |
jQuery('#wpvivid_backup_file_size').html('<?php echo $value['size']['files_size']['sum']; ?>');
|
282 |
});
|
283 |
}
|
284 |
|
285 |
+
function wpvivid_read_log(action, param){
|
286 |
+
var tab_id = '';
|
287 |
+
var content_id = '';
|
288 |
+
var ajax_data = '';
|
289 |
+
var show_page = '';
|
290 |
+
if(typeof param === 'undefined') param = '';
|
291 |
+
switch(action){
|
292 |
+
case 'wpvivid_view_backup_task_log':
|
293 |
+
ajax_data = {
|
294 |
+
'action':action,
|
295 |
+
'id':running_backup_taskid
|
296 |
+
};
|
297 |
+
tab_id = 'wpvivid_tab_backup_log';
|
298 |
+
content_id = 'wpvivid_display_log_content';
|
299 |
+
show_page = 'backup_page';
|
300 |
+
break;
|
301 |
+
case 'wpvivid_read_last_backup_log':
|
302 |
+
var ajax_data = {
|
303 |
+
'action': action,
|
304 |
+
'log_file_name': param
|
305 |
+
};
|
306 |
+
tab_id = 'wpvivid_tab_backup_log';
|
307 |
+
content_id = 'wpvivid_display_log_content';
|
308 |
+
show_page = 'backup_page';
|
309 |
+
break;
|
310 |
+
case 'wpvivid_view_backup_log':
|
311 |
+
var ajax_data={
|
312 |
+
'action':action,
|
313 |
+
'id':param
|
314 |
+
};
|
315 |
+
tab_id = 'wpvivid_tab_backup_log';
|
316 |
+
content_id = 'wpvivid_display_log_content';
|
317 |
+
show_page = 'backup_page';
|
318 |
+
break;
|
319 |
+
case 'wpvivid_view_log':
|
320 |
+
var ajax_data={
|
321 |
+
'action':action,
|
322 |
+
'path':param
|
323 |
+
};
|
324 |
+
tab_id = 'wpvivid_tab_read_log';
|
325 |
+
content_id = 'wpvivid_read_log_content';
|
326 |
+
show_page = 'log_page';
|
327 |
+
break;
|
328 |
+
default:
|
329 |
+
break;
|
330 |
+
}
|
331 |
+
jQuery('#'+tab_id).show();
|
332 |
+
jQuery('#'+content_id).html("");
|
333 |
+
if(show_page === 'backup_page'){
|
334 |
+
//wpvivid_click_switch_backup_page(tab_id);
|
335 |
+
wpvivid_click_switch_page('backup', tab_id, true);
|
336 |
+
}
|
337 |
+
else if(show_page === 'log_page') {
|
338 |
+
wpvivid_click_switch_page('wrap', tab_id, true);
|
339 |
+
}
|
340 |
+
wpvivid_post_request(ajax_data, function(data){
|
341 |
+
wpvivid_show_log(data, content_id);
|
342 |
+
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
343 |
+
var div = 'Reading the log failed. Please try again.';
|
344 |
+
jQuery('#wpvivid_display_log_content').html(div);
|
345 |
+
});
|
346 |
+
}
|
347 |
+
|
348 |
function wpvivid_initialize_download(backup_id, list_name){
|
349 |
wpvivid_reset_backup_list(list_name);
|
350 |
jQuery('#wpvivid_download_loading_'+backup_id).addClass('is-active');
|
admin/partials/wpvivid-remote-storage-page-display.php
CHANGED
@@ -82,7 +82,7 @@ function wpvivid_add_page_storage_list()
|
|
82 |
'remote': remote_from,
|
83 |
'type': storage_type
|
84 |
};
|
85 |
-
jQuery('input[option=add-remote]').css({'pointer-events': '
|
86 |
jQuery('#wpvivid_remote_notice').html('');
|
87 |
wpvivid_post_request(ajax_data, function (data)
|
88 |
{
|
@@ -265,6 +265,8 @@ function wpvivid_add_page_storage_list()
|
|
265 |
{
|
266 |
jQuery('input:text[option=edit-'+jsonarray.type+']').each(function(){
|
267 |
var key = jQuery(this).prop('name');
|
|
|
|
|
268 |
if(key == 's3Path' && jsonarray.type == 'amazons3'){
|
269 |
var iLength = jsonarray[key].lastIndexOf('/wpvivid_backup');
|
270 |
if(iLength != -1) {
|
@@ -274,7 +276,7 @@ function wpvivid_add_page_storage_list()
|
|
274 |
}
|
275 |
else {
|
276 |
jQuery(this).val(jsonarray[key]);
|
277 |
-
}
|
278 |
});
|
279 |
jQuery('input:password[option=edit-'+jsonarray.type+']').each(function(){
|
280 |
var key = jQuery(this).prop('name');
|
@@ -291,7 +293,7 @@ function wpvivid_add_page_storage_list()
|
|
291 |
}
|
292 |
jQuery(this).prop('checked', value);
|
293 |
});
|
294 |
-
if(jsonarray.type == 'amazons3'){
|
295 |
var amazons3_edit_value = jQuery('input:text[option=edit-'+jsonarray.type+'][name=s3Path]').val();
|
296 |
if(amazons3_edit_value == ''){
|
297 |
amazons3_edit_value = '*';
|
@@ -306,7 +308,7 @@ function wpvivid_add_page_storage_list()
|
|
306 |
}
|
307 |
dos_edit_value = dos_edit_value + '/wpvivid_backup';
|
308 |
jQuery('#wpvivid_edit_dos_root_path').html(dos_edit_value);
|
309 |
-
}
|
310 |
}
|
311 |
else
|
312 |
{
|
82 |
'remote': remote_from,
|
83 |
'type': storage_type
|
84 |
};
|
85 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'none', 'opacity': '0.4'});
|
86 |
jQuery('#wpvivid_remote_notice').html('');
|
87 |
wpvivid_post_request(ajax_data, function (data)
|
88 |
{
|
265 |
{
|
266 |
jQuery('input:text[option=edit-'+jsonarray.type+']').each(function(){
|
267 |
var key = jQuery(this).prop('name');
|
268 |
+
jQuery(this).val(jsonarray[key]);
|
269 |
+
/*var key = jQuery(this).prop('name');
|
270 |
if(key == 's3Path' && jsonarray.type == 'amazons3'){
|
271 |
var iLength = jsonarray[key].lastIndexOf('/wpvivid_backup');
|
272 |
if(iLength != -1) {
|
276 |
}
|
277 |
else {
|
278 |
jQuery(this).val(jsonarray[key]);
|
279 |
+
}*/
|
280 |
});
|
281 |
jQuery('input:password[option=edit-'+jsonarray.type+']').each(function(){
|
282 |
var key = jQuery(this).prop('name');
|
293 |
}
|
294 |
jQuery(this).prop('checked', value);
|
295 |
});
|
296 |
+
/*if(jsonarray.type == 'amazons3'){
|
297 |
var amazons3_edit_value = jQuery('input:text[option=edit-'+jsonarray.type+'][name=s3Path]').val();
|
298 |
if(amazons3_edit_value == ''){
|
299 |
amazons3_edit_value = '*';
|
308 |
}
|
309 |
dos_edit_value = dos_edit_value + '/wpvivid_backup';
|
310 |
jQuery('#wpvivid_edit_dos_root_path').html(dos_edit_value);
|
311 |
+
}*/
|
312 |
}
|
313 |
else
|
314 |
{
|
admin/partials/wpvivid-schedule-page-display.php
CHANGED
@@ -12,7 +12,7 @@ function wpvivid_schedule_settings()
|
|
12 |
<div class="postbox schedule-tab-block">
|
13 |
<label for="wpvivid_schedule_enable">
|
14 |
<input option="schedule" name="enable" type="checkbox" id="wpvivid_schedule_enable" />
|
15 |
-
<span><?php _e( 'Enable backup schedule', 'wpvivid' ); ?></span>
|
16 |
</label>
|
17 |
<div>
|
18 |
<?php
|
@@ -65,7 +65,11 @@ function wpvivid_schedule_settings()
|
|
65 |
?>
|
66 |
</div>
|
67 |
</div>
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
</div>
|
70 |
</td>
|
71 |
</tr>
|
@@ -88,12 +92,12 @@ function wpvivid_schedule_backup_type($html)
|
|
88 |
{
|
89 |
$html='<label>';
|
90 |
$html.='<input type="radio" option="schedule" name="backup_type" value="files+db"/>';
|
91 |
-
$html.='<span>Database + Files (
|
92 |
$html.='</label><br>';
|
93 |
|
94 |
$html.='<label>';
|
95 |
$html.='<input type="radio" option="schedule" name="backup_type" value="files"/>';
|
96 |
-
$html.='<span>
|
97 |
$html.='</label><br>';
|
98 |
|
99 |
$html.='<label>';
|
@@ -101,6 +105,10 @@ function wpvivid_schedule_backup_type($html)
|
|
101 |
$html.='<span>Only Database</span>';
|
102 |
$html.='</label><br>';
|
103 |
|
|
|
|
|
|
|
|
|
104 |
return $html;
|
105 |
}
|
106 |
|
12 |
<div class="postbox schedule-tab-block">
|
13 |
<label for="wpvivid_schedule_enable">
|
14 |
<input option="schedule" name="enable" type="checkbox" id="wpvivid_schedule_enable" />
|
15 |
+
<span><?php _e( 'Enable backup schedule', 'wpvivid' ); ?></span><a href="https://wpvivid.com/wpvivid-backup-pro-schedule-overview?utm_source=client_advanced_schedule&utm_medium=inner_link&utm_campaign=access">Advanced Schedule</a>
|
16 |
</label>
|
17 |
<div>
|
18 |
<?php
|
65 |
?>
|
66 |
</div>
|
67 |
</div>
|
68 |
+
<div class="postbox schedule-tab-block">
|
69 |
+
<div>
|
70 |
+
<a href="https://wpvivid.com/wpvivid-backup-pro-creating-schedules?utm_source=client_multi_schedule&utm_medium=inner_link&utm_campaign=access">+ Add another schedule</a>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
</div>
|
74 |
</td>
|
75 |
</tr>
|
92 |
{
|
93 |
$html='<label>';
|
94 |
$html.='<input type="radio" option="schedule" name="backup_type" value="files+db"/>';
|
95 |
+
$html.='<span>Database + Files (WordPress Files)</span>';
|
96 |
$html.='</label><br>';
|
97 |
|
98 |
$html.='<label>';
|
99 |
$html.='<input type="radio" option="schedule" name="backup_type" value="files"/>';
|
100 |
+
$html.='<span>WordPress Files (Exclude Database)</span>';
|
101 |
$html.='</label><br>';
|
102 |
|
103 |
$html.='<label>';
|
105 |
$html.='<span>Only Database</span>';
|
106 |
$html.='</label><br>';
|
107 |
|
108 |
+
$html.='<label>';
|
109 |
+
$html.='<input type="radio" disabled />';
|
110 |
+
$html.='<a href="https://wpvivid.com/wpvivid-backup-pro-customize-what-to-backup-for-schedule?utm_source=client_schedule_custom_backup&utm_medium=inner_link&utm_campaign=access">Custom Backup</a>';
|
111 |
+
|
112 |
return $html;
|
113 |
}
|
114 |
|
admin/partials/wpvivid-settings-page-display.php
CHANGED
@@ -43,6 +43,18 @@ function wpvivid_general_settings()
|
|
43 |
$wpvivid_domain_include = '';
|
44 |
}
|
45 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
global $wpvivid_plugin;
|
47 |
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
|
48 |
?>
|
@@ -59,12 +71,12 @@ function wpvivid_general_settings()
|
|
59 |
}
|
60 |
}
|
61 |
?>
|
62 |
-
</select><strong><?php _e('backups retained', 'wpvivid'); ?></strong>
|
63 |
</div>
|
64 |
<div>
|
65 |
<label for="wpvivid_estimate_backup">
|
66 |
<input type="checkbox" option="setting" name="estimate_backup" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup, 'wpvivid'); ?> />
|
67 |
-
<span><?php _e(
|
68 |
</label>
|
69 |
</div>
|
70 |
<div>
|
@@ -79,11 +91,17 @@ function wpvivid_general_settings()
|
|
79 |
<span><?php _e('Show WPvivid backup plugin on top admin bar', 'wpvivid'); ?></span>
|
80 |
</label>
|
81 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
</div>
|
83 |
<div class="postbox schedule-tab-block">
|
84 |
<div><strong><?php _e('Backup Folder', 'wpvivid'); ?></strong></div>
|
85 |
<div class="setting-tab-block">
|
86 |
-
<div><p><?php _e(
|
87 |
<input type="text" placeholder="wpvividbackups" option="setting" name="path" id="wpvivid_option_backup_dir" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?>" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" onpaste="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" />
|
88 |
<p><span><?php _e('Local storage directory:', 'wpvivid'); ?></span><span><?php echo WP_CONTENT_DIR.'/'; ?><span id="wpvivid_setting_local_storage_path"><?php _e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?></span></span></p>
|
89 |
</div>
|
@@ -96,11 +114,11 @@ function wpvivid_general_settings()
|
|
96 |
</div>
|
97 |
<div class="postbox schedule-tab-block">
|
98 |
<div><strong><?php _e('Remove out-of-date backups', 'wpvivid'); ?></strong></div>
|
99 |
-
<div class="setting-tab-block">
|
100 |
<fieldset>
|
101 |
<label for="users_can_register">
|
102 |
<p><span><?php _e('Web Server Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_local_path"><?php _e($out_of_date['web_server'], 'wpvivid'); ?></span></p>
|
103 |
-
<p><span><?php _e('Remote Storage Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path">
|
104 |
<?php
|
105 |
$wpvivid_get_remote_directory = '';
|
106 |
$wpvivid_get_remote_directory = apply_filters('wpvivid_get_remote_directory', $wpvivid_get_remote_directory);
|
@@ -165,7 +183,7 @@ function wpvivid_email_report()
|
|
165 |
}
|
166 |
$wpvivid_setting_email_always='';
|
167 |
$wpvivid_setting_email_failed='';
|
168 |
-
if($general_setting['options']['wpvivid_email_setting']['always']) {
|
169 |
$wpvivid_setting_email_always='checked';
|
170 |
}
|
171 |
else{
|
@@ -183,9 +201,13 @@ function wpvivid_email_report()
|
|
183 |
</div>
|
184 |
<div id="wpvivid_general_email_setting" style="<?php esc_attr_e($setting_email_display, 'wpvivid'); ?>" >
|
185 |
<input type="text" placeholder="example@yourdomain.com" option="setting" name="send_to" class="regular-text" id="wpvivid_mail" value="<?php
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
189 |
}
|
190 |
?>" />
|
191 |
<input class="button-secondary" id="wpvivid_send_email_test" style="margin-top:10px;" type="submit" name="" value="<?php esc_attr_e( 'Test Email', 'wpvivid' ); ?>" title="Send an email for testing mail function"/>
|
@@ -198,8 +220,11 @@ function wpvivid_email_report()
|
|
198 |
<label >
|
199 |
<input type="radio" option="setting" name="always" value="0" <?php esc_attr_e($wpvivid_setting_email_failed, 'wpvivid'); ?> />
|
200 |
<span><?php _e( 'Only send an email notification when a backup fails', 'wpvivid' ); ?></span>
|
201 |
-
</label>
|
202 |
</fieldset>
|
|
|
|
|
|
|
203 |
</div>
|
204 |
</div>
|
205 |
<script>
|
@@ -515,7 +540,6 @@ function wpvivid_advanced_settings()
|
|
515 |
<input type="radio" option="setting" name="use_temp_size" value="16" checked />
|
516 |
</label>
|
517 |
</fieldset>
|
518 |
-
|
519 |
<div style="padding-top: 10px;">
|
520 |
<div><strong><?php _e('Compress Files Every', 'wpvivid'); ?></strong></div>
|
521 |
<div class="setting-tab-block">
|
43 |
$wpvivid_domain_include = '';
|
44 |
}
|
45 |
}
|
46 |
+
if(!isset($general_setting['options']['wpvivid_common_setting']['ismerge'])){
|
47 |
+
$wpvivid_ismerge = 'checked';
|
48 |
+
}
|
49 |
+
else{
|
50 |
+
if($general_setting['options']['wpvivid_common_setting']['ismerge'] == '1'){
|
51 |
+
$wpvivid_ismerge = 'checked';
|
52 |
+
}
|
53 |
+
else{
|
54 |
+
$wpvivid_ismerge = '';
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
global $wpvivid_plugin;
|
59 |
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
|
60 |
?>
|
71 |
}
|
72 |
}
|
73 |
?>
|
74 |
+
</select><strong style="margin-right: 10px;"><?php _e('backups retained', 'wpvivid'); ?></strong><a href="https://wpvivid.com/pro-version-beta-testing?utm_source=client_backups_retained&utm_medium=inner_link&utm_campaign=access">(I need to retain more backups)</a>
|
75 |
</div>
|
76 |
<div>
|
77 |
<label for="wpvivid_estimate_backup">
|
78 |
<input type="checkbox" option="setting" name="estimate_backup" id="wpvivid_estimate_backup" value="1" <?php esc_attr_e($wpvivid_setting_estimate_backup, 'wpvivid'); ?> />
|
79 |
+
<span><?php _e('Calculate the size of files, folder and database before backing up ', 'wpvivid' ); ?></span>
|
80 |
</label>
|
81 |
</div>
|
82 |
<div>
|
91 |
<span><?php _e('Show WPvivid backup plugin on top admin bar', 'wpvivid'); ?></span>
|
92 |
</label>
|
93 |
</div>
|
94 |
+
<div>
|
95 |
+
<label>
|
96 |
+
<input type="checkbox" option="setting" name="ismerge" <?php esc_attr_e($wpvivid_ismerge); ?> />
|
97 |
+
<span><?php _e('Merge all the backup files into single package when a backup completes. This will save great disk spaces, though takes longer time. We recommended you check the option especially on sites with insufficient server resources.', 'wpvivid'); ?></span>
|
98 |
+
</label>
|
99 |
+
</div>
|
100 |
</div>
|
101 |
<div class="postbox schedule-tab-block">
|
102 |
<div><strong><?php _e('Backup Folder', 'wpvivid'); ?></strong></div>
|
103 |
<div class="setting-tab-block">
|
104 |
+
<div><p><?php _e('Name your folder, this folder must be writable for creating backup files.', 'wpvivid' ); ?><p> </div>
|
105 |
<input type="text" placeholder="wpvividbackups" option="setting" name="path" id="wpvivid_option_backup_dir" class="all-options" value="<?php esc_attr_e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?>" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" onpaste="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" />
|
106 |
<p><span><?php _e('Local storage directory:', 'wpvivid'); ?></span><span><?php echo WP_CONTENT_DIR.'/'; ?><span id="wpvivid_setting_local_storage_path"><?php _e($general_setting['options']['wpvivid_local_setting']['path'], 'wpvivid'); ?></span></span></p>
|
107 |
</div>
|
114 |
</div>
|
115 |
<div class="postbox schedule-tab-block">
|
116 |
<div><strong><?php _e('Remove out-of-date backups', 'wpvivid'); ?></strong></div>
|
117 |
+
<div class="setting-tab-block" style="padding-bottom: 0;">
|
118 |
<fieldset>
|
119 |
<label for="users_can_register">
|
120 |
<p><span><?php _e('Web Server Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_local_path"><?php _e($out_of_date['web_server'], 'wpvivid'); ?></span></p>
|
121 |
+
<p><span style="margin-right: 2px;"><?php _e('Remote Storage Directory:', 'wpvivid'); ?></span><span id="wpvivid_out_of_date_remote_path">
|
122 |
<?php
|
123 |
$wpvivid_get_remote_directory = '';
|
124 |
$wpvivid_get_remote_directory = apply_filters('wpvivid_get_remote_directory', $wpvivid_get_remote_directory);
|
183 |
}
|
184 |
$wpvivid_setting_email_always='';
|
185 |
$wpvivid_setting_email_failed='';
|
186 |
+
if(isset($general_setting['options']['wpvivid_email_setting']['always'])&&$general_setting['options']['wpvivid_email_setting']['always']) {
|
187 |
$wpvivid_setting_email_always='checked';
|
188 |
}
|
189 |
else{
|
201 |
</div>
|
202 |
<div id="wpvivid_general_email_setting" style="<?php esc_attr_e($setting_email_display, 'wpvivid'); ?>" >
|
203 |
<input type="text" placeholder="example@yourdomain.com" option="setting" name="send_to" class="regular-text" id="wpvivid_mail" value="<?php
|
204 |
+
if(!empty($general_setting['options']['wpvivid_email_setting']['send_to'])) {
|
205 |
+
foreach ($general_setting['options']['wpvivid_email_setting']['send_to'] as $mail) {
|
206 |
+
if(!empty($mail)) {
|
207 |
+
_e($mail, 'wpvivid');
|
208 |
+
break;
|
209 |
+
}
|
210 |
+
}
|
211 |
}
|
212 |
?>" />
|
213 |
<input class="button-secondary" id="wpvivid_send_email_test" style="margin-top:10px;" type="submit" name="" value="<?php esc_attr_e( 'Test Email', 'wpvivid' ); ?>" title="Send an email for testing mail function"/>
|
220 |
<label >
|
221 |
<input type="radio" option="setting" name="always" value="0" <?php esc_attr_e($wpvivid_setting_email_failed, 'wpvivid'); ?> />
|
222 |
<span><?php _e( 'Only send an email notification when a backup fails', 'wpvivid' ); ?></span>
|
223 |
+
</label><br>
|
224 |
</fieldset>
|
225 |
+
<div style="margin-bottom: 10px;">
|
226 |
+
<a href="https://wpvivid.com/wpvivid-backup-pro-email-report?utm_source=client_email_report&utm_medium=inner_link&utm_campaign=access">+ Add another email address to get report</a>
|
227 |
+
</div>
|
228 |
</div>
|
229 |
</div>
|
230 |
<script>
|
540 |
<input type="radio" option="setting" name="use_temp_size" value="16" checked />
|
541 |
</label>
|
542 |
</fieldset>
|
|
|
543 |
<div style="padding-top: 10px;">
|
544 |
<div><strong><?php _e('Compress Files Every', 'wpvivid'); ?></strong></div>
|
545 |
<div class="setting-tab-block">
|
includes/class-wpvivid-backup-uploader.php
CHANGED
@@ -216,7 +216,6 @@ class Wpvivid_BackupUploader
|
|
216 |
$wpvivid_plugin->wpvivid_log->CreateLogFile($id.'_upload','no_folder','upload');
|
217 |
$wpvivid_plugin->wpvivid_log->WriteLogHander();
|
218 |
$wpvivid_plugin->wpvivid_log->WriteLog('Upload finished.','notice');
|
219 |
-
file_put_contents('D:\test1.txt', 'id->'.$id);
|
220 |
WPvivid_Backuplist::add_new_upload_backup($id,$backup_data,$time,$wpvivid_plugin->wpvivid_log->log_file);
|
221 |
$html = '';
|
222 |
$html = apply_filters('wpvivid_add_backup_list', $html);
|
216 |
$wpvivid_plugin->wpvivid_log->CreateLogFile($id.'_upload','no_folder','upload');
|
217 |
$wpvivid_plugin->wpvivid_log->WriteLogHander();
|
218 |
$wpvivid_plugin->wpvivid_log->WriteLog('Upload finished.','notice');
|
|
|
219 |
WPvivid_Backuplist::add_new_upload_backup($id,$backup_data,$time,$wpvivid_plugin->wpvivid_log->log_file);
|
220 |
$html = '';
|
221 |
$html = apply_filters('wpvivid_add_backup_list', $html);
|
includes/class-wpvivid-backup.php
CHANGED
@@ -121,43 +121,51 @@ class WPvivid_Backup_Task
|
|
121 |
$this->task['options']['lock']=0;
|
122 |
}
|
123 |
|
124 |
-
$
|
125 |
|
126 |
-
|
127 |
-
if(isset($options['ismerge']))
|
128 |
{
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
{
|
131 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
-
else
|
134 |
-
|
|
|
135 |
}
|
136 |
}
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
$home_url_prefix=$this->parse_url_all($home_url_prefix);
|
143 |
-
|
144 |
-
$general_setting=WPvivid_Setting::get_setting(true, "");
|
145 |
|
146 |
-
if(
|
147 |
{
|
148 |
-
$
|
149 |
-
}
|
150 |
-
else{
|
151 |
-
if($general_setting['options']['wpvivid_common_setting']['domain_include'])
|
152 |
{
|
153 |
-
$this->task['options']['
|
154 |
}
|
155 |
-
else{
|
156 |
-
$this->task['options']['
|
157 |
}
|
158 |
}
|
159 |
-
|
160 |
-
|
|
|
161 |
|
162 |
$this->task['options']['log_file_name']=$id.'_backup';
|
163 |
$log=new WPvivid_Log();
|
@@ -294,6 +302,7 @@ class WPvivid_Backup_Task
|
|
294 |
|
295 |
$exclude_plugins[]='wpvivid-backuprestore';
|
296 |
$exclude_plugins[]='wp-cerber';
|
|
|
297 |
$exclude_plugins=apply_filters('wpvivid_exclude_plugins',$exclude_plugins);
|
298 |
$exclude_regex=array();
|
299 |
foreach ($exclude_plugins as $exclude_plugin)
|
@@ -932,6 +941,7 @@ class WPvivid_Backup_Task
|
|
932 |
}
|
933 |
else
|
934 |
{
|
|
|
935 |
$backup_files =apply_filters('wpvivid_get_custom_need_backup_files', $backup_data['files'],$backup_data,$this->task['options']['backup_options']['compress']);
|
936 |
}
|
937 |
$files=array_merge($backup_files,$files);
|
@@ -1374,6 +1384,10 @@ class WPvivid_Backup_Task
|
|
1374 |
$backup_data['local']['path']=$backup_options['dir'];
|
1375 |
$backup_data['compress']['compress_type']=$backup_options['compress']['compress_type'];
|
1376 |
$backup_data['save_local']=$this->task['options']['save_local'];
|
|
|
|
|
|
|
|
|
1377 |
|
1378 |
global $wpvivid_plugin;
|
1379 |
$backup_data['log']=$wpvivid_plugin->wpvivid_log->log_file;
|
@@ -1684,6 +1698,7 @@ class WPvivid_Backup_Item
|
|
1684 |
|
1685 |
if(isset($this->config['backup']['files']))
|
1686 |
{
|
|
|
1687 |
$file_added=array();
|
1688 |
//file_name
|
1689 |
foreach ($this->config['backup']['files'] as $file)
|
@@ -1693,13 +1708,20 @@ class WPvivid_Backup_Item
|
|
1693 |
continue;
|
1694 |
}
|
1695 |
|
1696 |
-
if(
|
1697 |
{
|
1698 |
$this->get_all_part_files($file['file_name'],$this->config['backup']['files'],$packages[$index],$file_added);
|
1699 |
}
|
1700 |
else
|
1701 |
{
|
1702 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1703 |
$file_added[$file['file_name']]=1;
|
1704 |
}
|
1705 |
$index++;
|
@@ -1707,7 +1729,7 @@ class WPvivid_Backup_Item
|
|
1707 |
|
1708 |
$file_added=array();
|
1709 |
$child_packages=array();
|
1710 |
-
foreach ($packages as $package)
|
1711 |
{
|
1712 |
$files=array();
|
1713 |
|
@@ -1723,18 +1745,25 @@ class WPvivid_Backup_Item
|
|
1723 |
|
1724 |
foreach ($files as $file)
|
1725 |
{
|
1726 |
-
if(isset($file_added[$file['file_name']]))
|
1727 |
{
|
1728 |
continue;
|
1729 |
}
|
1730 |
|
1731 |
-
if(
|
1732 |
{
|
1733 |
$this->get_all_part_files($file['file_name'],$files,$child_packages[$index],$file_added);
|
1734 |
}
|
1735 |
else
|
1736 |
{
|
1737 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1738 |
$file_added[$file['file_name']]=1;
|
1739 |
}
|
1740 |
$index++;
|
@@ -1742,6 +1771,10 @@ class WPvivid_Backup_Item
|
|
1742 |
}
|
1743 |
|
1744 |
$packages=array_merge($packages,$child_packages);
|
|
|
|
|
|
|
|
|
1745 |
}
|
1746 |
else if(isset($this->config['backup']['data']))
|
1747 |
{
|
@@ -1800,27 +1833,40 @@ class WPvivid_Backup_Item
|
|
1800 |
$index++;
|
1801 |
}
|
1802 |
}
|
1803 |
-
|
1804 |
return $packages;
|
1805 |
}
|
1806 |
|
1807 |
-
public function
|
1808 |
{
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1812 |
|
1813 |
-
|
|
|
|
|
1814 |
{
|
1815 |
-
|
|
|
|
|
1816 |
{
|
1817 |
-
|
1818 |
-
|
|
|
|
|
1819 |
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
|
|
1824 |
}
|
1825 |
}
|
1826 |
}
|
@@ -2283,6 +2329,10 @@ class WPvivid_Backup
|
|
2283 |
}
|
2284 |
}
|
2285 |
@closedir($handler);
|
|
|
|
|
|
|
|
|
2286 |
WPvivid_tools::clearcache($this->task->get_prefix());
|
2287 |
}
|
2288 |
|
121 |
$this->task['options']['lock']=0;
|
122 |
}
|
123 |
|
124 |
+
$general_setting=WPvivid_Setting::get_setting(true, "");
|
125 |
|
126 |
+
if(isset($options['backup_prefix']) && !empty($options['backup_prefix']))
|
|
|
127 |
{
|
128 |
+
$backup_prefix=$options['backup_prefix'];
|
129 |
+
}
|
130 |
+
else
|
131 |
+
{
|
132 |
+
if(isset($general_setting['options']['wpvivid_common_setting']['domain_include'])&&$general_setting['options']['wpvivid_common_setting']['domain_include'])
|
133 |
{
|
134 |
+
$check_addon = apply_filters('wpvivid_check_setting_addon', 'not_addon');
|
135 |
+
if (isset($general_setting['options']['wpvivid_common_setting']['backup_prefix']) && $check_addon == 'addon')
|
136 |
+
{
|
137 |
+
$backup_prefix = $general_setting['options']['wpvivid_common_setting']['backup_prefix'];
|
138 |
+
}
|
139 |
+
else {
|
140 |
+
$home_url_prefix = get_home_url();
|
141 |
+
$home_url_prefix = $this->parse_url_all($home_url_prefix);
|
142 |
+
$backup_prefix = $home_url_prefix;
|
143 |
+
}
|
144 |
}
|
145 |
+
else
|
146 |
+
{
|
147 |
+
$backup_prefix='';
|
148 |
}
|
149 |
}
|
150 |
+
$this->task['options']['backup_prefix']=$backup_prefix;
|
151 |
+
if(empty($backup_prefix))
|
152 |
+
$this->task['options']['file_prefix'] = $this->task['id'] . '_' . date('Y-m-d-H-i', $this->task['status']['start_time']);
|
153 |
+
else
|
154 |
+
$this->task['options']['file_prefix'] = $backup_prefix . '_' . $this->task['id'] . '_' . date('Y-m-d-H-i', $this->task['status']['start_time']);
|
|
|
|
|
|
|
155 |
|
156 |
+
if(isset($general_setting['options']['wpvivid_common_setting']['ismerge']))
|
157 |
{
|
158 |
+
if($general_setting['options']['wpvivid_common_setting']['ismerge']==1)
|
|
|
|
|
|
|
159 |
{
|
160 |
+
$this->task['options']['backup_options']['ismerge']=1;
|
161 |
}
|
162 |
+
else {
|
163 |
+
$this->task['options']['backup_options']['ismerge']=0;
|
164 |
}
|
165 |
}
|
166 |
+
else {
|
167 |
+
$this->task['options']['backup_options']['ismerge']=1;
|
168 |
+
}
|
169 |
|
170 |
$this->task['options']['log_file_name']=$id.'_backup';
|
171 |
$log=new WPvivid_Log();
|
302 |
|
303 |
$exclude_plugins[]='wpvivid-backuprestore';
|
304 |
$exclude_plugins[]='wp-cerber';
|
305 |
+
$exclude_plugins[]='.';
|
306 |
$exclude_plugins=apply_filters('wpvivid_exclude_plugins',$exclude_plugins);
|
307 |
$exclude_regex=array();
|
308 |
foreach ($exclude_plugins as $exclude_plugin)
|
941 |
}
|
942 |
else
|
943 |
{
|
944 |
+
$backup_data['files']=array();
|
945 |
$backup_files =apply_filters('wpvivid_get_custom_need_backup_files', $backup_data['files'],$backup_data,$this->task['options']['backup_options']['compress']);
|
946 |
}
|
947 |
$files=array_merge($backup_files,$files);
|
1384 |
$backup_data['local']['path']=$backup_options['dir'];
|
1385 |
$backup_data['compress']['compress_type']=$backup_options['compress']['compress_type'];
|
1386 |
$backup_data['save_local']=$this->task['options']['save_local'];
|
1387 |
+
if(isset($this->task['options']['backup_prefix']))
|
1388 |
+
{
|
1389 |
+
$backup_data['backup_prefix'] = $this->task['options']['backup_prefix'];
|
1390 |
+
}
|
1391 |
|
1392 |
global $wpvivid_plugin;
|
1393 |
$backup_data['log']=$wpvivid_plugin->wpvivid_log->log_file;
|
1698 |
|
1699 |
if(isset($this->config['backup']['files']))
|
1700 |
{
|
1701 |
+
$db_package=array();
|
1702 |
$file_added=array();
|
1703 |
//file_name
|
1704 |
foreach ($this->config['backup']['files'] as $file)
|
1708 |
continue;
|
1709 |
}
|
1710 |
|
1711 |
+
if (preg_match('/wpvivid-.*_.*_.*\.part[0-9]+\.zip$/', $file['file_name'],$matches))
|
1712 |
{
|
1713 |
$this->get_all_part_files($file['file_name'],$this->config['backup']['files'],$packages[$index],$file_added);
|
1714 |
}
|
1715 |
else
|
1716 |
{
|
1717 |
+
if($this->check_file_is_a_db_package($file['file_name']))
|
1718 |
+
{
|
1719 |
+
$db_package['files'][]=$file['file_name'];
|
1720 |
+
}
|
1721 |
+
else
|
1722 |
+
{
|
1723 |
+
$packages[$index]['files'][]=$file['file_name'];
|
1724 |
+
}
|
1725 |
$file_added[$file['file_name']]=1;
|
1726 |
}
|
1727 |
$index++;
|
1729 |
|
1730 |
$file_added=array();
|
1731 |
$child_packages=array();
|
1732 |
+
foreach ($packages as $key=>$package)
|
1733 |
{
|
1734 |
$files=array();
|
1735 |
|
1745 |
|
1746 |
foreach ($files as $file)
|
1747 |
{
|
1748 |
+
if (isset($file_added[$file['file_name']]))
|
1749 |
{
|
1750 |
continue;
|
1751 |
}
|
1752 |
|
1753 |
+
if (preg_match('/wpvivid-.*_.*_.*\.part[0-9]+\.zip$/', $file['file_name'],$matches))
|
1754 |
{
|
1755 |
$this->get_all_part_files($file['file_name'],$files,$child_packages[$index],$file_added);
|
1756 |
}
|
1757 |
else
|
1758 |
{
|
1759 |
+
if($this->check_file_is_a_db_package($file['file_name']))
|
1760 |
+
{
|
1761 |
+
$db_package['files'][]=$file['file_name'];
|
1762 |
+
}
|
1763 |
+
else
|
1764 |
+
{
|
1765 |
+
$child_packages[$index]['files'][]=$file['file_name'];
|
1766 |
+
}
|
1767 |
$file_added[$file['file_name']]=1;
|
1768 |
}
|
1769 |
$index++;
|
1771 |
}
|
1772 |
|
1773 |
$packages=array_merge($packages,$child_packages);
|
1774 |
+
if(!empty($db_package))
|
1775 |
+
{
|
1776 |
+
$packages[$index]=$db_package;
|
1777 |
+
}
|
1778 |
}
|
1779 |
else if(isset($this->config['backup']['data']))
|
1780 |
{
|
1833 |
$index++;
|
1834 |
}
|
1835 |
}
|
|
|
1836 |
return $packages;
|
1837 |
}
|
1838 |
|
1839 |
+
public function check_file_is_a_db_package($file_name)
|
1840 |
{
|
1841 |
+
//backup_db.zip
|
1842 |
+
if (preg_match('#.*_backup_db.zip?#', $file_name, $matches))
|
1843 |
+
{
|
1844 |
+
return true;
|
1845 |
+
}
|
1846 |
+
else
|
1847 |
+
{
|
1848 |
+
return false;
|
1849 |
+
}
|
1850 |
+
}
|
1851 |
|
1852 |
+
public function get_all_part_files($file_name,$files,&$package,&$file_added)
|
1853 |
+
{
|
1854 |
+
if (preg_match('#\.part[0-9]+\.zip$#',$file_name,$matches))
|
1855 |
{
|
1856 |
+
$prefix=$matches[0];
|
1857 |
+
$file_prefix=substr($file_name,0,strlen($file_name)-strlen($prefix));
|
1858 |
+
foreach ($files as $file)
|
1859 |
{
|
1860 |
+
if(isset($file_added[$file['file_name']]))
|
1861 |
+
{
|
1862 |
+
continue;
|
1863 |
+
}
|
1864 |
|
1865 |
+
if (strpos($file['file_name'], $file_prefix) !== false)
|
1866 |
+
{
|
1867 |
+
$package['files'][]=$file['file_name'];
|
1868 |
+
$file_added[$file['file_name']]=1;
|
1869 |
+
}
|
1870 |
}
|
1871 |
}
|
1872 |
}
|
2329 |
}
|
2330 |
}
|
2331 |
@closedir($handler);
|
2332 |
+
}
|
2333 |
+
|
2334 |
+
public function clearcache()
|
2335 |
+
{
|
2336 |
WPvivid_tools::clearcache($this->task->get_prefix());
|
2337 |
}
|
2338 |
|
includes/class-wpvivid-backuplist.php
CHANGED
@@ -212,13 +212,12 @@ class WPvivid_Backuplist
|
|
212 |
{
|
213 |
$ret['oldest_id']=$oldest_id;
|
214 |
}
|
215 |
-
return $ret;
|
216 |
}
|
217 |
else
|
218 |
{
|
219 |
$ret['result']='ok';
|
220 |
-
return $ret;
|
221 |
}
|
|
|
222 |
}
|
223 |
|
224 |
public static function get_out_of_date_backuplist($max_count)
|
212 |
{
|
213 |
$ret['oldest_id']=$oldest_id;
|
214 |
}
|
|
|
215 |
}
|
216 |
else
|
217 |
{
|
218 |
$ret['result']='ok';
|
|
|
219 |
}
|
220 |
+
return $ret;
|
221 |
}
|
222 |
|
223 |
public static function get_out_of_date_backuplist($max_count)
|
includes/class-wpvivid-mail-report.php
CHANGED
@@ -8,6 +8,8 @@ class WPvivid_mail_report
|
|
8 |
public static function send_report_mail($task,$log=false)
|
9 |
{
|
10 |
$option=WPvivid_Setting::get_option('wpvivid_email_setting');
|
|
|
|
|
11 |
if(empty($option))
|
12 |
{
|
13 |
return true;
|
@@ -29,7 +31,10 @@ class WPvivid_mail_report
|
|
29 |
|
30 |
$headers = array('Content-Type: text/html; charset=UTF-8');
|
31 |
$subject=self::create_subject($task);
|
|
|
|
|
32 |
$body=self::create_body($task);
|
|
|
33 |
|
34 |
$task_log=$task['options']['log_file_name'];
|
35 |
|
8 |
public static function send_report_mail($task,$log=false)
|
9 |
{
|
10 |
$option=WPvivid_Setting::get_option('wpvivid_email_setting');
|
11 |
+
|
12 |
+
$option=apply_filters('wpvivid_get_mail_option_addon', $option);
|
13 |
if(empty($option))
|
14 |
{
|
15 |
return true;
|
31 |
|
32 |
$headers = array('Content-Type: text/html; charset=UTF-8');
|
33 |
$subject=self::create_subject($task);
|
34 |
+
//$subject = apply_filters('wpvivid_set_mail_subject_addon', $subject, $option, $task);
|
35 |
+
|
36 |
$body=self::create_body($task);
|
37 |
+
//$body = apply_filters('wpvivid_set_mail_body_addon', $body, $option, $task);
|
38 |
|
39 |
$task_log=$task['options']['log_file_name'];
|
40 |
|
includes/class-wpvivid-migrate.php
CHANGED
@@ -317,8 +317,16 @@ class WPvivid_Migrate
|
|
317 |
|
318 |
jQuery(document).ready(function ()
|
319 |
{
|
|
|
|
|
|
|
|
|
|
|
320 |
wpvivid_activate_migrate_cron();
|
321 |
wpvivid_manage_upload_task();
|
|
|
|
|
|
|
322 |
});
|
323 |
</script>
|
324 |
<?php
|
@@ -1082,16 +1090,20 @@ class WPvivid_Migrate
|
|
1082 |
public function wpvivid_add_migrate_type($html, $name_type){
|
1083 |
$html .= '<label>
|
1084 |
<input type="radio" option="migrate" name="'.$name_type.'" value="files+db" checked />
|
1085 |
-
<span>'.__( 'Database + Files (
|
1086 |
</label><br>
|
1087 |
<label>
|
1088 |
<input type="radio" option="migrate" name="'.$name_type.'" value="files" />
|
1089 |
-
<span>'.__( '
|
1090 |
</label><br>
|
1091 |
<label>
|
1092 |
<input type="radio" option="migrate" name="'.$name_type.'" value="db" />
|
1093 |
<span>'.__( 'Only Database', 'wpvivid' ).'</span>
|
1094 |
-
</label><br>
|
|
|
|
|
|
|
|
|
1095 |
return $html;
|
1096 |
}
|
1097 |
|
317 |
|
318 |
jQuery(document).ready(function ()
|
319 |
{
|
320 |
+
<?php
|
321 |
+
$default_task_type = array();
|
322 |
+
$default_task_type = apply_filters('wpvivid_get_task_type', $default_task_type);
|
323 |
+
if(empty($default_task_type)){
|
324 |
+
?>
|
325 |
wpvivid_activate_migrate_cron();
|
326 |
wpvivid_manage_upload_task();
|
327 |
+
<?php
|
328 |
+
}
|
329 |
+
?>
|
330 |
});
|
331 |
</script>
|
332 |
<?php
|
1090 |
public function wpvivid_add_migrate_type($html, $name_type){
|
1091 |
$html .= '<label>
|
1092 |
<input type="radio" option="migrate" name="'.$name_type.'" value="files+db" checked />
|
1093 |
+
<span>'.__( 'Database + Files (WordPress Files)', 'wpvivid' ).'</span>
|
1094 |
</label><br>
|
1095 |
<label>
|
1096 |
<input type="radio" option="migrate" name="'.$name_type.'" value="files" />
|
1097 |
+
<span>'.__( 'WordPress Files (Exclude Database)', 'wpvivid' ).'</span>
|
1098 |
</label><br>
|
1099 |
<label>
|
1100 |
<input type="radio" option="migrate" name="'.$name_type.'" value="db" />
|
1101 |
<span>'.__( 'Only Database', 'wpvivid' ).'</span>
|
1102 |
+
</label><br>
|
1103 |
+
<label>
|
1104 |
+
<input type="radio" disabled />
|
1105 |
+
<a href="https://wpvivid.com/custom-migration-overview?utm_source=client_migration_custom_backup&utm_medium=inner_link&utm_campaign=access">Choose what to migrate</a>
|
1106 |
+
</label>';
|
1107 |
return $html;
|
1108 |
}
|
1109 |
|
includes/class-wpvivid-remote-collection.php
CHANGED
@@ -61,6 +61,7 @@ class WPvivid_Remote_collection
|
|
61 |
if($default==1)
|
62 |
{
|
63 |
$remote_ids[]=$id;
|
|
|
64 |
WPvivid_Setting::update_user_history('remote_selected',$remote_ids);
|
65 |
$schedule_data = WPvivid_Setting::get_option('wpvivid_schedule_setting');
|
66 |
if(!empty($schedule_data['enable'])) {
|
61 |
if($default==1)
|
62 |
{
|
63 |
$remote_ids[]=$id;
|
64 |
+
$remote_ids=apply_filters('wpvivid_before_add_user_history',$remote_ids);
|
65 |
WPvivid_Setting::update_user_history('remote_selected',$remote_ids);
|
66 |
$schedule_data = WPvivid_Setting::get_option('wpvivid_schedule_setting');
|
67 |
if(!empty($schedule_data['enable'])) {
|
includes/class-wpvivid-restore-data.php
CHANGED
@@ -132,6 +132,7 @@ class WPvivid_restore_data
|
|
132 |
|
133 |
foreach ($packages as $index=>$package)
|
134 |
{
|
|
|
135 |
$data['restore_tasks'][$index]['files']=$package['files'];
|
136 |
$data['restore_tasks'][$index]['unzip_files']=array();
|
137 |
$data['restore_tasks'][$index]['status']=WPVIVID_RESTORE_WAIT;
|
@@ -144,6 +145,17 @@ class WPvivid_restore_data
|
|
144 |
$data['restore_tasks'][$index]['option']=array_merge($restore_options, $data['restore_tasks'][$index]['option']);
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
WPvivid_tools::file_put_array($data,$this->restore_data_file);
|
148 |
$this->restore_cache=$data;
|
149 |
$rollback_data = require_once plugin_dir_path( dirname( __FILE__ ) ) .'includes/class-wpvivid-rollback-template.php';
|
132 |
|
133 |
foreach ($packages as $index=>$package)
|
134 |
{
|
135 |
+
$data['restore_tasks'][$index]['index']=$index;
|
136 |
$data['restore_tasks'][$index]['files']=$package['files'];
|
137 |
$data['restore_tasks'][$index]['unzip_files']=array();
|
138 |
$data['restore_tasks'][$index]['status']=WPVIVID_RESTORE_WAIT;
|
145 |
$data['restore_tasks'][$index]['option']=array_merge($restore_options, $data['restore_tasks'][$index]['option']);
|
146 |
}
|
147 |
|
148 |
+
usort($data['restore_tasks'], function ($a, $b)
|
149 |
+
{
|
150 |
+
if($a['index']==$b['index'])
|
151 |
+
return 0;
|
152 |
+
|
153 |
+
if($a['index']>$b['index'])
|
154 |
+
return 1;
|
155 |
+
else
|
156 |
+
return -1;
|
157 |
+
});
|
158 |
+
|
159 |
WPvivid_tools::file_put_array($data,$this->restore_data_file);
|
160 |
$this->restore_cache=$data;
|
161 |
$rollback_data = require_once plugin_dir_path( dirname( __FILE__ ) ) .'includes/class-wpvivid-rollback-template.php';
|
includes/class-wpvivid-restore-database.php
CHANGED
@@ -288,7 +288,8 @@ class WPvivid_RestoreDB
|
|
288 |
else
|
289 |
{
|
290 |
WPvivid_Setting::import_json_to_setting($this->current_setting);
|
291 |
-
|
|
|
292 |
}
|
293 |
|
294 |
fclose($sql_handle);
|
@@ -700,7 +701,8 @@ class WPvivid_RestoreDB
|
|
700 |
if(substr($table_name, strlen($this->new_prefix))=='options')
|
701 |
{
|
702 |
WPvivid_Setting::import_json_to_setting($this->current_setting);
|
703 |
-
WPvivid_Schedule::reset_schedule();
|
|
|
704 |
if($this->old_prefix!=$this->new_prefix)
|
705 |
{
|
706 |
$update_query ='UPDATE '.$table_name.' SET option_name="'.$this->new_prefix.'user_roles" WHERE option_name="'.$this->old_prefix.'user_roles";';
|
288 |
else
|
289 |
{
|
290 |
WPvivid_Setting::import_json_to_setting($this->current_setting);
|
291 |
+
do_action('wpvivid_reset_schedule');
|
292 |
+
//WPvivid_Schedule::reset_schedule();
|
293 |
}
|
294 |
|
295 |
fclose($sql_handle);
|
701 |
if(substr($table_name, strlen($this->new_prefix))=='options')
|
702 |
{
|
703 |
WPvivid_Setting::import_json_to_setting($this->current_setting);
|
704 |
+
//WPvivid_Schedule::reset_schedule();
|
705 |
+
do_action('wpvivid_reset_schedule');
|
706 |
if($this->old_prefix!=$this->new_prefix)
|
707 |
{
|
708 |
$update_query ='UPDATE '.$table_name.' SET option_name="'.$this->new_prefix.'user_roles" WHERE option_name="'.$this->old_prefix.'user_roles";';
|
includes/class-wpvivid-restore-site.php
CHANGED
@@ -145,9 +145,32 @@ class WPvivid_RestoreSite
|
|
145 |
{
|
146 |
if($option['is_migrate'] == 1)
|
147 |
{
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
WPvivid_Setting::update_option('wpvivid_migrate_status', 'completed');
|
153 |
}
|
145 |
{
|
146 |
if($option['is_migrate'] == 1)
|
147 |
{
|
148 |
+
if (function_exists('save_mod_rewrite_rules'))
|
149 |
+
{
|
150 |
+
if(file_exists(get_home_path() . '.htaccess'))
|
151 |
+
{
|
152 |
+
$htaccess_data=file_get_contents(get_home_path() . '.htaccess');
|
153 |
+
$line='';
|
154 |
+
if(preg_match('#AddHandler application/x-httpd-php.*#',$htaccess_data,$matcher))
|
155 |
+
{
|
156 |
+
$line = PHP_EOL.$matcher[0];
|
157 |
+
|
158 |
+
if(preg_match('#<IfModule mod_suphp.c>#',$htaccess_data,$matcher))
|
159 |
+
{
|
160 |
+
$line.= PHP_EOL.'<IfModule mod_suphp.c>';
|
161 |
+
if(preg_match('#suPHP_ConfigPath .*#',$htaccess_data,$matcher))
|
162 |
+
{
|
163 |
+
$line.= PHP_EOL.$matcher[0];
|
164 |
+
}
|
165 |
+
$line.= PHP_EOL.'</IfModule>';
|
166 |
+
}
|
167 |
+
$wpvivid_plugin->restore_data->write_log('find php selector:'.$line,'notice');
|
168 |
+
}
|
169 |
+
@rename(get_home_path() . '.htaccess', get_home_path() . '.htaccess_old');
|
170 |
+
save_mod_rewrite_rules();
|
171 |
+
if(!empty($line))
|
172 |
+
file_put_contents(get_home_path() . '.htaccess',$line,FILE_APPEND);
|
173 |
+
}
|
174 |
}
|
175 |
WPvivid_Setting::update_option('wpvivid_migrate_status', 'completed');
|
176 |
}
|
includes/class-wpvivid-restore.php
CHANGED
@@ -27,7 +27,7 @@ class WPvivid_Restore
|
|
27 |
}
|
28 |
else if($next_task===WPVIVID_RESTORE_RUNNING)
|
29 |
{
|
30 |
-
|
31 |
$wpvivid_plugin->restore_data->write_log('A restore task is already running.','error');
|
32 |
return array('result'=>WPVIVID_FAILED,'error'=> 'A restore task is already running.');
|
33 |
}
|
27 |
}
|
28 |
else if($next_task===WPVIVID_RESTORE_RUNNING)
|
29 |
{
|
30 |
+
//$wpvivid_plugin->restore_data->update_error('A restore task is already running.');
|
31 |
$wpvivid_plugin->restore_data->write_log('A restore task is already running.','error');
|
32 |
return array('result'=>WPVIVID_FAILED,'error'=> 'A restore task is already running.');
|
33 |
}
|
includes/class-wpvivid-schedule.php
CHANGED
@@ -21,6 +21,11 @@ class WPvivid_Schedule
|
|
21 |
'montly' => 'Monthly'
|
22 |
);
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
public function wpvivid_cron_schedules($schedules)
|
25 |
{
|
26 |
if(!isset($schedules["wpvivid_12hours"])){
|
@@ -88,7 +93,9 @@ class WPvivid_Schedule
|
|
88 |
$html.='<p>Warning: Unable to set '.$display.' backup schedule</p>';
|
89 |
}
|
90 |
}
|
91 |
-
|
|
|
|
|
92 |
return $html;
|
93 |
}
|
94 |
|
@@ -290,6 +297,12 @@ class WPvivid_Schedule
|
|
290 |
|
291 |
}
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
public static function reset_schedule()
|
294 |
{
|
295 |
$schedule=WPvivid_Setting::get_option('wpvivid_schedule_setting');
|
21 |
'montly' => 'Monthly'
|
22 |
);
|
23 |
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
add_action('wpvivid_reset_schedule', array($this, 'wpvivid_reset_schedule'), 10);
|
27 |
+
}
|
28 |
+
|
29 |
public function wpvivid_cron_schedules($schedules)
|
30 |
{
|
31 |
if(!isset($schedules["wpvivid_12hours"])){
|
93 |
$html.='<p>Warning: Unable to set '.$display.' backup schedule</p>';
|
94 |
}
|
95 |
}
|
96 |
+
$html.='<label><input type="radio" disabled />';
|
97 |
+
$html.='<a href="https://wpvivid.com/wpvivid-backup-pro-schedule-overview?utm_source=client_custom_cycles&utm_medium=inner_link&utm_campaign=access">Custom cycles</a>';
|
98 |
+
$html.='</label>';
|
99 |
return $html;
|
100 |
}
|
101 |
|
297 |
|
298 |
}
|
299 |
|
300 |
+
public function wpvivid_reset_schedule()
|
301 |
+
{
|
302 |
+
self::reset_schedule();
|
303 |
+
return true;
|
304 |
+
}
|
305 |
+
|
306 |
public static function reset_schedule()
|
307 |
{
|
308 |
$schedule=WPvivid_Setting::get_option('wpvivid_schedule_setting');
|
includes/class-wpvivid-setting.php
CHANGED
@@ -423,10 +423,11 @@ class WPvivid_Setting
|
|
423 |
$get_options[]='wpvivid_compress_setting';
|
424 |
$get_options[]='wpvivid_local_setting';
|
425 |
$get_options[]='wpvivid_common_setting';
|
|
|
426 |
}
|
427 |
else
|
428 |
{
|
429 |
-
$get_options=$options_name;
|
430 |
}
|
431 |
|
432 |
$ret['result']='success';
|
@@ -495,6 +496,7 @@ class WPvivid_Setting
|
|
495 |
$json['data']['wpvivid_common_setting']=self::get_option('wpvivid_common_setting');
|
496 |
$json['data']['wpvivid_email_setting']=self::get_option('wpvivid_email_setting');
|
497 |
$json['data']['wpvivid_saved_api_token']=self::get_option('wpvivid_saved_api_token');
|
|
|
498 |
}
|
499 |
|
500 |
if($history)
|
423 |
$get_options[]='wpvivid_compress_setting';
|
424 |
$get_options[]='wpvivid_local_setting';
|
425 |
$get_options[]='wpvivid_common_setting';
|
426 |
+
$get_options = apply_filters('wpvivid_get_setting_addon', $get_options);
|
427 |
}
|
428 |
else
|
429 |
{
|
430 |
+
$get_options[]=$options_name;
|
431 |
}
|
432 |
|
433 |
$ret['result']='success';
|
496 |
$json['data']['wpvivid_common_setting']=self::get_option('wpvivid_common_setting');
|
497 |
$json['data']['wpvivid_email_setting']=self::get_option('wpvivid_email_setting');
|
498 |
$json['data']['wpvivid_saved_api_token']=self::get_option('wpvivid_saved_api_token');
|
499 |
+
$json = apply_filters('wpvivid_export_setting_addon', $json);
|
500 |
}
|
501 |
|
502 |
if($history)
|
includes/class-wpvivid-tools.php
CHANGED
@@ -33,16 +33,13 @@ class WPvivid_tools
|
|
33 |
return array('result'=>WPVIVID_SUCCESS);
|
34 |
}
|
35 |
|
36 |
-
public static function clearcache($task_id)
|
37 |
-
|
38 |
-
$parse = parse_url($home_url_prefix);
|
39 |
-
$tmppath=str_replace('/','_',$parse['path']);
|
40 |
-
$home_url_prefix = $parse['host'].$tmppath;
|
41 |
$path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
42 |
$handler=opendir($path);
|
43 |
while(($filename=readdir($handler))!==false)
|
44 |
{
|
45 |
-
if(is_dir($path.DIRECTORY_SEPARATOR.$filename) && preg_match('#temp-'.$
|
46 |
{
|
47 |
WPvivid_tools::deldir($path.DIRECTORY_SEPARATOR.$filename,'',true);
|
48 |
}
|
33 |
return array('result'=>WPVIVID_SUCCESS);
|
34 |
}
|
35 |
|
36 |
+
public static function clearcache($task_id)
|
37 |
+
{
|
|
|
|
|
|
|
38 |
$path = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.WPvivid_Setting::get_backupdir();
|
39 |
$handler=opendir($path);
|
40 |
while(($filename=readdir($handler))!==false)
|
41 |
{
|
42 |
+
if(is_dir($path.DIRECTORY_SEPARATOR.$filename) && preg_match('#temp-'.$task_id.'#',$filename))
|
43 |
{
|
44 |
WPvivid_tools::deldir($path.DIRECTORY_SEPARATOR.$filename,'',true);
|
45 |
}
|
includes/class-wpvivid-zipclass.php
CHANGED
@@ -790,5 +790,10 @@ function wpvivid_function_pre_extract_callback($p_event, &$p_header)
|
|
790 |
return 0;
|
791 |
}
|
792 |
|
|
|
|
|
|
|
|
|
|
|
793 |
return 1;
|
794 |
}
|
790 |
return 0;
|
791 |
}
|
792 |
|
793 |
+
if(strpos($p_header['filename'],'.htaccess')!==false)
|
794 |
+
{
|
795 |
+
return 0;
|
796 |
+
}
|
797 |
+
|
798 |
return 1;
|
799 |
}
|
includes/class-wpvivid.php
CHANGED
@@ -121,7 +121,6 @@ class WPvivid {
|
|
121 |
add_action('wpvivid_handle_backup_failed',array($this,'wpvivid_mark_task'),20);
|
122 |
add_action('init', array($this, 'init_pclzip_tmp_folder'));
|
123 |
add_action('plugins_loaded', array($this, 'load_remote_storage'),10);
|
124 |
-
add_filter('wpvivid_list_task', array($this, '_list_tasks'), 10, 2);
|
125 |
|
126 |
//Initialisation schedule hook
|
127 |
$this->init_cron();
|
@@ -236,7 +235,7 @@ class WPvivid {
|
|
236 |
}
|
237 |
|
238 |
public function wpjam_pre_update_option_cache($value, $option)
|
239 |
-
|
240 |
wp_cache_delete('notoptions', 'options');
|
241 |
wp_cache_delete('alloptions', 'options');
|
242 |
wp_cache_delete($option, 'options');
|
@@ -350,6 +349,11 @@ class WPvivid {
|
|
350 |
add_action('wp_ajax_wpvivid_send_debug_info',array($this,'wpvivid_send_debug_info'));
|
351 |
add_action('wp_ajax_wpvivid_get_ini_memory_limit',array($this,'get_ini_memory_limit'));
|
352 |
add_action('wp_ajax_wpvivid_get_restore_file_is_migrate', array($this, 'get_restore_file_is_migrate'));
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
|
355 |
public function get_plugin_name()
|
@@ -811,6 +815,7 @@ class WPvivid {
|
|
811 |
public function main_schedule($schedule_id='')
|
812 |
{
|
813 |
//get backup options
|
|
|
814 |
$this->end_shutdown_function=false;
|
815 |
register_shutdown_function(array($this,'deal_prepare_shutdown_error'));
|
816 |
$schedule_options=WPvivid_Schedule::get_schedule($schedule_id);
|
@@ -819,13 +824,15 @@ class WPvivid {
|
|
819 |
$this->end_shutdown_function=true;
|
820 |
die();
|
821 |
}
|
822 |
-
try
|
|
|
823 |
$schedule_options['backup']['local'] = strval($schedule_options['backup']['local']);
|
824 |
$schedule_options['backup']['remote'] = strval($schedule_options['backup']['remote']);
|
825 |
$schedule_options['backup']['ismerge'] = strval($schedule_options['backup']['ismerge']);
|
826 |
$schedule_options['backup']['lock'] = strval($schedule_options['backup']['lock']);
|
827 |
$ret = $this->check_backup_option($schedule_options['backup'], 'Cron');
|
828 |
-
if ($ret['result'] != WPVIVID_SUCCESS)
|
|
|
829 |
$this->end_shutdown_function=true;
|
830 |
echo json_encode($ret);
|
831 |
die();
|
@@ -837,7 +844,7 @@ class WPvivid {
|
|
837 |
$schedule_options['backup']['action']='backup';
|
838 |
}
|
839 |
|
840 |
-
$ret = $this->pre_backup($schedule_options['backup']
|
841 |
if ($ret['result'] == 'success') {
|
842 |
//Check the website data to be backed up.
|
843 |
$this->check_backup($ret['task_id'], $schedule_options['backup']);
|
@@ -1024,7 +1031,10 @@ class WPvivid {
|
|
1024 |
*/
|
1025 |
public function pre_backup($backup_options)
|
1026 |
{
|
1027 |
-
|
|
|
|
|
|
|
1028 |
|
1029 |
if(WPvivid_taskmanager::is_tasks_backup_running())
|
1030 |
{
|
@@ -1075,8 +1085,7 @@ class WPvivid {
|
|
1075 |
$backup=new WPvivid_Backup();
|
1076 |
|
1077 |
$backup_ret=$backup->backup($task_id);
|
1078 |
-
|
1079 |
-
WPvivid_tools::clearcache($task_id);
|
1080 |
|
1081 |
if($backup_ret['result'] != WPVIVID_SUCCESS)
|
1082 |
{
|
@@ -1091,7 +1100,6 @@ class WPvivid {
|
|
1091 |
$this->end_shutdown_function=true;
|
1092 |
die();
|
1093 |
}
|
1094 |
-
|
1095 |
if(WPvivid_taskmanager::get_task_options($task_id,'remote_options')!=false)
|
1096 |
{
|
1097 |
$this->upload($task_id,false);
|
@@ -1271,9 +1279,11 @@ class WPvivid {
|
|
1271 |
if($task['action'] === 'backup')
|
1272 |
{
|
1273 |
$backup_error_array = WPvivid_Setting::get_option('wpvivid_backup_error_array');
|
1274 |
-
if (empty($backup_error_array))
|
1275 |
{
|
1276 |
$backup_error_array = array();
|
|
|
|
|
1277 |
}
|
1278 |
if (!array_key_exists($task['id'], $backup_error_array['bu_error']))
|
1279 |
{
|
@@ -1315,8 +1325,8 @@ class WPvivid {
|
|
1315 |
$backup_error_array['bu_error']['error_msg'] = __('<div class="notice notice-error inline"><p>' . $notice_msg . ', Please switch to <a href="#" onclick="wpvivid_click_switch_page(\'wrap\', \'wpvivid_tab_debug\', true);">Website Info</a> page to send us the debug information. </p></div>');
|
1316 |
}
|
1317 |
}
|
1318 |
-
WPvivid_Setting::update_option('wpvivid_backup_error_array', $backup_error_array);
|
1319 |
}
|
|
|
1320 |
}
|
1321 |
$this->wpvivid_log->WriteLog($task['status']['error'],'error');
|
1322 |
WPvivid_error_log::create_error_log($this->wpvivid_log->log_file);
|
@@ -1605,6 +1615,124 @@ class WPvivid {
|
|
1605 |
}
|
1606 |
}
|
1607 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1608 |
/**
|
1609 |
* Estimate the size of files, folder, database and backup time before backing up.
|
1610 |
*
|
@@ -2482,8 +2610,10 @@ class WPvivid {
|
|
2482 |
}
|
2483 |
|
2484 |
$remote_options['type'] = $_POST['type'];
|
2485 |
-
if ($remote_options['type'] == 'amazons3')
|
2486 |
-
|
|
|
|
|
2487 |
}
|
2488 |
$ret = $this->remote_collection->add_remote($remote_options);
|
2489 |
|
@@ -2503,6 +2633,12 @@ class WPvivid {
|
|
2503 |
$remote_storage = '';
|
2504 |
$remote_storage = apply_filters('wpvivid_remote_storage', $remote_storage);
|
2505 |
$ret['remote_storage'] = $remote_storage;
|
|
|
|
|
|
|
|
|
|
|
|
|
2506 |
$success_msg = 'You have successfully added a remote storage.';
|
2507 |
$ret['notice'] = apply_filters('wpvivid_add_remote_notice', true, $success_msg);
|
2508 |
}
|
@@ -2555,7 +2691,7 @@ class WPvivid {
|
|
2555 |
$ret['remote_storage'] = $remote_storage;
|
2556 |
} else {
|
2557 |
$ret['result'] = 'failed';
|
2558 |
-
$ret['error'] = __('
|
2559 |
}
|
2560 |
}
|
2561 |
catch (Exception $error) {
|
@@ -2623,10 +2759,20 @@ class WPvivid {
|
|
2623 |
die();
|
2624 |
}
|
2625 |
$remote_options['type'] = $_POST['type'];
|
2626 |
-
if ($remote_options['type'] == 'amazons3')
|
2627 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2628 |
}
|
2629 |
-
|
|
|
2630 |
|
2631 |
if ($ret['result'] == 'success') {
|
2632 |
$ret['result'] = WPVIVID_SUCCESS;
|
@@ -2645,6 +2791,12 @@ class WPvivid {
|
|
2645 |
$remote_storage = '';
|
2646 |
$remote_storage = apply_filters('wpvivid_remote_storage', $remote_storage);
|
2647 |
$ret['remote_storage'] = $remote_storage;
|
|
|
|
|
|
|
|
|
|
|
|
|
2648 |
$success_msg = 'You have successfully updated the account information of your remote storage.';
|
2649 |
$ret['notice'] = apply_filters('wpvivid_add_remote_notice', true, $success_msg);
|
2650 |
}
|
@@ -2833,6 +2985,16 @@ class WPvivid {
|
|
2833 |
$restore_db_data = new WPvivid_RestoreDB();
|
2834 |
$ret['max_allow_packet_warning'] = $restore_db_data->check_max_allow_packet_ex();
|
2835 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2836 |
$memory_limit = ini_get('memory_limit');
|
2837 |
$unit = substr($memory_limit, -1);
|
2838 |
if ($unit == 'K')
|
@@ -3064,12 +3226,33 @@ class WPvivid {
|
|
3064 |
die();
|
3065 |
}
|
3066 |
|
|
|
|
|
|
|
3067 |
$task = WPvivid_taskmanager::get_download_task_v2($_POST['file_name']);
|
3068 |
|
3069 |
if ($task === false) {
|
3070 |
-
$
|
3071 |
-
$
|
3072 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3073 |
echo json_encode($ret);
|
3074 |
} else {
|
3075 |
$ret['result'] = WPVIVID_SUCCESS;
|
@@ -3197,11 +3380,12 @@ class WPvivid {
|
|
3197 |
else{
|
3198 |
$memory_limit = WPVIVID_RESTORE_MEMORY_LIMIT;
|
3199 |
}
|
|
|
3200 |
@ini_set('memory_limit', $memory_limit);
|
3201 |
$ret=$restore->restore();
|
3202 |
if($ret['result']==WPVIVID_FAILED&&$ret['error']=='A restore task is already running.')
|
3203 |
{
|
3204 |
-
echo json_encode(
|
3205 |
$this->end_shutdown_function=true;
|
3206 |
die();
|
3207 |
}
|
@@ -3569,9 +3753,7 @@ class WPvivid {
|
|
3569 |
else{
|
3570 |
$backup_id=false;
|
3571 |
}
|
3572 |
-
|
3573 |
-
$ret = array();
|
3574 |
-
$ret = apply_filters('wpvivid_list_task', $ret, $backup_id);
|
3575 |
|
3576 |
$backup_success_count=WPvivid_Setting::get_option('wpvivid_backup_success_count');
|
3577 |
if(!empty($backup_success_count)){
|
@@ -3596,13 +3778,13 @@ class WPvivid {
|
|
3596 |
die();
|
3597 |
}
|
3598 |
|
3599 |
-
public function _list_tasks($
|
3600 |
$tasks=WPvivid_Setting::get_tasks();
|
3601 |
$ret=array();
|
3602 |
$list_tasks=array();
|
3603 |
foreach ($tasks as $task)
|
3604 |
{
|
3605 |
-
|
3606 |
{
|
3607 |
$backup=new WPvivid_Backup_Task($task['id']);
|
3608 |
$list_tasks[$task['id']]=$backup->get_backup_task_info($task['id']);
|
@@ -3617,6 +3799,10 @@ class WPvivid {
|
|
3617 |
if($list_tasks[$task['id']]['task_info']['need_update_last_task']===true){
|
3618 |
$task_msg = WPvivid_taskmanager::get_task($task['id']);
|
3619 |
$this->update_last_backup_task($task_msg);
|
|
|
|
|
|
|
|
|
3620 |
}
|
3621 |
$list_tasks[$task['id']]['progress_html'] = '<div class="action-progress-bar" id="wpvivid_action_progress_bar">
|
3622 |
<div class="action-progress-bar-percent" id="wpvivid_action_progress_bar_percent" style="height:24px;width:' . $list_tasks[$task['id']]['task_info']['backup_percent'] . '"></div>
|
@@ -3891,16 +4077,19 @@ class WPvivid {
|
|
3891 |
$this->ajax_check_security();
|
3892 |
try {
|
3893 |
$backup_ids = WPvivid_Backuplist::get_out_of_date_backuplist(WPvivid_Setting::get_max_backup_count());
|
3894 |
-
foreach ($backup_ids as $backup_id)
|
|
|
3895 |
$this->delete_backup_by_id($backup_id);
|
3896 |
}
|
3897 |
$ret['result'] = 'success';
|
3898 |
$html = '';
|
3899 |
$html = apply_filters('wpvivid_add_backup_list', $html);
|
3900 |
$ret['html'] = $html;
|
|
|
3901 |
echo json_encode($ret);
|
3902 |
}
|
3903 |
-
catch (Exception $error)
|
|
|
3904 |
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
3905 |
error_log($message);
|
3906 |
echo json_encode(array('result'=>'failed','error'=>$message));
|
@@ -4213,6 +4402,12 @@ class WPvivid {
|
|
4213 |
$remote_storage = '';
|
4214 |
$remote_storage = apply_filters('wpvivid_remote_storage', $remote_storage);
|
4215 |
$ret['remote_storage'] = $remote_storage;
|
|
|
|
|
|
|
|
|
|
|
|
|
4216 |
$success_msg = 'You have successfully changed your default remote storage.';
|
4217 |
$ret['notice'] = apply_filters('wpvivid_add_remote_notice', true, $success_msg);
|
4218 |
echo json_encode($ret);
|
@@ -4226,6 +4421,30 @@ class WPvivid {
|
|
4226 |
die();
|
4227 |
}
|
4228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4229 |
function get_default_remote_storage(){
|
4230 |
$this->ajax_check_security('manage_options');
|
4231 |
try {
|
@@ -4322,6 +4541,7 @@ class WPvivid {
|
|
4322 |
$setting_data['wpvivid_common_setting']['memory_limit'] = $setting['memory_limit'].'M';
|
4323 |
$setting_data['wpvivid_common_setting']['restore_memory_limit'] = $setting['restore_memory_limit'].'M';
|
4324 |
$setting_data['wpvivid_common_setting']['migrate_size'] = $setting['migrate_size'];
|
|
|
4325 |
return $setting_data;
|
4326 |
}
|
4327 |
|
@@ -4408,7 +4628,7 @@ class WPvivid {
|
|
4408 |
$ret['result']=WPVIVID_FAILED;
|
4409 |
if(!isset($data['max_file_size']))
|
4410 |
{
|
4411 |
-
$ret['error']=__('The maximum zip file size is
|
4412 |
return $ret;
|
4413 |
}
|
4414 |
|
@@ -4561,7 +4781,8 @@ class WPvivid {
|
|
4561 |
}
|
4562 |
if (json_last_error() === JSON_ERROR_NONE && is_array($json) && array_key_exists('plugin', $json) && $json['plugin'] == 'WPvivid') {
|
4563 |
WPvivid_Setting::import_json_to_setting($json);
|
4564 |
-
WPvivid_Schedule::reset_schedule();
|
|
|
4565 |
$ret['result'] = 'success';
|
4566 |
echo json_encode($ret);
|
4567 |
} else {
|
@@ -4877,8 +5098,10 @@ class WPvivid {
|
|
4877 |
public function get_website_info()
|
4878 |
{
|
4879 |
try {
|
|
|
|
|
4880 |
$ret['result'] = 'success';
|
4881 |
-
$ret['data']['version'] = $
|
4882 |
$ret['data']['home_url'] = get_home_url();
|
4883 |
$ret['data']['abspath'] = ABSPATH;
|
4884 |
$ret['data']['wp_content_path'] = WP_CONTENT_DIR;
|
@@ -5199,16 +5422,16 @@ class WPvivid {
|
|
5199 |
public function wpvivid_schedule_add_remote_pic($html){
|
5200 |
$html = '';
|
5201 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
5202 |
-
$default_remote_storage=
|
5203 |
foreach ($remoteslist['remote_selected'] as $value) {
|
5204 |
-
$default_remote_storage=$value;
|
5205 |
}
|
5206 |
-
$remote_storage_type=
|
5207 |
foreach ($remoteslist as $key=>$value)
|
5208 |
{
|
5209 |
-
if($key
|
5210 |
{
|
5211 |
-
$remote_storage_type=$value['type'];
|
5212 |
}
|
5213 |
}
|
5214 |
|
@@ -5217,7 +5440,7 @@ class WPvivid {
|
|
5217 |
if(is_array($remote)) {
|
5218 |
foreach ($remote as $key => $value) {
|
5219 |
$title = $value['title'];
|
5220 |
-
if ($key
|
5221 |
$pic = $value['selected_pic'];
|
5222 |
} else {
|
5223 |
$pic = $value['default_pic'];
|
@@ -5268,10 +5491,14 @@ class WPvivid {
|
|
5268 |
|
5269 |
if($out_of_date['remote_options'] !== false)
|
5270 |
{
|
|
|
5271 |
foreach ($out_of_date['remote_options'] as $value)
|
5272 |
{
|
5273 |
$out_of_date_remote=apply_filters('wpvivid_get_out_of_date_remote',$out_of_date_remote, $value);
|
|
|
|
|
5274 |
}
|
|
|
5275 |
}
|
5276 |
return $out_of_date_remote;
|
5277 |
}
|
@@ -5455,4 +5682,20 @@ class WPvivid {
|
|
5455 |
{
|
5456 |
return true;
|
5457 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5458 |
}
|
121 |
add_action('wpvivid_handle_backup_failed',array($this,'wpvivid_mark_task'),20);
|
122 |
add_action('init', array($this, 'init_pclzip_tmp_folder'));
|
123 |
add_action('plugins_loaded', array($this, 'load_remote_storage'),10);
|
|
|
124 |
|
125 |
//Initialisation schedule hook
|
126 |
$this->init_cron();
|
235 |
}
|
236 |
|
237 |
public function wpjam_pre_update_option_cache($value, $option)
|
238 |
+
{
|
239 |
wp_cache_delete('notoptions', 'options');
|
240 |
wp_cache_delete('alloptions', 'options');
|
241 |
wp_cache_delete($option, 'options');
|
349 |
add_action('wp_ajax_wpvivid_send_debug_info',array($this,'wpvivid_send_debug_info'));
|
350 |
add_action('wp_ajax_wpvivid_get_ini_memory_limit',array($this,'get_ini_memory_limit'));
|
351 |
add_action('wp_ajax_wpvivid_get_restore_file_is_migrate', array($this, 'get_restore_file_is_migrate'));
|
352 |
+
|
353 |
+
add_action('wp_ajax_wpvivid_check_remote_alias_exist', array($this, 'check_remote_alias_exist'));
|
354 |
+
add_action('wp_ajax_wpvivid_task_monitor', array($this, 'task_monitor_ex'));
|
355 |
+
add_action('wp_ajax_wpvivid_amazons3_notice', array($this, 'amazons3_notice'));
|
356 |
+
//wpvivid_task_monitor
|
357 |
}
|
358 |
|
359 |
public function get_plugin_name()
|
815 |
public function main_schedule($schedule_id='')
|
816 |
{
|
817 |
//get backup options
|
818 |
+
do_action('wpvivid_set_current_schedule_id', $schedule_id);
|
819 |
$this->end_shutdown_function=false;
|
820 |
register_shutdown_function(array($this,'deal_prepare_shutdown_error'));
|
821 |
$schedule_options=WPvivid_Schedule::get_schedule($schedule_id);
|
824 |
$this->end_shutdown_function=true;
|
825 |
die();
|
826 |
}
|
827 |
+
try
|
828 |
+
{
|
829 |
$schedule_options['backup']['local'] = strval($schedule_options['backup']['local']);
|
830 |
$schedule_options['backup']['remote'] = strval($schedule_options['backup']['remote']);
|
831 |
$schedule_options['backup']['ismerge'] = strval($schedule_options['backup']['ismerge']);
|
832 |
$schedule_options['backup']['lock'] = strval($schedule_options['backup']['lock']);
|
833 |
$ret = $this->check_backup_option($schedule_options['backup'], 'Cron');
|
834 |
+
if ($ret['result'] != WPVIVID_SUCCESS)
|
835 |
+
{
|
836 |
$this->end_shutdown_function=true;
|
837 |
echo json_encode($ret);
|
838 |
die();
|
844 |
$schedule_options['backup']['action']='backup';
|
845 |
}
|
846 |
|
847 |
+
$ret = $this->pre_backup($schedule_options['backup']);
|
848 |
if ($ret['result'] == 'success') {
|
849 |
//Check the website data to be backed up.
|
850 |
$this->check_backup($ret['task_id'], $schedule_options['backup']);
|
1031 |
*/
|
1032 |
public function pre_backup($backup_options)
|
1033 |
{
|
1034 |
+
if(apply_filters('wpvivid_need_clean_oldest_backup',true,$backup_options))
|
1035 |
+
{
|
1036 |
+
$this->clean_oldest_backup();
|
1037 |
+
}
|
1038 |
|
1039 |
if(WPvivid_taskmanager::is_tasks_backup_running())
|
1040 |
{
|
1085 |
$backup=new WPvivid_Backup();
|
1086 |
|
1087 |
$backup_ret=$backup->backup($task_id);
|
1088 |
+
$backup->clearcache();
|
|
|
1089 |
|
1090 |
if($backup_ret['result'] != WPVIVID_SUCCESS)
|
1091 |
{
|
1100 |
$this->end_shutdown_function=true;
|
1101 |
die();
|
1102 |
}
|
|
|
1103 |
if(WPvivid_taskmanager::get_task_options($task_id,'remote_options')!=false)
|
1104 |
{
|
1105 |
$this->upload($task_id,false);
|
1279 |
if($task['action'] === 'backup')
|
1280 |
{
|
1281 |
$backup_error_array = WPvivid_Setting::get_option('wpvivid_backup_error_array');
|
1282 |
+
if (!isset($backup_error_array) || empty($backup_error_array))
|
1283 |
{
|
1284 |
$backup_error_array = array();
|
1285 |
+
$backup_error_array['bu_error']['task_id'] = '';
|
1286 |
+
$backup_error_array['bu_error']['error_msg'] = '';
|
1287 |
}
|
1288 |
if (!array_key_exists($task['id'], $backup_error_array['bu_error']))
|
1289 |
{
|
1325 |
$backup_error_array['bu_error']['error_msg'] = __('<div class="notice notice-error inline"><p>' . $notice_msg . ', Please switch to <a href="#" onclick="wpvivid_click_switch_page(\'wrap\', \'wpvivid_tab_debug\', true);">Website Info</a> page to send us the debug information. </p></div>');
|
1326 |
}
|
1327 |
}
|
|
|
1328 |
}
|
1329 |
+
WPvivid_Setting::update_option('wpvivid_backup_error_array', $backup_error_array);
|
1330 |
}
|
1331 |
$this->wpvivid_log->WriteLog($task['status']['error'],'error');
|
1332 |
WPvivid_error_log::create_error_log($this->wpvivid_log->log_file);
|
1615 |
}
|
1616 |
}
|
1617 |
}
|
1618 |
+
|
1619 |
+
public function task_monitor_ex()
|
1620 |
+
{
|
1621 |
+
$tasks=WPvivid_Setting::get_tasks();
|
1622 |
+
$task_id='';
|
1623 |
+
foreach ($tasks as $task)
|
1624 |
+
{
|
1625 |
+
if($task['action']=='backup')
|
1626 |
+
{
|
1627 |
+
$status=WPvivid_taskmanager::get_backup_tasks_status($task['id']);
|
1628 |
+
if($status['str']=='completed'||$status['str']=='error')
|
1629 |
+
{
|
1630 |
+
continue;
|
1631 |
+
}
|
1632 |
+
else
|
1633 |
+
{
|
1634 |
+
$task_id=$task['id'];
|
1635 |
+
break;
|
1636 |
+
}
|
1637 |
+
}
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
if(empty($task_id))
|
1641 |
+
{
|
1642 |
+
die();
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
if(WPvivid_taskmanager::get_task($task_id)!==false)
|
1646 |
+
{
|
1647 |
+
if($this->wpvivid_log->log_file_handle==false)
|
1648 |
+
{
|
1649 |
+
$this->wpvivid_log->OpenLogFile(WPvivid_taskmanager::get_task_options($task_id,'log_file_name'));
|
1650 |
+
}
|
1651 |
+
|
1652 |
+
$status=WPvivid_taskmanager::get_backup_task_status($task_id);
|
1653 |
+
|
1654 |
+
if($status['str']=='running'||$status['str']=='error'||$status['str']=='no_responds')
|
1655 |
+
{
|
1656 |
+
$options=WPvivid_Setting::get_option('wpvivid_common_setting');
|
1657 |
+
if(isset($options['max_execution_time']))
|
1658 |
+
{
|
1659 |
+
$limit=$options['max_execution_time'];
|
1660 |
+
}
|
1661 |
+
else
|
1662 |
+
{
|
1663 |
+
$limit=WPVIVID_MAX_EXECUTION_TIME;
|
1664 |
+
}
|
1665 |
+
$time_spend=time()-$status['timeout'];
|
1666 |
+
|
1667 |
+
if($time_spend>=$limit)
|
1668 |
+
{
|
1669 |
+
//time out
|
1670 |
+
if(isset($options['max_resume_count']))
|
1671 |
+
{
|
1672 |
+
$max_resume_count=$options['max_resume_count'];
|
1673 |
+
}
|
1674 |
+
else
|
1675 |
+
{
|
1676 |
+
$max_resume_count=WPVIVID_RESUME_RETRY_TIMES;
|
1677 |
+
}
|
1678 |
+
$status['resume_count']++;
|
1679 |
+
if($status['resume_count']>$max_resume_count)
|
1680 |
+
{
|
1681 |
+
$message=__('Too many resumption attempts.', 'wpvivid');
|
1682 |
+
$task=WPvivid_taskmanager::update_backup_task_status($task_id,false,'error',false,$status['resume_count'],$message);
|
1683 |
+
WPvivid_error_log::create_error_log($this->wpvivid_log->log_file);
|
1684 |
+
do_action('wpvivid_handle_backup_failed',$task, true);
|
1685 |
+
}
|
1686 |
+
else
|
1687 |
+
{
|
1688 |
+
$this->check_cancel_backup($task_id);
|
1689 |
+
$message=__('Task timed out.', 'wpvivid');
|
1690 |
+
if($this->add_resume_event($task_id))
|
1691 |
+
{
|
1692 |
+
WPvivid_taskmanager::update_backup_task_status($task_id,false,'wait_resume',false,$status['resume_count']);
|
1693 |
+
}
|
1694 |
+
else
|
1695 |
+
{
|
1696 |
+
$task=WPvivid_taskmanager::update_backup_task_status($task_id,false,'error',false,$status['resume_count'],$message);
|
1697 |
+
do_action('wpvivid_handle_backup_failed',$task, true);
|
1698 |
+
}
|
1699 |
+
}
|
1700 |
+
if($this->wpvivid_log)
|
1701 |
+
$this->wpvivid_log->WriteLog($message,'error');
|
1702 |
+
}
|
1703 |
+
else {
|
1704 |
+
$time_spend=time()-$status['run_time'];
|
1705 |
+
if($time_spend>180)
|
1706 |
+
{
|
1707 |
+
$this->check_cancel_backup($task_id);
|
1708 |
+
$this->wpvivid_log->WriteLog('Not responding for a long time.','notice');
|
1709 |
+
WPvivid_taskmanager::update_backup_task_status($task_id,false,'no_responds',false,$status['resume_count']);
|
1710 |
+
$this->add_monitor_event($task_id);
|
1711 |
+
}
|
1712 |
+
else{
|
1713 |
+
$this->add_monitor_event($task_id);
|
1714 |
+
}
|
1715 |
+
}
|
1716 |
+
}
|
1717 |
+
else if($status['str']=='wait_resume')
|
1718 |
+
{
|
1719 |
+
$timestamp = wp_next_scheduled(WPVIVID_RESUME_SCHEDULE_EVENT,array($task_id));
|
1720 |
+
if($timestamp===false)
|
1721 |
+
{
|
1722 |
+
if($this->wpvivid_log)
|
1723 |
+
$this->wpvivid_log->WriteLog('Missing resume task,so we create new one.','error');
|
1724 |
+
$message = 'Task timed out (WebHosting).';
|
1725 |
+
if ($this->add_resume_event($task_id))
|
1726 |
+
{
|
1727 |
+
WPvivid_taskmanager::update_backup_task_status($task_id, false, 'wait_resume', false, $status['resume_count']);
|
1728 |
+
} else {
|
1729 |
+
$task = WPvivid_taskmanager::update_backup_task_status($task_id, false, 'error', false, $status['resume_count'], $message);
|
1730 |
+
do_action('wpvivid_handle_backup_failed', $task, true);
|
1731 |
+
}
|
1732 |
+
}
|
1733 |
+
}
|
1734 |
+
}
|
1735 |
+
}
|
1736 |
/**
|
1737 |
* Estimate the size of files, folder, database and backup time before backing up.
|
1738 |
*
|
2610 |
}
|
2611 |
|
2612 |
$remote_options['type'] = $_POST['type'];
|
2613 |
+
if ($remote_options['type'] == 'amazons3')
|
2614 |
+
{
|
2615 |
+
if(isset($remote_options['s3Path']))
|
2616 |
+
$remote_options['s3Path'] = rtrim($remote_options['s3Path'], "/");
|
2617 |
}
|
2618 |
$ret = $this->remote_collection->add_remote($remote_options);
|
2619 |
|
2633 |
$remote_storage = '';
|
2634 |
$remote_storage = apply_filters('wpvivid_remote_storage', $remote_storage);
|
2635 |
$ret['remote_storage'] = $remote_storage;
|
2636 |
+
$remote_select_part = '';
|
2637 |
+
$remote_select_part = apply_filters('wpvivid_remote_storage_select_part', $remote_select_part);
|
2638 |
+
$ret['remote_select_part'] = $remote_select_part;
|
2639 |
+
$default = array();
|
2640 |
+
$remote_array = apply_filters('wpvivid_archieve_remote_array', $default);
|
2641 |
+
$ret['remote_array'] = $remote_array;
|
2642 |
$success_msg = 'You have successfully added a remote storage.';
|
2643 |
$ret['notice'] = apply_filters('wpvivid_add_remote_notice', true, $success_msg);
|
2644 |
}
|
2691 |
$ret['remote_storage'] = $remote_storage;
|
2692 |
} else {
|
2693 |
$ret['result'] = 'failed';
|
2694 |
+
$ret['error'] = __('Fail to delete the remote storage, can not retrieve the storage infomation. Please try again.', 'wpvivid');
|
2695 |
}
|
2696 |
}
|
2697 |
catch (Exception $error) {
|
2759 |
die();
|
2760 |
}
|
2761 |
$remote_options['type'] = $_POST['type'];
|
2762 |
+
if ($remote_options['type'] == 'amazons3')
|
2763 |
+
{
|
2764 |
+
if(isset($remote_options['s3Path']))
|
2765 |
+
$remote_options['s3Path'] = rtrim($remote_options['s3Path'], "/");
|
2766 |
+
}
|
2767 |
+
|
2768 |
+
$old_remote=WPvivid_Setting::get_remote_option($_POST['id']);
|
2769 |
+
foreach ($old_remote as $key=>$value)
|
2770 |
+
{
|
2771 |
+
if(isset($remote_options[$key]))
|
2772 |
+
$old_remote[$key]=$remote_options[$key];
|
2773 |
}
|
2774 |
+
|
2775 |
+
$ret = $this->remote_collection->update_remote($_POST['id'], $old_remote);
|
2776 |
|
2777 |
if ($ret['result'] == 'success') {
|
2778 |
$ret['result'] = WPVIVID_SUCCESS;
|
2791 |
$remote_storage = '';
|
2792 |
$remote_storage = apply_filters('wpvivid_remote_storage', $remote_storage);
|
2793 |
$ret['remote_storage'] = $remote_storage;
|
2794 |
+
$remote_select_part = '';
|
2795 |
+
$remote_select_part = apply_filters('wpvivid_remote_storage_select_part', $remote_select_part);
|
2796 |
+
$ret['remote_select_part'] = $remote_select_part;
|
2797 |
+
$default = array();
|
2798 |
+
$remote_array = apply_filters('wpvivid_archieve_remote_array', $default);
|
2799 |
+
$ret['remote_array'] = $remote_array;
|
2800 |
$success_msg = 'You have successfully updated the account information of your remote storage.';
|
2801 |
$ret['notice'] = apply_filters('wpvivid_add_remote_notice', true, $success_msg);
|
2802 |
}
|
2985 |
$restore_db_data = new WPvivid_RestoreDB();
|
2986 |
$ret['max_allow_packet_warning'] = $restore_db_data->check_max_allow_packet_ex();
|
2987 |
|
2988 |
+
$common_setting = WPvivid_Setting::get_option('wpvivid_common_setting');
|
2989 |
+
if(isset($common_setting['restore_memory_limit']) && !empty($common_setting['restore_memory_limit'])){
|
2990 |
+
$memory_limit = $common_setting['restore_memory_limit'];
|
2991 |
+
}
|
2992 |
+
else{
|
2993 |
+
$memory_limit = WPVIVID_RESTORE_MEMORY_LIMIT;
|
2994 |
+
}
|
2995 |
+
|
2996 |
+
@ini_set('memory_limit', $memory_limit);
|
2997 |
+
|
2998 |
$memory_limit = ini_get('memory_limit');
|
2999 |
$unit = substr($memory_limit, -1);
|
3000 |
if ($unit == 'K')
|
3226 |
die();
|
3227 |
}
|
3228 |
|
3229 |
+
$file_name = $_POST['file_name'];
|
3230 |
+
$file_size = $_POST['size'];
|
3231 |
+
|
3232 |
$task = WPvivid_taskmanager::get_download_task_v2($_POST['file_name']);
|
3233 |
|
3234 |
if ($task === false) {
|
3235 |
+
$check_status = false;
|
3236 |
+
$backupdir=WPvivid_Setting::get_backupdir();
|
3237 |
+
$local_storage_dir = WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backupdir;
|
3238 |
+
$local_file=$local_storage_dir.DIRECTORY_SEPARATOR.$file_name;
|
3239 |
+
if(file_exists($local_file))
|
3240 |
+
{
|
3241 |
+
if(filesize($local_file)==$file_size)
|
3242 |
+
{
|
3243 |
+
$check_status = true;
|
3244 |
+
}
|
3245 |
+
}
|
3246 |
+
|
3247 |
+
if($check_status){
|
3248 |
+
$ret['result'] = WPVIVID_SUCCESS;
|
3249 |
+
$ret['status'] = 'completed';
|
3250 |
+
}
|
3251 |
+
else {
|
3252 |
+
$ret['result'] = WPVIVID_FAILED;
|
3253 |
+
$ret['error'] = 'not found download file';
|
3254 |
+
$this->wpvivid_handle_restore_error($ret['error'], 'Downloading backup file');
|
3255 |
+
}
|
3256 |
echo json_encode($ret);
|
3257 |
} else {
|
3258 |
$ret['result'] = WPVIVID_SUCCESS;
|
3380 |
else{
|
3381 |
$memory_limit = WPVIVID_RESTORE_MEMORY_LIMIT;
|
3382 |
}
|
3383 |
+
|
3384 |
@ini_set('memory_limit', $memory_limit);
|
3385 |
$ret=$restore->restore();
|
3386 |
if($ret['result']==WPVIVID_FAILED&&$ret['error']=='A restore task is already running.')
|
3387 |
{
|
3388 |
+
echo json_encode(array('result'=> WPVIVID_SUCCESS));
|
3389 |
$this->end_shutdown_function=true;
|
3390 |
die();
|
3391 |
}
|
3753 |
else{
|
3754 |
$backup_id=false;
|
3755 |
}
|
3756 |
+
$ret = $this->_list_tasks($backup_id);
|
|
|
|
|
3757 |
|
3758 |
$backup_success_count=WPvivid_Setting::get_option('wpvivid_backup_success_count');
|
3759 |
if(!empty($backup_success_count)){
|
3778 |
die();
|
3779 |
}
|
3780 |
|
3781 |
+
public function _list_tasks($backup_id){
|
3782 |
$tasks=WPvivid_Setting::get_tasks();
|
3783 |
$ret=array();
|
3784 |
$list_tasks=array();
|
3785 |
foreach ($tasks as $task)
|
3786 |
{
|
3787 |
+
if($task['action']=='backup')
|
3788 |
{
|
3789 |
$backup=new WPvivid_Backup_Task($task['id']);
|
3790 |
$list_tasks[$task['id']]=$backup->get_backup_task_info($task['id']);
|
3799 |
if($list_tasks[$task['id']]['task_info']['need_update_last_task']===true){
|
3800 |
$task_msg = WPvivid_taskmanager::get_task($task['id']);
|
3801 |
$this->update_last_backup_task($task_msg);
|
3802 |
+
if($task['type'] === 'Cron') {
|
3803 |
+
//update last backup time
|
3804 |
+
//do_action('wpvivid_update_schedule_last_time_addon');
|
3805 |
+
}
|
3806 |
}
|
3807 |
$list_tasks[$task['id']]['progress_html'] = '<div class="action-progress-bar" id="wpvivid_action_progress_bar">
|
3808 |
<div class="action-progress-bar-percent" id="wpvivid_action_progress_bar_percent" style="height:24px;width:' . $list_tasks[$task['id']]['task_info']['backup_percent'] . '"></div>
|
4077 |
$this->ajax_check_security();
|
4078 |
try {
|
4079 |
$backup_ids = WPvivid_Backuplist::get_out_of_date_backuplist(WPvivid_Setting::get_max_backup_count());
|
4080 |
+
foreach ($backup_ids as $backup_id)
|
4081 |
+
{
|
4082 |
$this->delete_backup_by_id($backup_id);
|
4083 |
}
|
4084 |
$ret['result'] = 'success';
|
4085 |
$html = '';
|
4086 |
$html = apply_filters('wpvivid_add_backup_list', $html);
|
4087 |
$ret['html'] = $html;
|
4088 |
+
|
4089 |
echo json_encode($ret);
|
4090 |
}
|
4091 |
+
catch (Exception $error)
|
4092 |
+
{
|
4093 |
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
4094 |
error_log($message);
|
4095 |
echo json_encode(array('result'=>'failed','error'=>$message));
|
4402 |
$remote_storage = '';
|
4403 |
$remote_storage = apply_filters('wpvivid_remote_storage', $remote_storage);
|
4404 |
$ret['remote_storage'] = $remote_storage;
|
4405 |
+
$remote_select_part = '';
|
4406 |
+
$remote_select_part = apply_filters('wpvivid_remote_storage_select_part', $remote_select_part);
|
4407 |
+
$ret['remote_select_part'] = $remote_select_part;
|
4408 |
+
$default = array();
|
4409 |
+
$remote_array = apply_filters('wpvivid_archieve_remote_array', $default);
|
4410 |
+
$ret['remote_array'] = $remote_array;
|
4411 |
$success_msg = 'You have successfully changed your default remote storage.';
|
4412 |
$ret['notice'] = apply_filters('wpvivid_add_remote_notice', true, $success_msg);
|
4413 |
echo json_encode($ret);
|
4421 |
die();
|
4422 |
}
|
4423 |
|
4424 |
+
public function check_remote_alias_exist()
|
4425 |
+
{
|
4426 |
+
$this->ajax_check_security('manage_options');
|
4427 |
+
if (!isset($_POST['remote_alias']))
|
4428 |
+
{
|
4429 |
+
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
4430 |
+
foreach ($remoteslist as $key=>$value)
|
4431 |
+
{
|
4432 |
+
if(isset($value['name'])&&$value['name'] == $_POST['remote_alias'])
|
4433 |
+
{
|
4434 |
+
$ret['result']=WPVIVID_FAILED;
|
4435 |
+
$ret['error']="Warning: The alias already exists in storage list.";
|
4436 |
+
echo json_encode($ret);
|
4437 |
+
die();
|
4438 |
+
}
|
4439 |
+
}
|
4440 |
+
$ret['result']=WPVIVID_SUCCESS;
|
4441 |
+
echo json_encode($ret);
|
4442 |
+
die();
|
4443 |
+
}
|
4444 |
+
|
4445 |
+
die();
|
4446 |
+
}
|
4447 |
+
|
4448 |
function get_default_remote_storage(){
|
4449 |
$this->ajax_check_security('manage_options');
|
4450 |
try {
|
4541 |
$setting_data['wpvivid_common_setting']['memory_limit'] = $setting['memory_limit'].'M';
|
4542 |
$setting_data['wpvivid_common_setting']['restore_memory_limit'] = $setting['restore_memory_limit'].'M';
|
4543 |
$setting_data['wpvivid_common_setting']['migrate_size'] = $setting['migrate_size'];
|
4544 |
+
$setting_data['wpvivid_common_setting']['ismerge'] = $setting['ismerge'];
|
4545 |
return $setting_data;
|
4546 |
}
|
4547 |
|
4628 |
$ret['result']=WPVIVID_FAILED;
|
4629 |
if(!isset($data['max_file_size']))
|
4630 |
{
|
4631 |
+
$ret['error']=__('The maximum zip file size is required.', 'wpvivid');
|
4632 |
return $ret;
|
4633 |
}
|
4634 |
|
4781 |
}
|
4782 |
if (json_last_error() === JSON_ERROR_NONE && is_array($json) && array_key_exists('plugin', $json) && $json['plugin'] == 'WPvivid') {
|
4783 |
WPvivid_Setting::import_json_to_setting($json);
|
4784 |
+
//WPvivid_Schedule::reset_schedule();
|
4785 |
+
do_action('wpvivid_reset_schedule');
|
4786 |
$ret['result'] = 'success';
|
4787 |
echo json_encode($ret);
|
4788 |
} else {
|
5098 |
public function get_website_info()
|
5099 |
{
|
5100 |
try {
|
5101 |
+
$version = $this->version;
|
5102 |
+
$version = apply_filters('wpvivid_display_pro_version', $version);
|
5103 |
$ret['result'] = 'success';
|
5104 |
+
$ret['data']['version'] = $version;
|
5105 |
$ret['data']['home_url'] = get_home_url();
|
5106 |
$ret['data']['abspath'] = ABSPATH;
|
5107 |
$ret['data']['wp_content_path'] = WP_CONTENT_DIR;
|
5422 |
public function wpvivid_schedule_add_remote_pic($html){
|
5423 |
$html = '';
|
5424 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
5425 |
+
$default_remote_storage=array();
|
5426 |
foreach ($remoteslist['remote_selected'] as $value) {
|
5427 |
+
$default_remote_storage[]=$value;
|
5428 |
}
|
5429 |
+
$remote_storage_type=array();
|
5430 |
foreach ($remoteslist as $key=>$value)
|
5431 |
{
|
5432 |
+
if(in_array($key, $default_remote_storage))
|
5433 |
{
|
5434 |
+
$remote_storage_type[]=$value['type'];
|
5435 |
}
|
5436 |
}
|
5437 |
|
5440 |
if(is_array($remote)) {
|
5441 |
foreach ($remote as $key => $value) {
|
5442 |
$title = $value['title'];
|
5443 |
+
if (in_array($key, $remote_storage_type)) {
|
5444 |
$pic = $value['selected_pic'];
|
5445 |
} else {
|
5446 |
$pic = $value['default_pic'];
|
5491 |
|
5492 |
if($out_of_date['remote_options'] !== false)
|
5493 |
{
|
5494 |
+
$out_of_date_remote_temp = array();
|
5495 |
foreach ($out_of_date['remote_options'] as $value)
|
5496 |
{
|
5497 |
$out_of_date_remote=apply_filters('wpvivid_get_out_of_date_remote',$out_of_date_remote, $value);
|
5498 |
+
$value['type']=apply_filters('wpvivid_storage_provider_tran', $value['type']);
|
5499 |
+
$out_of_date_remote_temp[] = $value['type'].': '.$out_of_date_remote;
|
5500 |
}
|
5501 |
+
$out_of_date_remote = implode(',', $out_of_date_remote_temp);
|
5502 |
}
|
5503 |
return $out_of_date_remote;
|
5504 |
}
|
5682 |
{
|
5683 |
return true;
|
5684 |
}
|
5685 |
+
|
5686 |
+
public function amazons3_notice()
|
5687 |
+
{
|
5688 |
+
$this->ajax_check_security();
|
5689 |
+
try {
|
5690 |
+
$notice_message = 'init';
|
5691 |
+
WPvivid_Setting::update_option('wpvivid_amazons3_notice', $notice_message);
|
5692 |
+
}
|
5693 |
+
catch (Exception $error) {
|
5694 |
+
$message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';';
|
5695 |
+
error_log($message);
|
5696 |
+
echo json_encode(array('result'=>'failed','error'=>$message));
|
5697 |
+
die();
|
5698 |
+
}
|
5699 |
+
die();
|
5700 |
+
}
|
5701 |
}
|
includes/customclass/class-wpvivid-amazons3-plus.php
CHANGED
@@ -17,6 +17,9 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
17 |
private $upload_chunk_size = 5242880;
|
18 |
private $download_chunk_size = 5242880;
|
19 |
|
|
|
|
|
|
|
20 |
public function __construct($options=array())
|
21 |
{
|
22 |
if(empty($options))
|
@@ -55,39 +58,127 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
55 |
}
|
56 |
?>
|
57 |
<div id="storage_account_amazons3" class="storage-account-page" style="display:none;">
|
58 |
-
<
|
59 |
-
|
60 |
-
<input type="text" autocomplete="off" option="amazons3" name="name" placeholder="Enter an unique alias: e.g. Amazon S3-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
61 |
-
</div>
|
62 |
-
<div class="storage-account-form">
|
63 |
-
<input type="text" autocomplete="off" option="amazons3" name="access" placeholder="Amazon S3 access key" class="regular-text"/>
|
64 |
-
</div>
|
65 |
-
<div class="storage-account-form">
|
66 |
-
<input type="password" autocomplete="new-password" option="amazons3" name="secret" placeholder="Amazon S3 secret key" class="regular-text"/>
|
67 |
-
</div>
|
68 |
-
<div class="storage-account-form">
|
69 |
-
<input type="text" autocomplete="off" option="amazons3" name="s3Path" placeholder="Amazon S3 path(e.g. test)" class="regular-text" onkeyup="value=value.replace(/^\//g, '')" style="width: 245px;" />
|
70 |
-
<span><?php _e(WPVIVID_AMAZONS3_DEFAULT_FOLDER); ?></span>
|
71 |
-
</div>
|
72 |
-
<div style="padding-left: 10px; margin-bottom: -16px;">
|
73 |
-
<p><span>Amazon S3 storage path:</span><span id="wpvivid_amazons3_root_path">*<?php _e(WPVIVID_AMAZONS3_DEFAULT_FOLDER); ?></span></p>
|
74 |
</div>
|
75 |
-
<
|
76 |
-
<
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
</
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
<?php
|
92 |
if($need_extension){
|
93 |
?>
|
@@ -95,20 +186,7 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
95 |
<?php
|
96 |
}
|
97 |
?>
|
98 |
-
<div>
|
99 |
-
<input class="button-primary storage-account-button" option="add-remote" type="button" name="Example" value="<?php _e( 'Test and Add', 'wpvivid' ); ?>" style="<?php esc_attr_e($add_btn_style); ?>" />
|
100 |
-
</div>
|
101 |
</div>
|
102 |
-
<script>
|
103 |
-
jQuery("input:text[option=amazons3][name=s3Path]").keyup(function(){
|
104 |
-
var value = jQuery(this).val();
|
105 |
-
if(value == ''){
|
106 |
-
value = '*';
|
107 |
-
}
|
108 |
-
value = value + '/wpvivid_backup';
|
109 |
-
jQuery('#wpvivid_amazons3_root_path').html(value);
|
110 |
-
});
|
111 |
-
</script>
|
112 |
<?php
|
113 |
}
|
114 |
|
@@ -116,45 +194,114 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
116 |
{
|
117 |
?>
|
118 |
<div id="remote_storage_edit_amazons3" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
119 |
-
<
|
120 |
-
|
121 |
-
<input type="text" option="edit-amazons3" name="name" placeholder="Enter an unique alias: e.g. Amazon S3-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
122 |
</div>
|
123 |
-
<
|
124 |
-
<
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
<
|
138 |
-
<
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
<
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
</div>
|
148 |
-
<script>
|
149 |
-
jQuery("input:text[option=edit-amazons3][name=s3Path]").keyup(function(){
|
150 |
-
var value = jQuery(this).val();
|
151 |
-
if(value == ''){
|
152 |
-
value = '*';
|
153 |
-
}
|
154 |
-
value = value + '/wpvivid_backup';
|
155 |
-
jQuery('#wpvivid_edit_amazons3_root_path').html(value);
|
156 |
-
});
|
157 |
-
</script>
|
158 |
<?php
|
159 |
}
|
160 |
|
@@ -167,22 +314,30 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
167 |
|
168 |
public function test_connect()
|
169 |
{
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, but create test file failed.');
|
177 |
}
|
178 |
-
if(!$amazons3 -> deleteObject($this -> bucket,$
|
|
|
179 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, and create test file succeed, but delete test file failed.');
|
180 |
}
|
181 |
-
}
|
182 |
-
catch(Exception $e){
|
183 |
-
return array('result'=>WPVIVID_FAILED,'error'=>$e -> getMessage());
|
184 |
-
}
|
185 |
-
catch(Error $e){
|
186 |
return array('result'=>WPVIVID_FAILED,'error'=>$e -> getMessage());
|
187 |
}
|
188 |
return array('result'=>WPVIVID_SUCCESS);
|
@@ -243,21 +398,32 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
243 |
return $ret;
|
244 |
}
|
245 |
|
246 |
-
if(!isset($this->options['
|
247 |
{
|
248 |
-
$ret['error']="Warning:
|
249 |
return $ret;
|
250 |
}
|
251 |
|
252 |
-
$this->options['
|
253 |
|
254 |
-
if(empty($this->options['
|
255 |
{
|
256 |
-
$ret['error']="Warning:
|
257 |
return $ret;
|
258 |
}
|
259 |
|
260 |
-
$this->options['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
$ret['result']=WPVIVID_SUCCESS;
|
263 |
$ret['options']=$this->options;
|
@@ -266,7 +432,9 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
266 |
|
267 |
public function upload($task_id,$files,$callback='')
|
268 |
{
|
|
|
269 |
$amazons3 = $this -> getS3();
|
|
|
270 |
if(is_array($amazons3) && $amazons3['result'] == WPVIVID_FAILED)
|
271 |
return $amazons3;
|
272 |
|
@@ -293,22 +461,35 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
293 |
|
294 |
$this -> last_time = time();
|
295 |
$this -> last_size = 0;
|
296 |
-
|
297 |
if(!file_exists($file))
|
298 |
return array('result' =>WPVIVID_FAILED,'error' =>$file.' not found. The file might has been moved, renamed or deleted. Please reload the list and verify the file exists.');
|
299 |
$result = $this -> _put($task_id,$amazons3,$file,$callback);
|
300 |
if($result['result'] !==WPVIVID_SUCCESS){
|
|
|
301 |
return $result;
|
302 |
}
|
|
|
303 |
}
|
304 |
return array('result' =>WPVIVID_SUCCESS);
|
305 |
}
|
306 |
private function _put($task_id,$amazons3,$file,$callback)
|
307 |
{
|
|
|
308 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3);
|
309 |
$this -> current_file_size = filesize($file);
|
310 |
$this -> current_file_name = basename($file);
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
$chunk_num = floor($this -> current_file_size / $this -> upload_chunk_size);
|
313 |
if($this -> current_file_size % $this -> upload_chunk_size > 0) $chunk_num ++;
|
314 |
|
@@ -317,13 +498,15 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
317 |
try
|
318 |
{
|
319 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,WPVIVID_UPLOAD_UNDO,'Start uploading '.basename($file).'.',$upload_job['job_data']);
|
320 |
-
|
|
|
321 |
{
|
|
|
322 |
if(!empty($upload_job['job_data'][basename($file)]['upload_id']))
|
323 |
{
|
324 |
$build_id = $upload_job['job_data'][basename($file)]['upload_id'];
|
325 |
}else{
|
326 |
-
$build_id = $amazons3 -> initiateMultipartUpload($this -> bucket,$
|
327 |
$upload_job['job_data'][basename($file)]['upload_id'] = $build_id;
|
328 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,WPVIVID_UPLOAD_UNDO,'InitiateMultipartUpload, created build id of '.basename($file).'.',$upload_job['job_data']);
|
329 |
}
|
@@ -338,11 +521,11 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
338 |
|
339 |
for($i =sizeof($chunks);$i <$chunk_num;$i ++)
|
340 |
{
|
341 |
-
$chunk_id = $amazons3 -> uploadPart($this -> bucket,$
|
342 |
if(!$chunk_id){
|
343 |
$chunks = array();
|
344 |
$upload_job['job_data'][basename($file)]['upload_chunks'] = $chunks;
|
345 |
-
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX,
|
346 |
return array('result' => WPVIVID_FAILED,'error' => 'upload '.$file.' failed.');
|
347 |
}
|
348 |
$chunks[] = $chunk_id;
|
@@ -361,10 +544,13 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
361 |
$this -> last_time = time();
|
362 |
}
|
363 |
}
|
364 |
-
$result = $amazons3 -> completeMultipartUpload($this -> bucket,$
|
365 |
}else{
|
|
|
366 |
$input = $amazons3 -> inputFile($file);
|
367 |
-
$
|
|
|
|
|
368 |
}
|
369 |
}catch(Exception $e)
|
370 |
{
|
@@ -396,13 +582,19 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
396 |
global $wpvivid_plugin;
|
397 |
$this->current_file_name = $file['file_name'];
|
398 |
$this->current_file_size = $file['size'];
|
399 |
-
$file_md5 = $file['md5'];
|
400 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Get amazons3 client.','notice');
|
401 |
$amazons3 = $this->getS3();
|
402 |
if (is_array($amazons3) && $amazons3['result'] === WPVIVID_FAILED) {
|
403 |
return $amazons3;
|
404 |
}
|
405 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
$file_path = trailingslashit($local_path) . $this->current_file_name;
|
407 |
$start_offset = file_exists($file_path) ? filesize($file_path) : 0;
|
408 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Create local file.','notice');
|
@@ -411,9 +603,9 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
411 |
while ($start_offset < $this->current_file_size) {
|
412 |
$last_byte = min($start_offset + $this->download_chunk_size - 1, $this->current_file_size - 1);
|
413 |
$headers['Range'] = "bytes=$start_offset-$last_byte";
|
414 |
-
$response = $amazons3->getObject($this->bucket, $
|
415 |
if (!$response)
|
416 |
-
return array('result' => WPVIVID_FAILED, 'error' => 'download ' . $
|
417 |
clearstatcache();
|
418 |
$state = stat($file_path);
|
419 |
$start_offset = $state['size'];
|
@@ -462,43 +654,81 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
462 |
if(is_array($amazons3) && $amazons3['result'] === WPVIVID_FAILED)
|
463 |
return $amazons3;
|
464 |
foreach ($files as $file){
|
465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
}
|
467 |
return array('result' => WPVIVID_SUCCESS);
|
468 |
}
|
469 |
|
470 |
private function getS3()
|
471 |
{
|
472 |
-
$
|
473 |
-
if (preg_match("#^/*([^/]+)/(.*)$#", $path_temp, $bmatches))
|
474 |
{
|
475 |
-
$
|
476 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
$this->options['s3Path'] = '';
|
478 |
-
}else{
|
479 |
-
$this->options['s3Path'] = trailingslashit($bmatches[2]);
|
480 |
}
|
481 |
-
|
482 |
-
|
483 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
if($this->options['classMode'])
|
489 |
-
$amazons3 -> setStorageClass();
|
490 |
-
if($this->options['sse'])
|
491 |
-
$amazons3 -> setServerSideEncryption();
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
return
|
497 |
}
|
498 |
-
|
499 |
-
if(!empty($endpoint))
|
500 |
-
$amazons3 -> setEndpoint($endpoint);
|
501 |
-
return $amazons3;
|
502 |
}
|
503 |
private function getEndpoint($region){
|
504 |
switch ($region) {
|
@@ -506,6 +736,7 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
506 |
case 'eu-west-1':
|
507 |
$endpoint = 's3-eu-west-1.amazonaws.com';
|
508 |
break;
|
|
|
509 |
case 'us-east-1':
|
510 |
$endpoint = 's3.amazonaws.com';
|
511 |
break;
|
@@ -520,6 +751,7 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
520 |
case 'sa-east-1':
|
521 |
case 'ca-central-1':
|
522 |
case 'us-gov-west-1':
|
|
|
523 |
case 'eu-central-1':
|
524 |
$endpoint = 's3-'.$region.'.amazonaws.com';
|
525 |
break;
|
@@ -527,10 +759,13 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
527 |
$endpoint = 's3.'.$region.'.amazonaws.com';
|
528 |
break;
|
529 |
case 'ap-south-1':
|
|
|
|
|
530 |
case 'cn-north-1':
|
531 |
$endpoint = 's3.'.$region.'.amazonaws.com.cn';
|
532 |
break;
|
533 |
default:
|
|
|
534 |
break;
|
535 |
}
|
536 |
return $endpoint;
|
@@ -538,8 +773,10 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
538 |
|
539 |
public function wpvivid_get_out_of_date_amazons3($out_of_date_remote, $remote)
|
540 |
{
|
541 |
-
if($remote['type'] == WPVIVID_REMOTE_AMAZONS3)
|
542 |
-
|
|
|
|
|
543 |
}
|
544 |
return $out_of_date_remote;
|
545 |
}
|
17 |
private $upload_chunk_size = 5242880;
|
18 |
private $download_chunk_size = 5242880;
|
19 |
|
20 |
+
public $current_file_size;
|
21 |
+
public $current_file_name;
|
22 |
+
|
23 |
public function __construct($options=array())
|
24 |
{
|
25 |
if(empty($options))
|
58 |
}
|
59 |
?>
|
60 |
<div id="storage_account_amazons3" class="storage-account-page" style="display:none;">
|
61 |
+
<div style="padding: 0 10px 10px 0;">
|
62 |
+
<strong>Enter Your Amazon S3 Account</strong>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
</div>
|
64 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
65 |
+
<tbody>
|
66 |
+
<tr>
|
67 |
+
<td class="plugin-title column-primary">
|
68 |
+
<div class="wpvivid-storage-form">
|
69 |
+
<input type="text" class="regular-text" autocomplete="off" option="amazons3" name="name" placeholder="Enter a unique alias: e.g. Amazon S3-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
70 |
+
</div>
|
71 |
+
</td>
|
72 |
+
<td class="column-description desc">
|
73 |
+
<div class="wpvivid-storage-form-desc">
|
74 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
75 |
+
</div>
|
76 |
+
</td>
|
77 |
+
</tr>
|
78 |
+
<tr>
|
79 |
+
<td class="plugin-title column-primary">
|
80 |
+
<div class="wpvivid-storage-form">
|
81 |
+
<input type="text" class="regular-text" autocomplete="off" option="amazons3" name="access" placeholder="Amazon S3 access key" />
|
82 |
+
</div>
|
83 |
+
</td>
|
84 |
+
<td class="column-description desc">
|
85 |
+
<div class="wpvivid-storage-form-desc">
|
86 |
+
<i>Enter your Amazon S3 access key.</i><a href="https://wpvivid.com/get-amazon-access-secret-key.html" target="_blank"> How to get an AmazonS3 access key.</a>
|
87 |
+
</div>
|
88 |
+
</td>
|
89 |
+
</tr>
|
90 |
+
<tr>
|
91 |
+
<td class="plugin-title column-primary">
|
92 |
+
<div class="wpvivid-storage-form">
|
93 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="amazons3" name="secret" placeholder="Amazon S3 secret key" />
|
94 |
+
</div>
|
95 |
+
</td>
|
96 |
+
<td class="column-description desc">
|
97 |
+
<div class="wpvivid-storage-form-desc">
|
98 |
+
<i>Enter your Amazon S3 secret key.</i><a href="https://wpvivid.com/get-amazon-access-secret-key.html" target="_blank"> How to get an AmazonS3 secret key.</a>
|
99 |
+
</div>
|
100 |
+
</td>
|
101 |
+
</tr>
|
102 |
+
<tr>
|
103 |
+
<td class="plugin-title column-primary">
|
104 |
+
<div class="wpvivid-storage-form">
|
105 |
+
<input type="text" class="regular-text" autocomplete="off" option="amazons3" name="bucket" placeholder="Amazon S3 Bucket Name(e.g. test)" />
|
106 |
+
</div>
|
107 |
+
</td>
|
108 |
+
<td class="column-description desc">
|
109 |
+
<div class="wpvivid-storage-form-desc">
|
110 |
+
<i><span>Enter an existed Bucket to create a custom backup storage directory.</span></i>
|
111 |
+
</div>
|
112 |
+
</td>
|
113 |
+
</tr>
|
114 |
+
<tr>
|
115 |
+
<td class="plugin-title column-primary">
|
116 |
+
<div class="wpvivid-storage-form">
|
117 |
+
<input type="text" class="regular-text" autocomplete="off" option="amazons3" name="path" placeholder="Custom Path" />
|
118 |
+
</div>
|
119 |
+
</td>
|
120 |
+
<td class="column-description desc">
|
121 |
+
<div class="wpvivid-storage-form-desc">
|
122 |
+
<i><span>Customize the directory where you want to store backups within the Bucket.</span></i><a href="https://wpvivid.com/wpvivid-backup-pro-amason-s3-custom-folder-name?utm_source=client_amazon_s3&utm_medium=inner_link&utm_campaign=access">Create a directory for storing the backups of the site</a>
|
123 |
+
</div>
|
124 |
+
</td>
|
125 |
+
</tr>
|
126 |
+
<tr>
|
127 |
+
<td class="plugin-title column-primary">
|
128 |
+
<div class="wpvivid-storage-select">
|
129 |
+
<label>
|
130 |
+
<input type="checkbox" option="amazons3" name="default" checked />Set as the default remote storage.
|
131 |
+
</label>
|
132 |
+
</div>
|
133 |
+
</td>
|
134 |
+
<td class="column-description desc">
|
135 |
+
<div class="wpvivid-storage-form-desc">
|
136 |
+
<i>Once checked, all this sites backups sent to a remote storage destination will be uploaded to this storage by default.</i>
|
137 |
+
</div>
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
+
<tr>
|
141 |
+
<td class="plugin-title column-primary">
|
142 |
+
<div class="wpvivid-storage-select">
|
143 |
+
<label>
|
144 |
+
<input type="checkbox" option="amazons3" name="classMode" checked />Storage class: Standard (infrequent access).
|
145 |
+
</label>
|
146 |
+
</div>
|
147 |
+
</td>
|
148 |
+
<td class="column-description desc">
|
149 |
+
<div class="wpvivid-storage-form-desc">
|
150 |
+
<i>Check the option to use Amazon S3 Standard-Infrequent Access (S3 Standard-IA) storage class for data transfer.</i>
|
151 |
+
</div>
|
152 |
+
</td>
|
153 |
+
</tr>
|
154 |
+
<tr>
|
155 |
+
<td class="plugin-title column-primary">
|
156 |
+
<div class="wpvivid-storage-select">
|
157 |
+
<label>
|
158 |
+
<input type="checkbox" option="amazons3" name="sse" checked />Server-side encryption.
|
159 |
+
</label>
|
160 |
+
</div>
|
161 |
+
</td>
|
162 |
+
<td class="column-description desc">
|
163 |
+
<div class="wpvivid-storage-form-desc">
|
164 |
+
<i>Check the option to use Amazon S3 server-side encryption to protect data.</i>
|
165 |
+
</div>
|
166 |
+
</td>
|
167 |
+
</tr>
|
168 |
+
<tr>
|
169 |
+
<td class="plugin-title column-primary">
|
170 |
+
<div class="wpvivid-storage-form">
|
171 |
+
<input class="button-primary" option="add-remote" type="submit" value="Test and Add" />
|
172 |
+
</div>
|
173 |
+
</td>
|
174 |
+
<td class="column-description desc">
|
175 |
+
<div class="wpvivid-storage-form-desc">
|
176 |
+
<i>Click the button to connect to Amazon S3 storage and add it to the storage list below.</i>
|
177 |
+
</div>
|
178 |
+
</td>
|
179 |
+
</tr>
|
180 |
+
</tbody>
|
181 |
+
</table>
|
182 |
<?php
|
183 |
if($need_extension){
|
184 |
?>
|
186 |
<?php
|
187 |
}
|
188 |
?>
|
|
|
|
|
|
|
189 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
<?php
|
191 |
}
|
192 |
|
194 |
{
|
195 |
?>
|
196 |
<div id="remote_storage_edit_amazons3" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
197 |
+
<div style="padding: 0 10px 10px 0;">
|
198 |
+
<strong>Enter Your Amazon S3 Account</strong>
|
|
|
199 |
</div>
|
200 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
201 |
+
<tbody>
|
202 |
+
<tr>
|
203 |
+
<td class="plugin-title column-primary">
|
204 |
+
<div class="wpvivid-storage-form">
|
205 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-amazons3" name="name" placeholder="Enter a unique alias: e.g. Amazon S3-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
206 |
+
</div>
|
207 |
+
</td>
|
208 |
+
<td class="column-description desc">
|
209 |
+
<div class="wpvivid-storage-form-desc">
|
210 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
211 |
+
</div>
|
212 |
+
</td>
|
213 |
+
</tr>
|
214 |
+
<tr>
|
215 |
+
<td class="plugin-title column-primary">
|
216 |
+
<div class="wpvivid-storage-form">
|
217 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-amazons3" name="access" placeholder="Amazon S3 access key" />
|
218 |
+
</div>
|
219 |
+
</td>
|
220 |
+
<td class="column-description desc">
|
221 |
+
<div class="wpvivid-storage-form-desc">
|
222 |
+
<i>Enter your Amazon S3 access key</i><a href="https://wpvivid.com/get-amazon-access-secret-key.html" target="_blank"> How to get an AmazonS3 access key.</a>
|
223 |
+
</div>
|
224 |
+
</td>
|
225 |
+
</tr>
|
226 |
+
<tr>
|
227 |
+
<td class="plugin-title column-primary">
|
228 |
+
<div class="wpvivid-storage-form">
|
229 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="edit-amazons3" name="secret" placeholder="Amazon S3 secret key" />
|
230 |
+
</div>
|
231 |
+
</td>
|
232 |
+
<td class="column-description desc">
|
233 |
+
<div class="wpvivid-storage-form-desc">
|
234 |
+
<i>Enter your Amazon S3 secret key</i><a href="https://wpvivid.com/get-amazon-access-secret-key.html" target="_blank"> How to get an AmazonS3 secret key.</a>
|
235 |
+
</div>
|
236 |
+
</td>
|
237 |
+
</tr>
|
238 |
+
<tr>
|
239 |
+
<td class="plugin-title column-primary">
|
240 |
+
<div class="wpvivid-storage-form">
|
241 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-amazons3" name="bucket" placeholder="Amazon S3 Bucket Name(e.g. test)" />
|
242 |
+
</div>
|
243 |
+
</td>
|
244 |
+
<td class="column-description desc">
|
245 |
+
<div class="wpvivid-storage-form-desc">
|
246 |
+
<i><span>Enter an existed Bucket to create a custom backup storage directory.</span></i>
|
247 |
+
</div>
|
248 |
+
</td>
|
249 |
+
</tr>
|
250 |
+
<tr>
|
251 |
+
<td class="plugin-title column-primary">
|
252 |
+
<div class="wpvivid-storage-form">
|
253 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-amazons3" name="path" placeholder="Custom Path" />
|
254 |
+
</div>
|
255 |
+
</td>
|
256 |
+
<td class="column-description desc">
|
257 |
+
<div class="wpvivid-storage-form-desc">
|
258 |
+
<i><span>Customize the directory where you want to store backups within the Bucket.</span></i><a href="https://wpvivid.com/wpvivid-backup-pro-amason-s3-custom-folder-name?utm_source=client_amazon_s3&utm_medium=inner_link&utm_campaign=access">Create a directory for storing the backups of the site</a>
|
259 |
+
</div>
|
260 |
+
</td>
|
261 |
+
</tr>
|
262 |
+
<tr>
|
263 |
+
<td class="plugin-title column-primary">
|
264 |
+
<div class="wpvivid-storage-select">
|
265 |
+
<label>
|
266 |
+
<input type="checkbox" option="edit-amazons3" name="classMode" />Storage class: Standard (infrequent access).
|
267 |
+
</label>
|
268 |
+
</div>
|
269 |
+
</td>
|
270 |
+
<td class="column-description desc">
|
271 |
+
<div class="wpvivid-storage-form-desc">
|
272 |
+
<i>Check the option to use Amazon S3 Standard-Infrequent Access (S3 Standard-IA) storage class for data transfer.</i>
|
273 |
+
</div>
|
274 |
+
</td>
|
275 |
+
</tr>
|
276 |
+
<tr>
|
277 |
+
<td class="plugin-title column-primary">
|
278 |
+
<div class="wpvivid-storage-select">
|
279 |
+
<label>
|
280 |
+
<input type="checkbox" option="edit-amazons3" name="sse" />Server-side encryption.
|
281 |
+
</label>
|
282 |
+
</div>
|
283 |
+
</td>
|
284 |
+
<td class="column-description desc">
|
285 |
+
<div class="wpvivid-storage-form-desc">
|
286 |
+
<i>Check the option to use Amazon S3 server-side encryption to protect data.</i>
|
287 |
+
</div>
|
288 |
+
</td>
|
289 |
+
</tr>
|
290 |
+
<tr>
|
291 |
+
<td class="plugin-title column-primary">
|
292 |
+
<div class="wpvivid-storage-form">
|
293 |
+
<input class="button-primary" option="edit-remote" type="submit" value="Save Changes" />
|
294 |
+
</div>
|
295 |
+
</td>
|
296 |
+
<td class="column-description desc">
|
297 |
+
<div class="wpvivid-storage-form-desc">
|
298 |
+
<i>Click the button to save the changes.</i>
|
299 |
+
</div>
|
300 |
+
</td>
|
301 |
+
</tr>
|
302 |
+
</tbody>
|
303 |
+
</table>
|
304 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
<?php
|
306 |
}
|
307 |
|
314 |
|
315 |
public function test_connect()
|
316 |
{
|
317 |
+
$amazons3 = $this -> getS3();
|
318 |
+
if(is_array($amazons3) && $amazons3['result'] === WPVIVID_FAILED)
|
319 |
+
return $amazons3;
|
320 |
+
$temp_file = md5(rand());
|
321 |
+
try
|
322 |
+
{
|
323 |
+
if(isset($this->options['s3Path']))
|
324 |
+
{
|
325 |
+
$url=$this->options['s3Path'].$temp_file;
|
326 |
+
}
|
327 |
+
else
|
328 |
+
{
|
329 |
+
$url=$this->options['path'].'/'.$temp_file;
|
330 |
+
}
|
331 |
+
|
332 |
+
if(!$amazons3 -> putObjectString($temp_file,$this -> bucket,$url))
|
333 |
+
{
|
334 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, but create test file failed.');
|
335 |
}
|
336 |
+
if(!$amazons3 -> deleteObject($this -> bucket,$url))
|
337 |
+
{
|
338 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, and create test file succeed, but delete test file failed.');
|
339 |
}
|
340 |
+
}catch(Exception $e){
|
|
|
|
|
|
|
|
|
341 |
return array('result'=>WPVIVID_FAILED,'error'=>$e -> getMessage());
|
342 |
}
|
343 |
return array('result'=>WPVIVID_SUCCESS);
|
398 |
return $ret;
|
399 |
}
|
400 |
|
401 |
+
if(!isset($this->options['bucket']))
|
402 |
{
|
403 |
+
$ret['error']="Warning: A Bucket name is required.";
|
404 |
return $ret;
|
405 |
}
|
406 |
|
407 |
+
$this->options['bucket']=sanitize_text_field($this->options['bucket']);
|
408 |
|
409 |
+
if(empty($this->options['bucket']))
|
410 |
{
|
411 |
+
$ret['error']="Warning: A Bucket name is required.";
|
412 |
return $ret;
|
413 |
}
|
414 |
|
415 |
+
if(!isset($this->options['path']))
|
416 |
+
{
|
417 |
+
$ret['error']="Warning: A directory name is required.";
|
418 |
+
return $ret;
|
419 |
+
}
|
420 |
+
|
421 |
+
$this->options['path']=sanitize_text_field($this->options['path']);
|
422 |
+
|
423 |
+
if(empty($this->options['path'])){
|
424 |
+
$ret['error']="Warning: A directory name is required.";
|
425 |
+
return $ret;
|
426 |
+
}
|
427 |
|
428 |
$ret['result']=WPVIVID_SUCCESS;
|
429 |
$ret['options']=$this->options;
|
432 |
|
433 |
public function upload($task_id,$files,$callback='')
|
434 |
{
|
435 |
+
global $wpvivid_plugin;
|
436 |
$amazons3 = $this -> getS3();
|
437 |
+
|
438 |
if(is_array($amazons3) && $amazons3['result'] == WPVIVID_FAILED)
|
439 |
return $amazons3;
|
440 |
|
461 |
|
462 |
$this -> last_time = time();
|
463 |
$this -> last_size = 0;
|
464 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('Start uploading '.basename($file),'notice');
|
465 |
if(!file_exists($file))
|
466 |
return array('result' =>WPVIVID_FAILED,'error' =>$file.' not found. The file might has been moved, renamed or deleted. Please reload the list and verify the file exists.');
|
467 |
$result = $this -> _put($task_id,$amazons3,$file,$callback);
|
468 |
if($result['result'] !==WPVIVID_SUCCESS){
|
469 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('Uploading '.basename($file).' failed.','notice');
|
470 |
return $result;
|
471 |
}
|
472 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('Finished uploading '.basename($file),'notice');
|
473 |
}
|
474 |
return array('result' =>WPVIVID_SUCCESS);
|
475 |
}
|
476 |
private function _put($task_id,$amazons3,$file,$callback)
|
477 |
{
|
478 |
+
global $wpvivid_plugin;
|
479 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3);
|
480 |
$this -> current_file_size = filesize($file);
|
481 |
$this -> current_file_name = basename($file);
|
482 |
|
483 |
+
if(isset($this->options['s3Path']))
|
484 |
+
{
|
485 |
+
$url=$this->options['s3Path'].$this -> current_file_name;
|
486 |
+
}
|
487 |
+
else
|
488 |
+
{
|
489 |
+
$url=$this->options['path'].'/'.$this -> current_file_name;
|
490 |
+
}
|
491 |
+
$wpvivid_plugin->wpvivid_log->WriteLog($url,'notice');
|
492 |
+
|
493 |
$chunk_num = floor($this -> current_file_size / $this -> upload_chunk_size);
|
494 |
if($this -> current_file_size % $this -> upload_chunk_size > 0) $chunk_num ++;
|
495 |
|
498 |
try
|
499 |
{
|
500 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,WPVIVID_UPLOAD_UNDO,'Start uploading '.basename($file).'.',$upload_job['job_data']);
|
501 |
+
|
502 |
+
if(true)
|
503 |
{
|
504 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('Creating Multipart Upload.','notice');
|
505 |
if(!empty($upload_job['job_data'][basename($file)]['upload_id']))
|
506 |
{
|
507 |
$build_id = $upload_job['job_data'][basename($file)]['upload_id'];
|
508 |
}else{
|
509 |
+
$build_id = $amazons3 -> initiateMultipartUpload($this -> bucket,$url);
|
510 |
$upload_job['job_data'][basename($file)]['upload_id'] = $build_id;
|
511 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,WPVIVID_UPLOAD_UNDO,'InitiateMultipartUpload, created build id of '.basename($file).'.',$upload_job['job_data']);
|
512 |
}
|
521 |
|
522 |
for($i =sizeof($chunks);$i <$chunk_num;$i ++)
|
523 |
{
|
524 |
+
$chunk_id = $amazons3 -> uploadPart($this -> bucket,$url,$build_id,$file,$i+1,$this ->upload_chunk_size);
|
525 |
if(!$chunk_id){
|
526 |
$chunks = array();
|
527 |
$upload_job['job_data'][basename($file)]['upload_chunks'] = $chunks;
|
528 |
+
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX,WPVIVID_UPLOAD_UNDO,'Start multipartupload of '.basename($file).'.',$upload_job['job_data']);
|
529 |
return array('result' => WPVIVID_FAILED,'error' => 'upload '.$file.' failed.');
|
530 |
}
|
531 |
$chunks[] = $chunk_id;
|
544 |
$this -> last_time = time();
|
545 |
}
|
546 |
}
|
547 |
+
$result = $amazons3 -> completeMultipartUpload($this -> bucket,$url,$build_id,$chunks);
|
548 |
}else{
|
549 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('Uploaded files are less than 5M.','notice');
|
550 |
$input = $amazons3 -> inputFile($file);
|
551 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('putObject input:'.json_encode($input).' bucket:'.$this->bucket.' url:'.$url,'notice');
|
552 |
+
$result = $amazons3 -> putObject($input,$this ->bucket,$url);
|
553 |
+
$wpvivid_plugin->wpvivid_log->WriteLog('putObject end:'.$result,'notice');
|
554 |
}
|
555 |
}catch(Exception $e)
|
556 |
{
|
582 |
global $wpvivid_plugin;
|
583 |
$this->current_file_name = $file['file_name'];
|
584 |
$this->current_file_size = $file['size'];
|
|
|
585 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Get amazons3 client.','notice');
|
586 |
$amazons3 = $this->getS3();
|
587 |
if (is_array($amazons3) && $amazons3['result'] === WPVIVID_FAILED) {
|
588 |
return $amazons3;
|
589 |
}
|
590 |
+
if(isset($this->options['s3Path']))
|
591 |
+
{
|
592 |
+
$url=$this->options['s3Path']. $this -> current_file_name;
|
593 |
+
}
|
594 |
+
else
|
595 |
+
{
|
596 |
+
$url=$this->options['path'].'/'. $this -> current_file_name;
|
597 |
+
}
|
598 |
$file_path = trailingslashit($local_path) . $this->current_file_name;
|
599 |
$start_offset = file_exists($file_path) ? filesize($file_path) : 0;
|
600 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Create local file.','notice');
|
603 |
while ($start_offset < $this->current_file_size) {
|
604 |
$last_byte = min($start_offset + $this->download_chunk_size - 1, $this->current_file_size - 1);
|
605 |
$headers['Range'] = "bytes=$start_offset-$last_byte";
|
606 |
+
$response = $amazons3->getObject($this->bucket,$url, $fh, $headers['Range']);
|
607 |
if (!$response)
|
608 |
+
return array('result' => WPVIVID_FAILED, 'error' => 'download ' . $url. ' failed.');
|
609 |
clearstatcache();
|
610 |
$state = stat($file_path);
|
611 |
$start_offset = $state['size'];
|
654 |
if(is_array($amazons3) && $amazons3['result'] === WPVIVID_FAILED)
|
655 |
return $amazons3;
|
656 |
foreach ($files as $file){
|
657 |
+
|
658 |
+
if(isset($this->options['s3Path']))
|
659 |
+
{
|
660 |
+
$url=$this->options['s3Path'].$file;
|
661 |
+
}
|
662 |
+
else
|
663 |
+
{
|
664 |
+
$url=$this->options['path'].'/'.$file;
|
665 |
+
}
|
666 |
+
|
667 |
+
$amazons3 -> deleteObject($this -> bucket , $url);
|
668 |
}
|
669 |
return array('result' => WPVIVID_SUCCESS);
|
670 |
}
|
671 |
|
672 |
private function getS3()
|
673 |
{
|
674 |
+
if(isset($this->options['s3Path']))
|
|
|
675 |
{
|
676 |
+
$path_temp = str_replace('s3://','',$this->options['s3Path']);
|
677 |
+
if (preg_match("#^/*([^/]+)/(.*)$#", $path_temp, $bmatches))
|
678 |
+
{
|
679 |
+
$this->bucket = $bmatches[1];
|
680 |
+
if(empty($bmatches[2])){
|
681 |
+
$this->options['s3Path'] = '';
|
682 |
+
}else{
|
683 |
+
$this->options['s3Path'] = trailingslashit($bmatches[2]);
|
684 |
+
}
|
685 |
+
} else {
|
686 |
+
$this->bucket = $path_temp;
|
687 |
$this->options['s3Path'] = '';
|
|
|
|
|
688 |
}
|
689 |
+
$amazons3 = new WPvivid_Base_S3($this->options['access'],$this->options['secret']);
|
690 |
+
|
691 |
+
$amazons3 -> setExceptions();
|
692 |
+
if($this->options['classMode'])
|
693 |
+
$amazons3 -> setStorageClass();
|
694 |
+
if($this->options['sse'])
|
695 |
+
$amazons3 -> setServerSideEncryption();
|
696 |
+
|
697 |
+
try{
|
698 |
+
$region = $amazons3 -> getBucketLocation($this->bucket);
|
699 |
+
}catch(Exception $e){
|
700 |
+
return array('result' => WPVIVID_FAILED,'error' => $e -> getMessage());
|
701 |
+
}
|
702 |
+
$endpoint = $this -> getEndpoint($region);
|
703 |
+
if(!empty($endpoint))
|
704 |
+
$amazons3 -> setEndpoint($endpoint);
|
705 |
+
return $amazons3;
|
706 |
}
|
707 |
+
else
|
708 |
+
{
|
709 |
+
$this->bucket= $this->options['bucket'];
|
710 |
+
$amazons3 = new WPvivid_Base_S3($this->options['access'],$this->options['secret']);
|
711 |
+
$amazons3 -> setExceptions();
|
712 |
+
if($this->options['classMode'])
|
713 |
+
$amazons3 -> setStorageClass();
|
714 |
+
if($this->options['sse'])
|
715 |
+
$amazons3 -> setServerSideEncryption();
|
716 |
+
|
717 |
+
try{
|
718 |
+
$region = $amazons3 -> getBucketLocation($this->bucket);
|
719 |
+
}catch(Exception $e){
|
720 |
+
return array('result' => WPVIVID_FAILED,'error' => $e -> getMessage());
|
721 |
+
}
|
722 |
|
723 |
+
$amazons3->setSignatureVersion('v4');
|
724 |
+
$amazons3->setRegion($region);
|
|
|
|
|
|
|
|
|
725 |
|
726 |
+
$endpoint = $this -> getEndpoint($region);
|
727 |
+
if(!empty($endpoint))
|
728 |
+
$amazons3 -> setEndpoint($endpoint);
|
729 |
+
return $amazons3;
|
730 |
}
|
731 |
+
|
|
|
|
|
|
|
732 |
}
|
733 |
private function getEndpoint($region){
|
734 |
switch ($region) {
|
736 |
case 'eu-west-1':
|
737 |
$endpoint = 's3-eu-west-1.amazonaws.com';
|
738 |
break;
|
739 |
+
case 'US':
|
740 |
case 'us-east-1':
|
741 |
$endpoint = 's3.amazonaws.com';
|
742 |
break;
|
751 |
case 'sa-east-1':
|
752 |
case 'ca-central-1':
|
753 |
case 'us-gov-west-1':
|
754 |
+
case 'eu-north-1':
|
755 |
case 'eu-central-1':
|
756 |
$endpoint = 's3-'.$region.'.amazonaws.com';
|
757 |
break;
|
759 |
$endpoint = 's3.'.$region.'.amazonaws.com';
|
760 |
break;
|
761 |
case 'ap-south-1':
|
762 |
+
$endpoint = 's3.'.$region.'.amazonaws.com';
|
763 |
+
break;
|
764 |
case 'cn-north-1':
|
765 |
$endpoint = 's3.'.$region.'.amazonaws.com.cn';
|
766 |
break;
|
767 |
default:
|
768 |
+
$endpoint = 's3.amazonaws.com';
|
769 |
break;
|
770 |
}
|
771 |
return $endpoint;
|
773 |
|
774 |
public function wpvivid_get_out_of_date_amazons3($out_of_date_remote, $remote)
|
775 |
{
|
776 |
+
if($remote['type'] == WPVIVID_REMOTE_AMAZONS3)
|
777 |
+
{
|
778 |
+
if(isset($remote['s3Path']))
|
779 |
+
$out_of_date_remote = $remote['s3Path'];
|
780 |
}
|
781 |
return $out_of_date_remote;
|
782 |
}
|
includes/customclass/class-wpvivid-base-s3.php
CHANGED
@@ -8,6 +8,16 @@ include_once 'class-wpvivid-s3.php';
|
|
8 |
class WPvivid_Base_S3 extends Wpvivid_S3{
|
9 |
var $signVer = 'v2';
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
public function setServerSideEncryption($value = self::SSE_AES256) {
|
12 |
$this->_serverSideEncryption = $value;
|
13 |
}
|
@@ -177,4 +187,42 @@ class WPvivid_Base_S3 extends Wpvivid_S3{
|
|
177 |
return $rest->response;
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
8 |
class WPvivid_Base_S3 extends Wpvivid_S3{
|
9 |
var $signVer = 'v2';
|
10 |
|
11 |
+
/**
|
12 |
+
* Set Signature Version
|
13 |
+
*
|
14 |
+
* @param string $version
|
15 |
+
* @return void
|
16 |
+
*/
|
17 |
+
public function setSignatureVersion($version = 'v2') {
|
18 |
+
$this->signVer = $version;
|
19 |
+
}
|
20 |
+
|
21 |
public function setServerSideEncryption($value = self::SSE_AES256) {
|
22 |
$this->_serverSideEncryption = $value;
|
23 |
}
|
187 |
return $rest->response;
|
188 |
}
|
189 |
|
190 |
+
public function listObject($bucket, $path)
|
191 |
+
{
|
192 |
+
$rest = new WPvivid_S3Request('GET', $bucket, '', $this->endpoint, $this);
|
193 |
+
$rest->setParameter('prefix', $path);
|
194 |
+
//$rest->setParameter('delimiter', $path);
|
195 |
+
$response = $rest->getResponse();
|
196 |
+
if ($response->error === false && $response->code !== 200)
|
197 |
+
{
|
198 |
+
//$response->error = array('code' => $response->code, 'message' => 'Unexpected HTTP status');
|
199 |
+
$ret['result']='failed';
|
200 |
+
$ret['error']=$response['message'].' '.$response->code;
|
201 |
+
return $ret;
|
202 |
+
}
|
203 |
+
|
204 |
+
if ($response->error !== false)
|
205 |
+
{
|
206 |
+
$ret['result']='failed';
|
207 |
+
$ret['error']=sprintf("S3::getBucket(): [%s] %s", $response->error['code'], $response->error['message']);
|
208 |
+
return $ret;
|
209 |
+
}
|
210 |
+
|
211 |
+
$results = array();
|
212 |
+
|
213 |
+
if (isset($response->body, $response->body->Contents))
|
214 |
+
{
|
215 |
+
foreach ($response->body->Contents as $c)
|
216 |
+
{
|
217 |
+
$results[] = array(
|
218 |
+
'name' => (string)$c->Key,
|
219 |
+
'size' => (int)$c->Size,
|
220 |
+
);
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
$ret['result']='success';
|
225 |
+
$ret['data']=$results;
|
226 |
+
return $ret;
|
227 |
+
}
|
228 |
}
|
includes/customclass/class-wpvivid-dropbox.php
CHANGED
@@ -437,9 +437,72 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
437 |
<?php
|
438 |
}
|
439 |
public function wpvivid_add_storage_page_dropbox(){
|
|
|
440 |
?>
|
441 |
<div id="storage_account_dropbox" class="storage-account-page" style="display:none;">
|
442 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
<h2><span><?php _e( 'Enter Your Dropbox Information','wpvivid'); ?></span></h2>
|
444 |
<div class="storage-account-form">
|
445 |
<input type="text" autocomplete="off" option="dropbox" name="name" placeholder="Enter an unique alias: e.g. Dropbox-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
@@ -459,7 +522,7 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
459 |
<div id="wpvivid_storage_account_notice"></div>
|
460 |
<div class=""><input onclick="wpvivid_dropbox_auth()" class="button-primary storage-account-button" type="submit" value="<?php _e( 'Authenticate with Dropbox', 'wpvivid' ); ?>" /></div>
|
461 |
<div style="clear:both;"></div>
|
462 |
-
<div style="padding-left: 10px;">Tips: Click the button above to get Dropbox authentication and add it to the storage list below.</div
|
463 |
</div>
|
464 |
<script>
|
465 |
function wpvivid_check_dropbox_storage_alias(storage_alias){
|
@@ -516,13 +579,45 @@ class WPvivid_Dropbox extends WPvivid_Remote {
|
|
516 |
do_action('wpvivid_remote_storage_js');
|
517 |
?>
|
518 |
<div id="remote_storage_edit_dropbox" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
519 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
<div class="storage-account-form">
|
521 |
<input type="text" option="edit-dropbox" name="name" placeholder="Enter an unique alias: e.g. Dropbox-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
522 |
</div>
|
523 |
<div class=""><input onclick="wpvivid_dropbox_update_auth()" class="button-primary storage-account-button" type="button" value="<?php _e( 'Save Changes', 'wpvivid' ); ?>" /></div>
|
524 |
<div style="clear:both;"></div>
|
525 |
-
<div style="padding-left: 10px;">Tips: Get Dropbox authentication to change the alias.</div
|
526 |
</div>
|
527 |
<script>
|
528 |
function wpvivid_dropbox_update_auth()
|
437 |
<?php
|
438 |
}
|
439 |
public function wpvivid_add_storage_page_dropbox(){
|
440 |
+
$root_path=apply_filters('wpvivid_get_root_path', WPVIVID_REMOTE_DROPBOX);
|
441 |
?>
|
442 |
<div id="storage_account_dropbox" class="storage-account-page" style="display:none;">
|
443 |
+
<div style="background-color:#f1f1f1; padding: 10px;">Please read
|
444 |
+
<a target="_blank" href="https://wpvivid.com/privacy-policy">this privacy policy</a> for use of our Dropbox authorization app (none of your backup data is sent to us).
|
445 |
+
</div>
|
446 |
+
<div style="padding: 10px 10px 10px 0;">
|
447 |
+
<strong>Enter Your Dropbox Information</strong>
|
448 |
+
</div>
|
449 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
450 |
+
<tbody>
|
451 |
+
<tr>
|
452 |
+
<td class="plugin-title column-primary">
|
453 |
+
<div class="wpvivid-storage-form">
|
454 |
+
<input type="text" class="regular-text" autocomplete="off" option="dropbox" name="name" placeholder="Enter a unique alias: e.g. Dropbox-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
455 |
+
</div>
|
456 |
+
</td>
|
457 |
+
<td class="column-description desc">
|
458 |
+
<div class="wpvivid-storage-form-desc">
|
459 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
460 |
+
</div>
|
461 |
+
</td>
|
462 |
+
</tr>
|
463 |
+
<tr>
|
464 |
+
<td class="plugin-title column-primary">
|
465 |
+
<div class="wpvivid-storage-form">
|
466 |
+
<input type="text" class="regular-text" autocomplete="off" option="dropbox" name="path" value="<?php esc_attr_e($root_path.WPVIVID_DROPBOX_DEFAULT_FOLDER); ?>" readonly="readonly" />
|
467 |
+
</div>
|
468 |
+
</td>
|
469 |
+
<td class="column-description desc">
|
470 |
+
<div class="wpvivid-storage-form-desc">
|
471 |
+
<i style="margin-right: 10px;">All backups will be uploaded to this directory.</i><a href="https://wpvivid.com/wpvivid-backup-pro-dropbox-custom-folder-name?utm_source=client_dropbox&utm_medium=inner_link&utm_campaign=access">Create a directory for storing the backups of the site</a>
|
472 |
+
</div>
|
473 |
+
</td>
|
474 |
+
</tr>
|
475 |
+
<tr>
|
476 |
+
<td class="plugin-title column-primary">
|
477 |
+
<div class="wpvivid-storage-select">
|
478 |
+
<label>
|
479 |
+
<input type="checkbox" option="dropbox" name="default" checked />Set as the default remote storage.
|
480 |
+
</label>
|
481 |
+
</div>
|
482 |
+
</td>
|
483 |
+
<td class="column-description desc">
|
484 |
+
<div class="wpvivid-storage-form-desc">
|
485 |
+
<i>Once checked, all this sites backups sent to a remote storage destination will be uploaded to this storage by default.</i>
|
486 |
+
</div>
|
487 |
+
</td>
|
488 |
+
</tr>
|
489 |
+
<tr>
|
490 |
+
<td class="plugin-title column-primary">
|
491 |
+
<div class="wpvivid-storage-form">
|
492 |
+
<input onclick="wpvivid_dropbox_auth();" class="button-primary" type="submit" value="Authenticate with Dropbox">
|
493 |
+
</div>
|
494 |
+
</td>
|
495 |
+
<td class="column-description desc">
|
496 |
+
<div class="wpvivid-storage-form-desc">
|
497 |
+
<i>Click the button to get Dropbox authentication and add it to the storage list below.</i>
|
498 |
+
</div>
|
499 |
+
</td>
|
500 |
+
</tr>
|
501 |
+
</tbody>
|
502 |
+
</table>
|
503 |
+
|
504 |
+
|
505 |
+
<!--<p style="padding-left: 10px;">Please read <a target="_blank" href="https://wpvivid.com/privacy-policy">this privacy policy</a> for use of our Dropbox authorization app (none of your backup data is sent to us).</p>
|
506 |
<h2><span><?php _e( 'Enter Your Dropbox Information','wpvivid'); ?></span></h2>
|
507 |
<div class="storage-account-form">
|
508 |
<input type="text" autocomplete="off" option="dropbox" name="name" placeholder="Enter an unique alias: e.g. Dropbox-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
522 |
<div id="wpvivid_storage_account_notice"></div>
|
523 |
<div class=""><input onclick="wpvivid_dropbox_auth()" class="button-primary storage-account-button" type="submit" value="<?php _e( 'Authenticate with Dropbox', 'wpvivid' ); ?>" /></div>
|
524 |
<div style="clear:both;"></div>
|
525 |
+
<div style="padding-left: 10px;">Tips: Click the button above to get Dropbox authentication and add it to the storage list below.</div>-->
|
526 |
</div>
|
527 |
<script>
|
528 |
function wpvivid_check_dropbox_storage_alias(storage_alias){
|
579 |
do_action('wpvivid_remote_storage_js');
|
580 |
?>
|
581 |
<div id="remote_storage_edit_dropbox" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
582 |
+
<div style="padding: 0 10px 10px 0;">
|
583 |
+
<strong>Enter Your Dropbox Information</strong>
|
584 |
+
</div>
|
585 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
586 |
+
<tbody>
|
587 |
+
<tr>
|
588 |
+
<td class="plugin-title column-primary">
|
589 |
+
<div class="wpvivid-storage-form">
|
590 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-dropbox" name="name" placeholder="Enter a unique alias: e.g. Dropbox-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
591 |
+
</div>
|
592 |
+
</td>
|
593 |
+
<td class="column-description desc">
|
594 |
+
<div class="wpvivid-storage-form-desc">
|
595 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
596 |
+
</div>
|
597 |
+
</td>
|
598 |
+
</tr>
|
599 |
+
<tr>
|
600 |
+
<td class="plugin-title column-primary">
|
601 |
+
<div class="wpvivid-storage-form">
|
602 |
+
<input onclick="wpvivid_dropbox_update_auth();" class="button-primary" type="submit" value="Save Changes">
|
603 |
+
</div>
|
604 |
+
</td>
|
605 |
+
<td class="column-description desc">
|
606 |
+
<div class="wpvivid-storage-form-desc">
|
607 |
+
<i>Click the button to save the changes.</i>
|
608 |
+
</div>
|
609 |
+
</td>
|
610 |
+
</tr>
|
611 |
+
</tbody>
|
612 |
+
</table>
|
613 |
+
|
614 |
+
<!--<h2><span><?php _e( 'Enter an alias for Dropbox','wpvivid'); ?></span></h2>
|
615 |
<div class="storage-account-form">
|
616 |
<input type="text" option="edit-dropbox" name="name" placeholder="Enter an unique alias: e.g. Dropbox-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
617 |
</div>
|
618 |
<div class=""><input onclick="wpvivid_dropbox_update_auth()" class="button-primary storage-account-button" type="button" value="<?php _e( 'Save Changes', 'wpvivid' ); ?>" /></div>
|
619 |
<div style="clear:both;"></div>
|
620 |
+
<div style="padding-left: 10px;">Tips: Get Dropbox authentication to change the alias.</div>-->
|
621 |
</div>
|
622 |
<script>
|
623 |
function wpvivid_dropbox_update_auth()
|
includes/customclass/class-wpvivid-ftpclass.php
CHANGED
@@ -42,34 +42,111 @@ class WPvivid_FTPClass extends WPvivid_Remote{
|
|
42 |
{
|
43 |
?>
|
44 |
<div id="storage_account_ftp" class="storage-account-page" style="display:none;">
|
45 |
-
<
|
46 |
-
<
|
47 |
-
<
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</div>
|
74 |
<?php
|
75 |
}
|
@@ -78,28 +155,97 @@ class WPvivid_FTPClass extends WPvivid_Remote{
|
|
78 |
{
|
79 |
?>
|
80 |
<div id="remote_storage_edit_ftp" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
81 |
-
<
|
82 |
-
<
|
83 |
-
<
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
</div>
|
104 |
<?php
|
105 |
}
|
42 |
{
|
43 |
?>
|
44 |
<div id="storage_account_ftp" class="storage-account-page" style="display:none;">
|
45 |
+
<div style="padding: 0 10px 10px 0;"><strong>Enter Your FTP Account</strong></div>
|
46 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
47 |
+
<tbody>
|
48 |
+
<tr>
|
49 |
+
<td class="plugin-title column-primary">
|
50 |
+
<div class="wpvivid-storage-form">
|
51 |
+
<input type="text" autocomplete="off" option="ftp" name="name" placeholder="Enter an unique alias: e.g. FTP-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
52 |
+
</div>
|
53 |
+
</td>
|
54 |
+
<td class="column-description desc">
|
55 |
+
<div class="wpvivid-storage-form-desc">
|
56 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
57 |
+
</div>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<tr>
|
61 |
+
<td class="plugin-title column-primary">
|
62 |
+
<div class="wpvivid-storage-form">
|
63 |
+
<input type="text" autocomplete="off" option="ftp" name="server" placeholder="FTP server (server's port 21)" class="regular-text"/>
|
64 |
+
</div>
|
65 |
+
</td>
|
66 |
+
<td class="column-description desc">
|
67 |
+
<div class="wpvivid-storage-form-desc">
|
68 |
+
<i style="margin-right: 10px;">Enter the FTP server.</i><a href="https://wpvivid.com/wpvivid-backup-pro-ftp-change-ftp-default-port?utm_source=client_ftp_port&utm_medium=inner_link&utm_campaign=access">Change the FTP default port number</a>
|
69 |
+
</div>
|
70 |
+
</td>
|
71 |
+
</tr>
|
72 |
+
<tr>
|
73 |
+
<td class="plugin-title column-primary">
|
74 |
+
<div class="wpvivid-storage-form">
|
75 |
+
<input type="text" class="regular-text" autocomplete="off" option="ftp" name="username" placeholder="FTP login" />
|
76 |
+
</div>
|
77 |
+
</td>
|
78 |
+
<td class="column-description desc">
|
79 |
+
<div class="wpvivid-storage-form-desc">
|
80 |
+
<i>Enter your FTP server user name.</i>
|
81 |
+
</div>
|
82 |
+
</td>
|
83 |
+
</tr>
|
84 |
+
<tr>
|
85 |
+
<td class="plugin-title column-primary">
|
86 |
+
<div class="wpvivid-storage-form">
|
87 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="ftp" name="password" placeholder="FTP password" />
|
88 |
+
</div>
|
89 |
+
</td>
|
90 |
+
<td class="column-description desc">
|
91 |
+
<div class="wpvivid-storage-form-desc">
|
92 |
+
<i>Enter the FTP server password.</i>
|
93 |
+
</div>
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
<tr>
|
97 |
+
<td class="plugin-title column-primary">
|
98 |
+
<div class="wpvivid-storage-form">
|
99 |
+
<input type="text" autocomplete="off" option="ftp" name="path" placeholder="Absolute path must exist(e.g. /home/username)" class="regular-text"/>
|
100 |
+
</div>
|
101 |
+
</td>
|
102 |
+
<td class="column-description desc">
|
103 |
+
<div class="wpvivid-storage-form-desc">
|
104 |
+
<i>Enter an absolute path and a custom subdirectory (optional) for holding the backups of current website. For example, /home/username/customfolder</i>
|
105 |
+
</div>
|
106 |
+
</td>
|
107 |
+
</tr>
|
108 |
+
<tr>
|
109 |
+
<td class="plugin-title column-primary">
|
110 |
+
<div class="wpvivid-storage-select">
|
111 |
+
<label>
|
112 |
+
<input type="checkbox" option="ftp" name="default" checked />Set as the default remote storage.
|
113 |
+
</label>
|
114 |
+
</div>
|
115 |
+
</td>
|
116 |
+
<td class="column-description desc">
|
117 |
+
<div class="wpvivid-storage-form-desc">
|
118 |
+
<i>Once checked, all this sites backups sent to a remote storage destination will be uploaded to this storage by default.</i>
|
119 |
+
</div>
|
120 |
+
</td>
|
121 |
+
</tr>
|
122 |
+
<tr>
|
123 |
+
<td class="plugin-title column-primary">
|
124 |
+
<div class="wpvivid-storage-select">
|
125 |
+
<label>
|
126 |
+
<input type="checkbox" option="ftp" name="passive" checked />Uncheck this to enable FTP active mode.
|
127 |
+
</label>
|
128 |
+
</div>
|
129 |
+
</td>
|
130 |
+
<td class="column-description desc">
|
131 |
+
<div class="wpvivid-storage-form-desc">
|
132 |
+
<i>Uncheck the option to use FTP active mode when transferring files. Make sure the FTP server you are configuring supports the active FTP mode.</i>
|
133 |
+
</div>
|
134 |
+
</td>
|
135 |
+
</tr>
|
136 |
+
<tr>
|
137 |
+
<td class="plugin-title column-primary">
|
138 |
+
<div class="wpvivid-storage-form">
|
139 |
+
<input class="button-primary" type="submit" option="add-remote" value="Test and Add">
|
140 |
+
</div>
|
141 |
+
</td>
|
142 |
+
<td class="column-description desc">
|
143 |
+
<div class="wpvivid-storage-form-desc">
|
144 |
+
<i>Click the button to connect to FTP server and add it to the storage list below.</i>
|
145 |
+
</div>
|
146 |
+
</td>
|
147 |
+
</tr>
|
148 |
+
</tbody>
|
149 |
+
</table>
|
150 |
</div>
|
151 |
<?php
|
152 |
}
|
155 |
{
|
156 |
?>
|
157 |
<div id="remote_storage_edit_ftp" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
158 |
+
<div style="padding: 0 10px 10px 0;"><strong>Enter Your FTP Account</strong></div>
|
159 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
160 |
+
<tbody>
|
161 |
+
<tr>
|
162 |
+
<td class="plugin-title column-primary">
|
163 |
+
<div class="wpvivid-storage-form">
|
164 |
+
<input type="text" autocomplete="off" option="edit-ftp" name="name" placeholder="Enter an unique alias: e.g. FTP-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
165 |
+
</div>
|
166 |
+
</td>
|
167 |
+
<td class="column-description desc">
|
168 |
+
<div class="wpvivid-storage-form-desc">
|
169 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
170 |
+
</div>
|
171 |
+
</td>
|
172 |
+
</tr>
|
173 |
+
<tr>
|
174 |
+
<td class="plugin-title column-primary">
|
175 |
+
<div class="wpvivid-storage-form">
|
176 |
+
<input type="text" autocomplete="off" option="edit-ftp" name="server" placeholder="FTP server (server's port 21)" class="regular-text"/>
|
177 |
+
</div>
|
178 |
+
</td>
|
179 |
+
<td class="column-description desc">
|
180 |
+
<div class="wpvivid-storage-form-desc">
|
181 |
+
<i style="margin-right: 10px;">Enter the FTP server.</i><a href="https://wpvivid.com/wpvivid-backup-pro-ftp-change-ftp-default-port?utm_source=client_ftp_port&utm_medium=inner_link&utm_campaign=access">Change the FTP default port number</a>
|
182 |
+
</div>
|
183 |
+
</td>
|
184 |
+
</tr>
|
185 |
+
<tr>
|
186 |
+
<td class="plugin-title column-primary">
|
187 |
+
<div class="wpvivid-storage-form">
|
188 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-ftp" name="username" placeholder="FTP login" />
|
189 |
+
</div>
|
190 |
+
</td>
|
191 |
+
<td class="column-description desc">
|
192 |
+
<div class="wpvivid-storage-form-desc">
|
193 |
+
<i>Enter your FTP server user name.</i>
|
194 |
+
</div>
|
195 |
+
</td>
|
196 |
+
</tr>
|
197 |
+
<tr>
|
198 |
+
<td class="plugin-title column-primary">
|
199 |
+
<div class="wpvivid-storage-form">
|
200 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="edit-ftp" name="password" placeholder="FTP password" />
|
201 |
+
</div>
|
202 |
+
</td>
|
203 |
+
<td class="column-description desc">
|
204 |
+
<div class="wpvivid-storage-form-desc">
|
205 |
+
<i>Enter the FTP server password.</i>
|
206 |
+
</div>
|
207 |
+
</td>
|
208 |
+
</tr>
|
209 |
+
<tr>
|
210 |
+
<td class="plugin-title column-primary">
|
211 |
+
<div class="wpvivid-storage-form">
|
212 |
+
<input type="text" autocomplete="off" option="edit-ftp" name="path" placeholder="Absolute path must exist(e.g. /home/username)" class="regular-text"/>
|
213 |
+
</div>
|
214 |
+
</td>
|
215 |
+
<td class="column-description desc">
|
216 |
+
<div class="wpvivid-storage-form-desc">
|
217 |
+
<i>Enter an absolute path and a custom subdirectory (optional) for holding the backups of current website. For example, /home/username/customfolder</i>
|
218 |
+
</div>
|
219 |
+
</td>
|
220 |
+
</tr>
|
221 |
+
<tr>
|
222 |
+
<td class="plugin-title column-primary">
|
223 |
+
<div class="wpvivid-storage-select">
|
224 |
+
<label>
|
225 |
+
<input type="checkbox" option="edit-ftp" name="passive" checked />Uncheck this to enable FTP active mode.
|
226 |
+
</label>
|
227 |
+
</div>
|
228 |
+
</td>
|
229 |
+
<td class="column-description desc">
|
230 |
+
<div class="wpvivid-storage-form-desc">
|
231 |
+
<i>Uncheck the option to use FTP active mode when transferring files. Make sure the FTP server you are configuring supports the active FTP mode.</i>
|
232 |
+
</div>
|
233 |
+
</td>
|
234 |
+
</tr>
|
235 |
+
<tr>
|
236 |
+
<td class="plugin-title column-primary">
|
237 |
+
<div class="wpvivid-storage-form">
|
238 |
+
<input class="button-primary" type="submit" option="edit-remote" value="Save Changes">
|
239 |
+
</div>
|
240 |
+
</td>
|
241 |
+
<td class="column-description desc">
|
242 |
+
<div class="wpvivid-storage-form-desc">
|
243 |
+
<i>Click the button to save the changes.</i>
|
244 |
+
</div>
|
245 |
+
</td>
|
246 |
+
</tr>
|
247 |
+
</tbody>
|
248 |
+
</table>
|
249 |
</div>
|
250 |
<?php
|
251 |
}
|
includes/customclass/class-wpvivid-google-drive.php
CHANGED
@@ -296,29 +296,69 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
296 |
|
297 |
public function wpvivid_add_storage_page_google_drive()
|
298 |
{
|
|
|
299 |
?>
|
300 |
<div id="storage_account_google_drive" class="storage-account-page">
|
301 |
-
<
|
302 |
-
|
303 |
-
<div class="storage-account-form">
|
304 |
-
<input type="text" autocomplete="off" option="googledrive" name="name" placeholder="Enter an unique alias: e.g. Google Drive-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
305 |
</div>
|
306 |
-
<div style="padding
|
307 |
-
<
|
308 |
-
$root_path=apply_filters('wpvivid_get_root_path', WPVIVID_REMOTE_GOOGLEDRIVE);
|
309 |
-
_e($root_path.WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER); ?>
|
310 |
-
</span></p>
|
311 |
-
<p><?php _e('All backups will be uploaded to this directory.', 'wpvivid'); ?></p>
|
312 |
</div>
|
313 |
-
<
|
314 |
-
<
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
</div>
|
323 |
<script>
|
324 |
function wpvivid_check_google_drive_storage_alias(storage_alias){
|
@@ -378,13 +418,37 @@ class Wpvivid_Google_drive extends WPvivid_Remote
|
|
378 |
{
|
379 |
?>
|
380 |
<div id="remote_storage_edit_googledrive" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
381 |
-
<
|
382 |
-
|
383 |
-
<input type="text" option="edit-googledrive" name="name" placeholder="Enter an unique alias: e.g. Google Drive-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
384 |
</div>
|
385 |
-
<
|
386 |
-
|
387 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
</div>
|
389 |
<script>
|
390 |
function wpvivid_google_drive_update_auth()
|
296 |
|
297 |
public function wpvivid_add_storage_page_google_drive()
|
298 |
{
|
299 |
+
$root_path=apply_filters('wpvivid_get_root_path', WPVIVID_REMOTE_GOOGLEDRIVE);
|
300 |
?>
|
301 |
<div id="storage_account_google_drive" class="storage-account-page">
|
302 |
+
<div style="background-color:#f1f1f1; padding: 10px;">Please read
|
303 |
+
<a target="_blank" href="https://wpvivid.com/privacy-policy">this privacy policy</a> for use of our Google Drive authorization app (none of your backup data is sent to us).
|
|
|
|
|
304 |
</div>
|
305 |
+
<div style="padding: 10px 10px 10px 0;">
|
306 |
+
<strong>Enter Your Google Drive Information</strong>
|
|
|
|
|
|
|
|
|
307 |
</div>
|
308 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
309 |
+
<tbody>
|
310 |
+
<tr>
|
311 |
+
<td class="plugin-title column-primary">
|
312 |
+
<div class="wpvivid-storage-form">
|
313 |
+
<input type="text" class="regular-text" autocomplete="off" option="googledrive" name="name" placeholder="Enter a unique alias: e.g. Google Drive-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
314 |
+
</div>
|
315 |
+
</td>
|
316 |
+
<td class="column-description desc">
|
317 |
+
<div class="wpvivid-storage-form-desc">
|
318 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
319 |
+
</div>
|
320 |
+
</td>
|
321 |
+
</tr>
|
322 |
+
<tr>
|
323 |
+
<td class="plugin-title column-primary">
|
324 |
+
<div class="wpvivid-storage-form">
|
325 |
+
<input type="text" class="regular-text" autocomplete="off" option="googledrive" name="path" value="<?php esc_attr_e($root_path.WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER); ?>" readonly="readonly" />
|
326 |
+
</div>
|
327 |
+
</td>
|
328 |
+
<td class="column-description desc">
|
329 |
+
<div class="wpvivid-storage-form-desc">
|
330 |
+
<i style="margin-right: 10px;">All backups will be uploaded to this directory.</i><a href="https://wpvivid.com/wpvivid-backup-pro-google-drive-custom-folder-name?utm_source=client_google_drive&utm_medium=inner_link&utm_campaign=access">Create a directory for storing the backups of the site</a>
|
331 |
+
</div>
|
332 |
+
</td>
|
333 |
+
</tr>
|
334 |
+
<tr>
|
335 |
+
<td class="plugin-title column-primary">
|
336 |
+
<div class="wpvivid-storage-select">
|
337 |
+
<label>
|
338 |
+
<input type="checkbox" option="googledrive" name="default" checked />Set as the default remote storage.
|
339 |
+
</label>
|
340 |
+
</div>
|
341 |
+
</td>
|
342 |
+
<td class="column-description desc">
|
343 |
+
<div class="wpvivid-storage-form-desc">
|
344 |
+
<i>Once checked, all this sites backups sent to a remote storage destination will be uploaded to this storage by default.</i>
|
345 |
+
</div>
|
346 |
+
</td>
|
347 |
+
</tr>
|
348 |
+
<tr>
|
349 |
+
<td class="plugin-title column-primary">
|
350 |
+
<div class="wpvivid-storage-form">
|
351 |
+
<input onclick="wpvivid_google_drive_auth();" class="button-primary" type="submit" value="Authenticate with Google Drive" />
|
352 |
+
</div>
|
353 |
+
</td>
|
354 |
+
<td class="column-description desc">
|
355 |
+
<div class="wpvivid-storage-form-desc">
|
356 |
+
<i>Click the button to get Google authentication and add it to the storage list below.</i>
|
357 |
+
</div>
|
358 |
+
</td>
|
359 |
+
</tr>
|
360 |
+
</tbody>
|
361 |
+
</table>
|
362 |
</div>
|
363 |
<script>
|
364 |
function wpvivid_check_google_drive_storage_alias(storage_alias){
|
418 |
{
|
419 |
?>
|
420 |
<div id="remote_storage_edit_googledrive" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
421 |
+
<div style="padding: 0 10px 10px 0;">
|
422 |
+
<strong>Enter Your Google Drive Information</strong>
|
|
|
423 |
</div>
|
424 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
425 |
+
<tbody>
|
426 |
+
<tr>
|
427 |
+
<td class="plugin-title column-primary">
|
428 |
+
<div class="wpvivid-storage-form">
|
429 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-googledrive" name="name" placeholder="Enter a unique alias: e.g. Google Drive-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
430 |
+
</div>
|
431 |
+
</td>
|
432 |
+
<td class="column-description desc">
|
433 |
+
<div class="wpvivid-storage-form-desc">
|
434 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
435 |
+
</div>
|
436 |
+
</td>
|
437 |
+
</tr>
|
438 |
+
<tr>
|
439 |
+
<td class="plugin-title column-primary">
|
440 |
+
<div class="wpvivid-storage-form">
|
441 |
+
<input onclick="wpvivid_google_drive_update_auth();" class="button-primary" type="submit" value="Save Changes" />
|
442 |
+
</div>
|
443 |
+
</td>
|
444 |
+
<td class="column-description desc">
|
445 |
+
<div class="wpvivid-storage-form-desc">
|
446 |
+
<i>Click the button to save the changes.</i>
|
447 |
+
</div>
|
448 |
+
</td>
|
449 |
+
</tr>
|
450 |
+
</tbody>
|
451 |
+
</table>
|
452 |
</div>
|
453 |
<script>
|
454 |
function wpvivid_google_drive_update_auth()
|
includes/customclass/class-wpvivid-one-drive.php
CHANGED
@@ -280,29 +280,69 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
280 |
|
281 |
public function wpvivid_add_storage_page_one_drive()
|
282 |
{
|
|
|
283 |
?>
|
284 |
<div id="storage_account_one_drive" class="storage-account-page" style="display:none;">
|
285 |
-
<
|
286 |
-
|
287 |
-
<div class="storage-account-form">
|
288 |
-
<input type="text" autocomplete="off" option="one_drive" name="name" placeholder="Enter an unique alias: e.g. OneDrive-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
289 |
-
</div>
|
290 |
-
<div style="padding-left: 10px; margin-bottom: -16px;">
|
291 |
-
<p><span><?php _e( 'Microsoft OneDrive Folder:','wpvivid'); ?></span><span option="one_drive" name="path"><?php
|
292 |
-
$root_path=apply_filters('wpvivid_get_root_path', WPVIVID_REMOTE_ONEDRIVE);
|
293 |
-
_e($root_path.WPVIVID_ONEDRIVE_DEFAULT_FOLDER); ?>
|
294 |
-
</span></p>
|
295 |
-
<p><?php _e('All backups will be uploaded to this directory.', 'wpvivid'); ?></p>
|
296 |
</div>
|
297 |
-
<div
|
298 |
-
<
|
299 |
-
<input type="checkbox" option="one_drive" name="default" checked /><?php _e('Set as the default remote storage.', 'wpvivid'); ?>
|
300 |
-
</label>
|
301 |
</div>
|
302 |
-
<
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
</div>
|
307 |
<script>
|
308 |
function wpvivid_check_onedrive_storage_alias(storage_alias){
|
@@ -362,13 +402,45 @@ class WPvivid_one_drive extends WPvivid_Remote
|
|
362 |
{
|
363 |
?>
|
364 |
<div id="remote_storage_edit_onedrive" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
365 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
<div class="storage-account-form">
|
367 |
<input type="text" option="edit-onedrive" name="name" placeholder="Enter an unique alias: e.g. OneDrive-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
368 |
</div>
|
369 |
<div class=""><input onclick="wpvivid_one_drive_update_auth()" class="button-primary storage-account-button" type="button" value="<?php _e( 'Save Changes', 'wpvivid' ); ?>" /></div>
|
370 |
<div style="clear:both;"></div>
|
371 |
-
<div style="padding-left: 10px;">Tips: Get Microsoft authentication to change the alias.</div
|
372 |
</div>
|
373 |
<script>
|
374 |
function wpvivid_one_drive_update_auth()
|
280 |
|
281 |
public function wpvivid_add_storage_page_one_drive()
|
282 |
{
|
283 |
+
$root_path=apply_filters('wpvivid_get_root_path', WPVIVID_REMOTE_ONEDRIVE);
|
284 |
?>
|
285 |
<div id="storage_account_one_drive" class="storage-account-page" style="display:none;">
|
286 |
+
<div style="background-color:#f1f1f1; padding: 10px;">Please read
|
287 |
+
<a target="_blank" href="https://wpvivid.com/privacy-policy">this privacy policy</a> for use of our Microsoft OneDrive authorization app (none of your backup data is sent to us).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
</div>
|
289 |
+
<div style="padding: 10px 10px 10px 0;">
|
290 |
+
<strong>Enter Your Microsoft OneDrive Information</strong>
|
|
|
|
|
291 |
</div>
|
292 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
293 |
+
<tbody>
|
294 |
+
<tr>
|
295 |
+
<td class="plugin-title column-primary">
|
296 |
+
<div class="wpvivid-storage-form">
|
297 |
+
<input type="text" class="regular-text" autocomplete="off" option="one_drive" name="name" placeholder="Enter a unique alias: e.g. OneDrive-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
298 |
+
</div>
|
299 |
+
</td>
|
300 |
+
<td class="column-description desc">
|
301 |
+
<div class="wpvivid-storage-form-desc">
|
302 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
303 |
+
</div>
|
304 |
+
</td>
|
305 |
+
</tr>
|
306 |
+
<tr>
|
307 |
+
<td class="plugin-title column-primary">
|
308 |
+
<div class="wpvivid-storage-form">
|
309 |
+
<input type="text" class="regular-text" autocomplete="off" option="one_drive" name="path" value="<?php esc_attr_e($root_path.WPVIVID_ONEDRIVE_DEFAULT_FOLDER); ?>" readonly="readonly" />
|
310 |
+
</div>
|
311 |
+
</td>
|
312 |
+
<td class="column-description desc">
|
313 |
+
<div class="wpvivid-storage-form-desc">
|
314 |
+
<i style="margin-right: 10px;">All backups will be uploaded to this directory.</i><a href="https://wpvivid.com/wpvivid-backup-pro-microsoft-onedrive-custom-folder-name?utm_source=client_onedrive&utm_medium=inner_link&utm_campaign=access">Create a directory for storing the backups of the site</a>
|
315 |
+
</div>
|
316 |
+
</td>
|
317 |
+
</tr>
|
318 |
+
<tr>
|
319 |
+
<td class="plugin-title column-primary">
|
320 |
+
<div class="wpvivid-storage-select">
|
321 |
+
<label>
|
322 |
+
<input type="checkbox" option="one_drive" name="default" checked />Set as the default remote storage.
|
323 |
+
</label>
|
324 |
+
</div>
|
325 |
+
</td>
|
326 |
+
<td class="column-description desc">
|
327 |
+
<div class="wpvivid-storage-form-desc">
|
328 |
+
<i>Once checked, all this sites backups sent to a remote storage destination will be uploaded to this storage by default.</i>
|
329 |
+
</div>
|
330 |
+
</td>
|
331 |
+
</tr>
|
332 |
+
<tr>
|
333 |
+
<td class="plugin-title column-primary">
|
334 |
+
<div class="wpvivid-storage-form">
|
335 |
+
<input onclick="wpvivid_one_drive_auth();" class="button-primary" type="submit" value="Authenticate with Microsoft OneDrive">
|
336 |
+
</div>
|
337 |
+
</td>
|
338 |
+
<td class="column-description desc">
|
339 |
+
<div class="wpvivid-storage-form-desc">
|
340 |
+
<i>Click the button to get Microsoft authentication and add it to the storage list below.</i>
|
341 |
+
</div>
|
342 |
+
</td>
|
343 |
+
</tr>
|
344 |
+
</tbody>
|
345 |
+
</table>
|
346 |
</div>
|
347 |
<script>
|
348 |
function wpvivid_check_onedrive_storage_alias(storage_alias){
|
402 |
{
|
403 |
?>
|
404 |
<div id="remote_storage_edit_onedrive" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
405 |
+
<div style="padding: 0 10px 10px 0;">
|
406 |
+
<strong>Enter Your Microsoft OneDrive Information</strong>
|
407 |
+
</div>
|
408 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
409 |
+
<tbody>
|
410 |
+
<tr>
|
411 |
+
<td class="plugin-title column-primary">
|
412 |
+
<div class="wpvivid-storage-form">
|
413 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-onedrive" name="name" placeholder="Enter a unique alias: e.g. OneDrive-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
414 |
+
</div>
|
415 |
+
</td>
|
416 |
+
<td class="column-description desc">
|
417 |
+
<div class="wpvivid-storage-form-desc">
|
418 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
419 |
+
</div>
|
420 |
+
</td>
|
421 |
+
</tr>
|
422 |
+
<tr>
|
423 |
+
<td class="plugin-title column-primary">
|
424 |
+
<div class="wpvivid-storage-form">
|
425 |
+
<input onclick="wpvivid_one_drive_update_auth();" class="button-primary" type="submit" value="Save Changes">
|
426 |
+
</div>
|
427 |
+
</td>
|
428 |
+
<td class="column-description desc">
|
429 |
+
<div class="wpvivid-storage-form-desc">
|
430 |
+
<i>Click the button to save the changes.</i>
|
431 |
+
</div>
|
432 |
+
</td>
|
433 |
+
</tr>
|
434 |
+
</tbody>
|
435 |
+
</table>
|
436 |
+
|
437 |
+
<!--<h2><span><?php _e( 'Enter an alias for Microsoft OneDrive','wpvivid'); ?></span></h2>
|
438 |
<div class="storage-account-form">
|
439 |
<input type="text" option="edit-onedrive" name="name" placeholder="Enter an unique alias: e.g. OneDrive-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
440 |
</div>
|
441 |
<div class=""><input onclick="wpvivid_one_drive_update_auth()" class="button-primary storage-account-button" type="button" value="<?php _e( 'Save Changes', 'wpvivid' ); ?>" /></div>
|
442 |
<div style="clear:both;"></div>
|
443 |
+
<div style="padding-left: 10px;">Tips: Get Microsoft authentication to change the alias.</div>-->
|
444 |
</div>
|
445 |
<script>
|
446 |
function wpvivid_one_drive_update_auth()
|
includes/customclass/class-wpvivid-s3.php
CHANGED
@@ -205,12 +205,14 @@ class WPvivid_S3
|
|
205 |
* @param string $endpoint Amazon URI
|
206 |
* @return void
|
207 |
*/
|
|
|
208 |
public function __construct($accessKey = null, $secretKey = null, $useSSL = false, $endpoint = 's3.amazonaws.com')
|
209 |
{
|
210 |
if ($accessKey !== null && $secretKey !== null)
|
211 |
$this -> setAuth($accessKey, $secretKey);
|
212 |
$this -> useSSL = $useSSL;
|
213 |
$this -> endpoint = $endpoint;
|
|
|
214 |
}
|
215 |
|
216 |
|
@@ -225,6 +227,25 @@ class WPvivid_S3
|
|
225 |
$this -> endpoint = $host;
|
226 |
}
|
227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
/**
|
230 |
* Set AWS access key and secret key
|
@@ -1017,7 +1038,7 @@ class WPvivid_S3
|
|
1017 |
$rest->error['code'], $rest->error['message']), __FILE__, __LINE__);
|
1018 |
return false;
|
1019 |
}
|
1020 |
-
return (isset($rest->body[0]) && (string)$rest->body[0] !== '') ? (string)$rest->body[0] : '
|
1021 |
}
|
1022 |
|
1023 |
|
@@ -1912,6 +1933,117 @@ class WPvivid_S3
|
|
1912 |
(str_repeat(chr(0x36), 64))) . $string)))));
|
1913 |
}
|
1914 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1915 |
}
|
1916 |
|
1917 |
/**
|
205 |
* @param string $endpoint Amazon URI
|
206 |
* @return void
|
207 |
*/
|
208 |
+
var $region;
|
209 |
public function __construct($accessKey = null, $secretKey = null, $useSSL = false, $endpoint = 's3.amazonaws.com')
|
210 |
{
|
211 |
if ($accessKey !== null && $secretKey !== null)
|
212 |
$this -> setAuth($accessKey, $secretKey);
|
213 |
$this -> useSSL = $useSSL;
|
214 |
$this -> endpoint = $endpoint;
|
215 |
+
$this->region = 'us-east-1';
|
216 |
}
|
217 |
|
218 |
|
227 |
$this -> endpoint = $host;
|
228 |
}
|
229 |
|
230 |
+
/**
|
231 |
+
* Set the service region
|
232 |
+
*
|
233 |
+
* @param string $region Region
|
234 |
+
* @return void
|
235 |
+
*/
|
236 |
+
public function setRegion($region) {
|
237 |
+
$this->region = $region;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Get the service region
|
242 |
+
* Note: Region calculation will be done in methods/s3.php file
|
243 |
+
*
|
244 |
+
* @return string Region
|
245 |
+
*/
|
246 |
+
public function getRegion() {
|
247 |
+
return $this->region;
|
248 |
+
}
|
249 |
|
250 |
/**
|
251 |
* Set AWS access key and secret key
|
1038 |
$rest->error['code'], $rest->error['message']), __FILE__, __LINE__);
|
1039 |
return false;
|
1040 |
}
|
1041 |
+
return (isset($rest->body[0]) && (string)$rest->body[0] !== '') ? (string)$rest->body[0] : 'us-east-1';
|
1042 |
}
|
1043 |
|
1044 |
|
1933 |
(str_repeat(chr(0x36), 64))) . $string)))));
|
1934 |
}
|
1935 |
|
1936 |
+
/**
|
1937 |
+
* Generate the headers for AWS Signature V4
|
1938 |
+
*
|
1939 |
+
* @internal Used by UpdraftPlus_S3Request::getResponse()
|
1940 |
+
* @param array $aHeaders amzHeaders
|
1941 |
+
* @param array $headers
|
1942 |
+
* @param string $method
|
1943 |
+
* @param string $uri
|
1944 |
+
* @param string $data
|
1945 |
+
*
|
1946 |
+
* @return array $headers
|
1947 |
+
*/
|
1948 |
+
public function __getSignatureV4($aHeaders, $headers, $method = 'GET', $uri = '', $data = '') {// phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore -- Method name "UpdraftPlus_S3Request::__responseHeaderCallback" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.
|
1949 |
+
$service = 's3';
|
1950 |
+
$region = $this->getRegion();
|
1951 |
+
|
1952 |
+
$algorithm = 'AWS4-HMAC-SHA256';
|
1953 |
+
$amzHeaders = array();
|
1954 |
+
$amzRequests = array();
|
1955 |
+
|
1956 |
+
$amzDate = gmdate('Ymd\THis\Z');
|
1957 |
+
$amzDateStamp = gmdate('Ymd');
|
1958 |
+
|
1959 |
+
// amz-date ISO8601 format? for aws request
|
1960 |
+
$amzHeaders['x-amz-date'] = $amzDate;
|
1961 |
+
|
1962 |
+
// CanonicalHeaders
|
1963 |
+
foreach ($headers as $k => $v) {
|
1964 |
+
$amzHeaders[strtolower($k)] = trim($v);
|
1965 |
+
}
|
1966 |
+
|
1967 |
+
foreach ($aHeaders as $k => $v) {
|
1968 |
+
$amzHeaders[strtolower($k)] = trim($v);
|
1969 |
+
}
|
1970 |
+
uksort($amzHeaders, 'strcmp');
|
1971 |
+
|
1972 |
+
// payload
|
1973 |
+
$payloadHash = isset($amzHeaders['x-amz-content-sha256']) ? $amzHeaders['x-amz-content-sha256'] : hash('sha256', $data);
|
1974 |
+
|
1975 |
+
// parameters
|
1976 |
+
$parameters = array();
|
1977 |
+
if (strpos($uri, '?')) {
|
1978 |
+
list($uri, $query_str) = @explode('?', $uri);
|
1979 |
+
parse_str($query_str, $parameters);
|
1980 |
+
}
|
1981 |
+
|
1982 |
+
// Canonical Requests
|
1983 |
+
$amzRequests[] = $method;
|
1984 |
+
$uriQmPos = strpos($uri, '?');
|
1985 |
+
$amzRequests[] = (false === $uriQmPos ? $uri : substr($uri, 0, $uriQmPos));
|
1986 |
+
$amzRequests[] = http_build_query($parameters);
|
1987 |
+
|
1988 |
+
// add headers as string to requests
|
1989 |
+
foreach ($amzHeaders as $k => $v) {
|
1990 |
+
$amzRequests[] = $k . ':' . $v;
|
1991 |
+
}
|
1992 |
+
|
1993 |
+
// add a blank entry so we end up with an extra line break
|
1994 |
+
$amzRequests[] = '';
|
1995 |
+
|
1996 |
+
// SignedHeaders
|
1997 |
+
$amzRequests[] = implode(';', array_keys($amzHeaders));
|
1998 |
+
|
1999 |
+
// payload hash
|
2000 |
+
$amzRequests[] = $payloadHash;
|
2001 |
+
|
2002 |
+
// request as string
|
2003 |
+
$amzRequestStr = implode("\n", $amzRequests);
|
2004 |
+
|
2005 |
+
// CredentialScope
|
2006 |
+
$credentialScope = array();
|
2007 |
+
$credentialScope[] = $amzDateStamp;
|
2008 |
+
$credentialScope[] = $region;
|
2009 |
+
$credentialScope[] = $service;
|
2010 |
+
$credentialScope[] = 'aws4_request';
|
2011 |
+
|
2012 |
+
// stringToSign
|
2013 |
+
$stringToSign = array();
|
2014 |
+
$stringToSign[] = $algorithm;
|
2015 |
+
$stringToSign[] = $amzDate;
|
2016 |
+
$stringToSign[] = implode('/', $credentialScope);
|
2017 |
+
$stringToSign[] = hash('sha256', $amzRequestStr);
|
2018 |
+
|
2019 |
+
// as string
|
2020 |
+
$stringToSignStr = implode("\n", $stringToSign);
|
2021 |
+
|
2022 |
+
// Make Signature
|
2023 |
+
$kSecret = 'AWS4' . $this->__secretKey;
|
2024 |
+
$kDate = hash_hmac('sha256', $amzDateStamp, $kSecret, true);
|
2025 |
+
$kRegion = hash_hmac('sha256', $region, $kDate, true);
|
2026 |
+
$kService = hash_hmac('sha256', $service, $kRegion, true);
|
2027 |
+
$kSigning = hash_hmac('sha256', 'aws4_request', $kService, true);
|
2028 |
+
$signature = hash_hmac('sha256', $stringToSignStr, $kSigning);
|
2029 |
+
|
2030 |
+
$authorization = array(
|
2031 |
+
'Credential=' . $this->__accessKey . '/' . implode('/', $credentialScope),
|
2032 |
+
'SignedHeaders=' . implode(';', array_keys($amzHeaders)),
|
2033 |
+
'Signature=' . $signature,
|
2034 |
+
);
|
2035 |
+
$authorizationStr = $algorithm . ' ' . implode(',', $authorization);
|
2036 |
+
|
2037 |
+
$resultHeaders = array(
|
2038 |
+
'X-AMZ-DATE' => $amzDate,
|
2039 |
+
'Authorization' => $authorizationStr
|
2040 |
+
);
|
2041 |
+
if (!isset($aHeaders['x-amz-content-sha256'])) {
|
2042 |
+
$resultHeaders['x-amz-content-sha256'] = $payloadHash;
|
2043 |
+
}
|
2044 |
+
|
2045 |
+
return $resultHeaders;
|
2046 |
+
}
|
2047 |
}
|
2048 |
|
2049 |
/**
|
includes/customclass/class-wpvivid-s3compat.php
CHANGED
@@ -40,24 +40,29 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
40 |
if($res['result'] == WPVIVID_FAILED)
|
41 |
return $res;
|
42 |
|
43 |
-
$
|
44 |
-
if (preg_match("#^/*([^/]+)/(.*)$#", $path_temp, $bmatches))
|
45 |
{
|
46 |
-
$this->
|
47 |
-
if(
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
51 |
}
|
52 |
-
|
53 |
-
$
|
54 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
-
|
57 |
-
$endpoint_temp = str_replace('https://','',$this->options['endpoint']);
|
58 |
-
$explodes = explode('.',$endpoint_temp);
|
59 |
-
$this -> region = $explodes[0];
|
60 |
-
$this -> options['endpoint'] = 'https://'.trailingslashit($endpoint_temp);
|
61 |
|
62 |
include_once WPVIVID_PLUGIN_DIR.'/vendor/autoload.php';
|
63 |
$s3compat = S3Client::factory(
|
@@ -69,10 +74,6 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
69 |
'version' => 'latest',
|
70 |
'region' => $this -> region,
|
71 |
'endpoint' => $this -> options['endpoint'],
|
72 |
-
//todo delete proxy
|
73 |
-
// 'request.options' => array(
|
74 |
-
// 'proxy' => '127.0.0.1:1080'
|
75 |
-
// )
|
76 |
)
|
77 |
);
|
78 |
return $s3compat;
|
@@ -80,37 +81,43 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
80 |
|
81 |
public function test_connect()
|
82 |
{
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
|
|
|
|
92 |
array(
|
93 |
-
'Bucket'=>$this
|
94 |
-
'Key' => $this->options['
|
95 |
'Body' => $temp_file,
|
96 |
)
|
97 |
);
|
98 |
-
$etag = $result
|
99 |
-
if(!isset($etag))
|
|
|
100 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, but create test file failed.');
|
101 |
}
|
102 |
-
$result = $s3compat
|
103 |
'Bucket' => $this -> bucket,
|
104 |
-
'Key' => $this
|
105 |
));
|
106 |
-
if(empty($result))
|
|
|
107 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, and create test file succeed, but delete test file failed.');
|
108 |
}
|
109 |
-
}
|
|
|
|
|
110 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getAwsErrorCode().$e -> getMessage());
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getMessage());
|
115 |
}
|
116 |
return array('result' => WPVIVID_SUCCESS);
|
@@ -120,7 +127,8 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
120 |
{
|
121 |
global $wpvivid_plugin;
|
122 |
$s3compat = $this -> getClient();
|
123 |
-
if(is_array($s3compat) && $s3compat['result'] == WPVIVID_FAILED)
|
|
|
124 |
return $s3compat;
|
125 |
}
|
126 |
|
@@ -138,21 +146,23 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
138 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3);
|
139 |
}
|
140 |
|
141 |
-
foreach ($files as $file)
|
|
|
142 |
if(is_array($upload_job['job_data'])&&array_key_exists(basename($file),$upload_job['job_data']))
|
143 |
{
|
144 |
if($upload_job['job_data'][basename($file)]['uploaded']==1)
|
145 |
continue;
|
146 |
}
|
147 |
-
$this
|
148 |
-
$this
|
149 |
$wpvivid_plugin->wpvivid_log->WriteLog('Start uploading '.basename($file),'notice');
|
150 |
if(!file_exists($file)){
|
151 |
$wpvivid_plugin->wpvivid_log->WriteLog('Uploading '.basename($file).' failed.','notice');
|
152 |
return array('result' =>WPVIVID_FAILED,'error' =>$file.' not found. The file might has been moved, renamed or deleted. Please reload the list and verify the file exists.');
|
153 |
}
|
154 |
-
$result = $this
|
155 |
-
if($result['result'] !==WPVIVID_SUCCESS)
|
|
|
156 |
$wpvivid_plugin->wpvivid_log->WriteLog('Uploading '.basename($file).' failed.','notice');
|
157 |
return $result;
|
158 |
}
|
@@ -161,13 +171,15 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
161 |
return array('result' => WPVIVID_SUCCESS);
|
162 |
}
|
163 |
public function _put($task_id,$s3compat,$file,$callback){
|
164 |
-
$path = $this
|
165 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX);
|
166 |
-
$this
|
167 |
-
$this
|
168 |
|
169 |
-
try
|
170 |
-
|
|
|
|
|
171 |
$result = $s3compat ->createMultipartUpload(array(
|
172 |
'Bucket' => $this -> bucket,
|
173 |
'Key' => $path,
|
@@ -180,7 +192,8 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
180 |
$partNumber = 1;
|
181 |
$parts = array();
|
182 |
$offset = 0;
|
183 |
-
while(!feof($fh))
|
|
|
184 |
$data = fread($fh,$this -> upload_chunk_size);
|
185 |
$result = $this -> _upload_loop($s3compat,$uploadId,$path,$data,$partNumber,$parts);
|
186 |
if($result['result'] === WPVIVID_FAILED)
|
@@ -201,8 +214,10 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
201 |
}
|
202 |
fclose($fh);
|
203 |
|
204 |
-
if($result['result'] === WPVIVID_SUCCESS)
|
205 |
-
|
|
|
|
|
206 |
array(
|
207 |
'Bucket' => $this -> bucket,
|
208 |
'Key' => $path,
|
@@ -210,35 +225,42 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
210 |
'UploadId' => $uploadId,
|
211 |
)
|
212 |
);
|
213 |
-
if(!isset($ret['Location']))
|
|
|
214 |
$result = array('result' => WPVIVID_FAILED, 'error' => 'Merging multipart failed. File name: '.$this -> current_file_name);
|
215 |
}
|
216 |
}
|
217 |
}
|
218 |
else {
|
219 |
$res = $s3compat ->putObject(
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
'SourceFile' => $file,
|
224 |
-
|
225 |
-
|
226 |
$etag = $res -> get('ETag');
|
227 |
-
if(isset($etag))
|
|
|
228 |
$result = array('result' => WPVIVID_SUCCESS);
|
229 |
-
}else{
|
230 |
$result = array('result' => WPVIVID_FAILED , 'error' => 'upload '.$this -> current_file_name.' failed.');
|
231 |
}
|
232 |
}
|
233 |
-
}
|
|
|
|
|
234 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getAwsErrorCode().$e -> getMessage());
|
235 |
-
}
|
|
|
|
|
236 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getMessage());
|
237 |
}
|
238 |
return $result;
|
239 |
}
|
240 |
public function _upload_loop($s3compat,$uploadId,$path,$data,$partNumber,&$parts){
|
241 |
-
for($i =0;$i <WPVIVID_REMOTE_CONNECT_RETRY_TIMES;$i ++)
|
|
|
242 |
$ret = $s3compat ->uploadPart(array(
|
243 |
'Bucket' => $this ->bucket,
|
244 |
'Key' => $path,
|
@@ -246,7 +268,8 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
246 |
'PartNumber' => $partNumber,
|
247 |
'Body' => $data,
|
248 |
));
|
249 |
-
if(isset($ret['ETag']))
|
|
|
250 |
$parts[] = array(
|
251 |
'ETag' => $ret['ETag'],
|
252 |
'PartNumber' => $partNumber,
|
@@ -264,7 +287,6 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
264 |
$this->current_file_name = $file['file_name'];
|
265 |
$this->current_file_size = $file['size'];
|
266 |
$file_path = trailingslashit($local_path) . $this->current_file_name;
|
267 |
-
$file_md5 = $file['md5'];
|
268 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Get s3compat client.','notice');
|
269 |
$s3compat = $this->getClient();
|
270 |
if (is_array($s3compat) && $s3compat['result'] == WPVIVID_FAILED) {
|
@@ -275,18 +297,21 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
275 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Create local file.','notice');
|
276 |
$fh = fopen($file_path, 'a');
|
277 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Downloading file ' . $file['file_name'] . ', Size: ' . $file['size'] ,'notice');
|
278 |
-
while ($start_offset < $this->current_file_size)
|
|
|
279 |
$last_byte = min($start_offset + $this->download_chunk_size - 1, $this->current_file_size - 1);
|
280 |
$range = "bytes=$start_offset-$last_byte";
|
281 |
$response = $this->_download_loop($s3compat, $range, $fh);
|
282 |
-
if ($response['result'] === WPVIVID_FAILED)
|
|
|
283 |
return $response;
|
284 |
}
|
285 |
|
286 |
clearstatcache();
|
287 |
$state = stat($file_path);
|
288 |
$start_offset = $state['size'];
|
289 |
-
if ((time() - $this->last_time) > 3)
|
|
|
290 |
if (is_callable($callback)) {
|
291 |
call_user_func_array($callback, array($start_offset, $this->current_file_name,
|
292 |
$this->current_file_size, $this->last_time, $this->last_size));
|
@@ -297,8 +322,10 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
297 |
}
|
298 |
@fclose($fh);
|
299 |
|
300 |
-
if(filesize($file_path) == $file['size'])
|
301 |
-
|
|
|
|
|
302 |
$res = TRUE;
|
303 |
}
|
304 |
else{
|
@@ -331,7 +358,7 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
331 |
for($i =0;$i <WPVIVID_REMOTE_CONNECT_RETRY_TIMES;$i ++){
|
332 |
$response = $s3compat -> getObject(array(
|
333 |
'Bucket' => $this -> bucket,
|
334 |
-
'Key' => $this -> options['path'].$this -> current_file_name,
|
335 |
'Range' => $range
|
336 |
));
|
337 |
if(isset($response['Body']) && fwrite($fh,$response['Body'])) {
|
@@ -348,14 +375,14 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
348 |
|
349 |
public function cleanup($files)
|
350 |
{
|
351 |
-
$s3compat = $this -> getClient(
|
352 |
if(is_array($s3compat) && $s3compat['result'] == WPVIVID_FAILED){
|
353 |
return $s3compat;
|
354 |
}
|
355 |
|
356 |
$keys = array();
|
357 |
foreach ($files as $file){
|
358 |
-
$keys[] = array('Key' => $this -> options['path'].basename($file));
|
359 |
}
|
360 |
try{
|
361 |
$result = $s3compat -> deleteObjects(array(
|
@@ -379,43 +406,121 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
379 |
public function wpvivid_add_storage_page_s3compat(){
|
380 |
?>
|
381 |
<div id="storage_account_s3compat" class="storage-account-page" style="display:none;">
|
382 |
-
<
|
383 |
-
|
384 |
-
<input type="text" autocomplete="off" option="s3compat" name="name" placeholder="Enter an unique alias: e.g. DOS-001" class="regular-text" />
|
385 |
-
</div>
|
386 |
-
<div class="storage-account-form">
|
387 |
-
<input type="text" autocomplete="off" option="s3compat" name="access" placeholder="DigitalOcean Spaces access key" class="regular-text"/>
|
388 |
</div>
|
389 |
-
<
|
390 |
-
<
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
<
|
404 |
-
<
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
</div>
|
410 |
<script>
|
411 |
-
jQuery("input:text[option=s3compat][name=s3directory]").keyup(function(){
|
412 |
var value = jQuery(this).val();
|
413 |
if(value == ''){
|
414 |
value = '*';
|
415 |
}
|
416 |
value = value + '/wpvivid_backup';
|
417 |
jQuery('#wpvivid_dos_root_path').html(value);
|
418 |
-
})
|
419 |
</script>
|
420 |
<?php
|
421 |
}
|
@@ -424,27 +529,97 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
424 |
{
|
425 |
?>
|
426 |
<div id="remote_storage_edit_s3compat" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
427 |
-
<
|
428 |
-
|
429 |
-
<input type="text" option="edit-s3compat" name="name" placeholder="Enter an unique alias: e.g. DOS-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
430 |
-
</div>
|
431 |
-
<div class="storage-account-form">
|
432 |
-
<input type="text" option="edit-s3compat" name="access" placeholder="S3-Compatible access key" class="regular-text"/>
|
433 |
-
</div>
|
434 |
-
<div class="storage-account-form">
|
435 |
-
<input type="password" option="edit-s3compat" name="secret" placeholder="S3-Compatible secret key" class="regular-text"/>
|
436 |
</div>
|
437 |
-
<
|
438 |
-
<
|
439 |
-
<
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
</div>
|
449 |
<script>
|
450 |
jQuery("input:text[option=edit-s3compat][name=s3directory]").keyup(function(){
|
@@ -521,36 +696,33 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
521 |
return $ret;
|
522 |
}
|
523 |
|
524 |
-
|
525 |
-
// {
|
526 |
-
// $ret['error']="Warning: The storage path is required.";
|
527 |
-
// return $ret;
|
528 |
-
// }
|
529 |
-
|
530 |
-
// $this->options['s3directory'].$this -> options['path']=sanitize_text_field($this->options['s3directory'].$this -> options['path']).'/'.WPVIVID_S3COMPAT_DEFAULT_FOLDER;
|
531 |
-
|
532 |
-
if(empty($this->options['s3directory']))
|
533 |
{
|
534 |
-
$ret['error']="Warning:
|
535 |
return $ret;
|
536 |
}
|
537 |
|
538 |
-
$this->options['path']
|
539 |
-
|
540 |
-
if(!isset($this->options['endpoint']))
|
541 |
{
|
542 |
-
$ret['error']="Warning:
|
543 |
return $ret;
|
544 |
}
|
545 |
|
546 |
-
$this->options['
|
547 |
|
548 |
-
if(empty($this->options['
|
|
|
|
|
|
|
|
|
|
|
549 |
{
|
550 |
$ret['error']="Warning: The end-point is required.";
|
551 |
return $ret;
|
552 |
}
|
553 |
|
|
|
|
|
554 |
$ret['result']=WPVIVID_SUCCESS;
|
555 |
$ret['options']=$this->options;
|
556 |
return $ret;
|
@@ -558,8 +730,12 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
558 |
|
559 |
public function wpvivid_get_out_of_date_s3compat($out_of_date_remote, $remote)
|
560 |
{
|
561 |
-
if($remote['type'] == WPVIVID_REMOTE_S3COMPAT)
|
562 |
-
|
|
|
|
|
|
|
|
|
563 |
}
|
564 |
return $out_of_date_remote;
|
565 |
}
|
@@ -577,4 +753,6 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
|
|
577 |
}
|
578 |
return array('result' => WPVIVID_SUCCESS);
|
579 |
}
|
|
|
|
|
580 |
}
|
40 |
if($res['result'] == WPVIVID_FAILED)
|
41 |
return $res;
|
42 |
|
43 |
+
if(isset($this->options['s3directory']))
|
|
|
44 |
{
|
45 |
+
$path_temp = str_replace('s3generic://','',$this->options['s3directory'].$this -> options['path']);
|
46 |
+
if (preg_match("#^/*([^/]+)/(.*)$#", $path_temp, $bmatches))
|
47 |
+
{
|
48 |
+
$this->bucket = $bmatches[1];
|
49 |
+
} else {
|
50 |
+
$this->bucket = $path_temp;
|
51 |
}
|
52 |
+
$this->options['path']=ltrim($this -> options['path'],'/');
|
53 |
+
$endpoint_temp = str_replace('https://','',$this->options['endpoint']);
|
54 |
+
$explodes = explode('.',$endpoint_temp);
|
55 |
+
$this -> region = $explodes[0];
|
56 |
+
$this -> options['endpoint'] = 'https://'.trailingslashit($endpoint_temp);
|
57 |
+
}
|
58 |
+
else
|
59 |
+
{
|
60 |
+
$endpoint_temp = str_replace('https://','',$this->options['endpoint']);
|
61 |
+
$explodes = explode('.',$endpoint_temp);
|
62 |
+
$this -> region = $explodes[0];
|
63 |
+
$this -> options['endpoint'] = 'https://'.trailingslashit($endpoint_temp);
|
64 |
+
$this -> bucket=$this->options['bucket'];
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
include_once WPVIVID_PLUGIN_DIR.'/vendor/autoload.php';
|
68 |
$s3compat = S3Client::factory(
|
74 |
'version' => 'latest',
|
75 |
'region' => $this -> region,
|
76 |
'endpoint' => $this -> options['endpoint'],
|
|
|
|
|
|
|
|
|
77 |
)
|
78 |
);
|
79 |
return $s3compat;
|
81 |
|
82 |
public function test_connect()
|
83 |
{
|
84 |
+
$s3compat = $this -> getClient();
|
85 |
+
if(is_array($s3compat) && $s3compat['result'] == WPVIVID_FAILED)
|
86 |
+
{
|
87 |
+
return $s3compat;
|
88 |
+
}
|
89 |
|
90 |
+
$temp_file = md5(rand());
|
91 |
|
92 |
+
try
|
93 |
+
{
|
94 |
+
$result = $s3compat->putObject(
|
95 |
array(
|
96 |
+
'Bucket'=>$this->bucket,
|
97 |
+
'Key' => $this->options['path'].'/'.$temp_file,
|
98 |
'Body' => $temp_file,
|
99 |
)
|
100 |
);
|
101 |
+
$etag = $result->get('ETag');
|
102 |
+
if(!isset($etag))
|
103 |
+
{
|
104 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, but create test file failed.');
|
105 |
}
|
106 |
+
$result = $s3compat->deleteObject(array(
|
107 |
'Bucket' => $this -> bucket,
|
108 |
+
'Key' => $this -> options['path'].'/'.$temp_file,
|
109 |
));
|
110 |
+
if(empty($result))
|
111 |
+
{
|
112 |
return array('result'=>WPVIVID_FAILED,'error'=>'We successfully accessed the bucket, and create test file succeed, but delete test file failed.');
|
113 |
}
|
114 |
+
}
|
115 |
+
catch(S3Exception $e)
|
116 |
+
{
|
117 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getAwsErrorCode().$e -> getMessage());
|
118 |
+
}
|
119 |
+
catch(Exception $e)
|
120 |
+
{
|
121 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getMessage());
|
122 |
}
|
123 |
return array('result' => WPVIVID_SUCCESS);
|
127 |
{
|
128 |
global $wpvivid_plugin;
|
129 |
$s3compat = $this -> getClient();
|
130 |
+
if(is_array($s3compat) && $s3compat['result'] == WPVIVID_FAILED)
|
131 |
+
{
|
132 |
return $s3compat;
|
133 |
}
|
134 |
|
146 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3);
|
147 |
}
|
148 |
|
149 |
+
foreach ($files as $file)
|
150 |
+
{
|
151 |
if(is_array($upload_job['job_data'])&&array_key_exists(basename($file),$upload_job['job_data']))
|
152 |
{
|
153 |
if($upload_job['job_data'][basename($file)]['uploaded']==1)
|
154 |
continue;
|
155 |
}
|
156 |
+
$this->last_time = time();
|
157 |
+
$this->last_size = 0;
|
158 |
$wpvivid_plugin->wpvivid_log->WriteLog('Start uploading '.basename($file),'notice');
|
159 |
if(!file_exists($file)){
|
160 |
$wpvivid_plugin->wpvivid_log->WriteLog('Uploading '.basename($file).' failed.','notice');
|
161 |
return array('result' =>WPVIVID_FAILED,'error' =>$file.' not found. The file might has been moved, renamed or deleted. Please reload the list and verify the file exists.');
|
162 |
}
|
163 |
+
$result = $this->_put($task_id,$s3compat,$file,$callback);
|
164 |
+
if($result['result'] !==WPVIVID_SUCCESS)
|
165 |
+
{
|
166 |
$wpvivid_plugin->wpvivid_log->WriteLog('Uploading '.basename($file).' failed.','notice');
|
167 |
return $result;
|
168 |
}
|
171 |
return array('result' => WPVIVID_SUCCESS);
|
172 |
}
|
173 |
public function _put($task_id,$s3compat,$file,$callback){
|
174 |
+
$path = $this->options['path'].'/'.basename($file);
|
175 |
$upload_job=WPvivid_taskmanager::get_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX);
|
176 |
+
$this->current_file_size = filesize($file);
|
177 |
+
$this->current_file_name = basename($file);
|
178 |
|
179 |
+
try
|
180 |
+
{
|
181 |
+
if($this->current_file_size > $this->upload_chunk_size)
|
182 |
+
{
|
183 |
$result = $s3compat ->createMultipartUpload(array(
|
184 |
'Bucket' => $this -> bucket,
|
185 |
'Key' => $path,
|
192 |
$partNumber = 1;
|
193 |
$parts = array();
|
194 |
$offset = 0;
|
195 |
+
while(!feof($fh))
|
196 |
+
{
|
197 |
$data = fread($fh,$this -> upload_chunk_size);
|
198 |
$result = $this -> _upload_loop($s3compat,$uploadId,$path,$data,$partNumber,$parts);
|
199 |
if($result['result'] === WPVIVID_FAILED)
|
214 |
}
|
215 |
fclose($fh);
|
216 |
|
217 |
+
if($result['result'] === WPVIVID_SUCCESS)
|
218 |
+
{
|
219 |
+
$ret = $s3compat ->completeMultipartUpload
|
220 |
+
(
|
221 |
array(
|
222 |
'Bucket' => $this -> bucket,
|
223 |
'Key' => $path,
|
225 |
'UploadId' => $uploadId,
|
226 |
)
|
227 |
);
|
228 |
+
if(!isset($ret['Location']))
|
229 |
+
{
|
230 |
$result = array('result' => WPVIVID_FAILED, 'error' => 'Merging multipart failed. File name: '.$this -> current_file_name);
|
231 |
}
|
232 |
}
|
233 |
}
|
234 |
else {
|
235 |
$res = $s3compat ->putObject(
|
236 |
+
array(
|
237 |
+
'Bucket'=>$this -> bucket,
|
238 |
+
'Key' => $path,
|
239 |
'SourceFile' => $file,
|
240 |
+
)
|
241 |
+
);
|
242 |
$etag = $res -> get('ETag');
|
243 |
+
if(isset($etag))
|
244 |
+
{
|
245 |
$result = array('result' => WPVIVID_SUCCESS);
|
246 |
+
}else {
|
247 |
$result = array('result' => WPVIVID_FAILED , 'error' => 'upload '.$this -> current_file_name.' failed.');
|
248 |
}
|
249 |
}
|
250 |
+
}
|
251 |
+
catch(S3Exception $e)
|
252 |
+
{
|
253 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getAwsErrorCode().$e -> getMessage());
|
254 |
+
}
|
255 |
+
catch(Exception $e)
|
256 |
+
{
|
257 |
return array('result' => WPVIVID_FAILED,'error' => $e -> getMessage());
|
258 |
}
|
259 |
return $result;
|
260 |
}
|
261 |
public function _upload_loop($s3compat,$uploadId,$path,$data,$partNumber,&$parts){
|
262 |
+
for($i =0;$i <WPVIVID_REMOTE_CONNECT_RETRY_TIMES;$i ++)
|
263 |
+
{
|
264 |
$ret = $s3compat ->uploadPart(array(
|
265 |
'Bucket' => $this ->bucket,
|
266 |
'Key' => $path,
|
268 |
'PartNumber' => $partNumber,
|
269 |
'Body' => $data,
|
270 |
));
|
271 |
+
if(isset($ret['ETag']))
|
272 |
+
{
|
273 |
$parts[] = array(
|
274 |
'ETag' => $ret['ETag'],
|
275 |
'PartNumber' => $partNumber,
|
287 |
$this->current_file_name = $file['file_name'];
|
288 |
$this->current_file_size = $file['size'];
|
289 |
$file_path = trailingslashit($local_path) . $this->current_file_name;
|
|
|
290 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Get s3compat client.','notice');
|
291 |
$s3compat = $this->getClient();
|
292 |
if (is_array($s3compat) && $s3compat['result'] == WPVIVID_FAILED) {
|
297 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Create local file.','notice');
|
298 |
$fh = fopen($file_path, 'a');
|
299 |
$wpvivid_plugin->wpvivid_download_log->WriteLog('Downloading file ' . $file['file_name'] . ', Size: ' . $file['size'] ,'notice');
|
300 |
+
while ($start_offset < $this->current_file_size)
|
301 |
+
{
|
302 |
$last_byte = min($start_offset + $this->download_chunk_size - 1, $this->current_file_size - 1);
|
303 |
$range = "bytes=$start_offset-$last_byte";
|
304 |
$response = $this->_download_loop($s3compat, $range, $fh);
|
305 |
+
if ($response['result'] === WPVIVID_FAILED)
|
306 |
+
{
|
307 |
return $response;
|
308 |
}
|
309 |
|
310 |
clearstatcache();
|
311 |
$state = stat($file_path);
|
312 |
$start_offset = $state['size'];
|
313 |
+
if ((time() - $this->last_time) > 3)
|
314 |
+
{
|
315 |
if (is_callable($callback)) {
|
316 |
call_user_func_array($callback, array($start_offset, $this->current_file_name,
|
317 |
$this->current_file_size, $this->last_time, $this->last_size));
|
322 |
}
|
323 |
@fclose($fh);
|
324 |
|
325 |
+
if(filesize($file_path) == $file['size'])
|
326 |
+
{
|
327 |
+
if($wpvivid_plugin->wpvivid_check_zip_valid())
|
328 |
+
{
|
329 |
$res = TRUE;
|
330 |
}
|
331 |
else{
|
358 |
for($i =0;$i <WPVIVID_REMOTE_CONNECT_RETRY_TIMES;$i ++){
|
359 |
$response = $s3compat -> getObject(array(
|
360 |
'Bucket' => $this -> bucket,
|
361 |
+
'Key' => $this -> options['path'].'/'.$this -> current_file_name,
|
362 |
'Range' => $range
|
363 |
));
|
364 |
if(isset($response['Body']) && fwrite($fh,$response['Body'])) {
|
375 |
|
376 |
public function cleanup($files)
|
377 |
{
|
378 |
+
$s3compat = $this -> getClient();
|
379 |
if(is_array($s3compat) && $s3compat['result'] == WPVIVID_FAILED){
|
380 |
return $s3compat;
|
381 |
}
|
382 |
|
383 |
$keys = array();
|
384 |
foreach ($files as $file){
|
385 |
+
$keys[] = array('Key' => $this -> options['path'].'/'.basename($file));
|
386 |
}
|
387 |
try{
|
388 |
$result = $s3compat -> deleteObjects(array(
|
406 |
public function wpvivid_add_storage_page_s3compat(){
|
407 |
?>
|
408 |
<div id="storage_account_s3compat" class="storage-account-page" style="display:none;">
|
409 |
+
<div style="padding: 0 10px 10px 0;">
|
410 |
+
<strong>Enter Your DigitalOcean Spaces Account</strong>
|
|
|
|
|
|
|
|
|
411 |
</div>
|
412 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
413 |
+
<tbody>
|
414 |
+
<tr>
|
415 |
+
<td class="plugin-title column-primary">
|
416 |
+
<div class="wpvivid-storage-form">
|
417 |
+
<input type="text" class="regular-text" autocomplete="off" option="s3compat" name="name" placeholder="Enter a unique alias: e.g. DOS-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
418 |
+
</div>
|
419 |
+
</td>
|
420 |
+
<td class="column-description desc">
|
421 |
+
<div class="wpvivid-storage-form-desc">
|
422 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
423 |
+
</div>
|
424 |
+
</td>
|
425 |
+
</tr>
|
426 |
+
<tr>
|
427 |
+
<td class="plugin-title column-primary">
|
428 |
+
<div class="wpvivid-storage-form">
|
429 |
+
<input type="text" class="regular-text" autocomplete="off" option="s3compat" name="access" placeholder="DigitalOcean Spaces access key" />
|
430 |
+
</div>
|
431 |
+
</td>
|
432 |
+
<td class="column-description desc">
|
433 |
+
<div class="wpvivid-storage-form-desc">
|
434 |
+
<i>Enter your DigitalOcean Spaces access key</i>
|
435 |
+
</div>
|
436 |
+
</td>
|
437 |
+
</tr>
|
438 |
+
<tr>
|
439 |
+
<td class="plugin-title column-primary">
|
440 |
+
<div class="wpvivid-storage-form">
|
441 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="s3compat" name="secret" placeholder="DigitalOcean Spaces secret key" />
|
442 |
+
</div>
|
443 |
+
</td>
|
444 |
+
<td class="column-description desc">
|
445 |
+
<div class="wpvivid-storage-form-desc">
|
446 |
+
<i>Enter your DigitalOcean Spaces secret key</i>
|
447 |
+
</div>
|
448 |
+
</td>
|
449 |
+
</tr>
|
450 |
+
<tr>
|
451 |
+
<td class="plugin-title column-primary">
|
452 |
+
<div class="wpvivid-storage-form">
|
453 |
+
<input type="text" class="regular-text" autocomplete="off" option="s3compat" name="bucket" placeholder="Space Name(e.g. test)" />
|
454 |
+
</div>
|
455 |
+
</td>
|
456 |
+
<td class="column-description desc">
|
457 |
+
<div class="wpvivid-storage-form-desc">
|
458 |
+
<i><span>Enter an existed Space to create a custom backup storage directory.</span></i>
|
459 |
+
</div>
|
460 |
+
</td>
|
461 |
+
</tr>
|
462 |
+
<tr>
|
463 |
+
<td class="plugin-title column-primary">
|
464 |
+
<div class="wpvivid-storage-form">
|
465 |
+
<input type="text" class="regular-text" autocomplete="off" option="s3compat" name="path" placeholder="Custom Path" />
|
466 |
+
</div>
|
467 |
+
</td>
|
468 |
+
<td class="column-description desc">
|
469 |
+
<div class="wpvivid-storage-form-desc">
|
470 |
+
<i><span>Customize the directory where you want to store backups within the Space.</span></i><a href="https://wpvivid.com/wpvivid-backup-pro-digitalocean-space-custom-folder-name?utm_source=client_digitalocean&utm_medium=inner_link&utm_campaign=access">Create a directory for storing the backups of the site</a>
|
471 |
+
</div>
|
472 |
+
</td>
|
473 |
+
</tr>
|
474 |
+
<tr>
|
475 |
+
<td class="plugin-title column-primary">
|
476 |
+
<div class="wpvivid-storage-form">
|
477 |
+
<input type="text" class="regular-text" autocomplete="off" option="s3compat" name="endpoint" placeholder="region.digitaloceanspaces.com" />
|
478 |
+
</div>
|
479 |
+
</td>
|
480 |
+
<td class="column-description desc">
|
481 |
+
<div class="wpvivid-storage-form-desc">
|
482 |
+
<i>Enter the DigitalOcean Endpoint for the storage</i>
|
483 |
+
</div>
|
484 |
+
</td>
|
485 |
+
</tr>
|
486 |
+
<tr>
|
487 |
+
<td class="plugin-title column-primary">
|
488 |
+
<div class="wpvivid-storage-select">
|
489 |
+
<label>
|
490 |
+
<input type="checkbox" option="s3compat" name="default" checked />Set as the default remote storage.
|
491 |
+
</label>
|
492 |
+
</div>
|
493 |
+
</td>
|
494 |
+
<td class="column-description desc">
|
495 |
+
<div class="wpvivid-storage-form-desc">
|
496 |
+
<i>Once checked, all this sites backups sent to a remote storage destination will be uploaded to this storage by default.</i>
|
497 |
+
</div>
|
498 |
+
</td>
|
499 |
+
</tr>
|
500 |
+
<tr>
|
501 |
+
<td class="plugin-title column-primary">
|
502 |
+
<div class="wpvivid-storage-form">
|
503 |
+
<input class="button-primary" option="add-remote" type="submit" value="Test and Add" />
|
504 |
+
</div>
|
505 |
+
</td>
|
506 |
+
<td class="column-description desc">
|
507 |
+
<div class="wpvivid-storage-form-desc">
|
508 |
+
<i>Click the button to connect to DigitalOcean Spaces storage and add it to the storage list below.</i>
|
509 |
+
</div>
|
510 |
+
</td>
|
511 |
+
</tr>
|
512 |
+
</tbody>
|
513 |
+
</table>
|
514 |
</div>
|
515 |
<script>
|
516 |
+
/*jQuery("input:text[option=s3compat][name=s3directory]").keyup(function(){
|
517 |
var value = jQuery(this).val();
|
518 |
if(value == ''){
|
519 |
value = '*';
|
520 |
}
|
521 |
value = value + '/wpvivid_backup';
|
522 |
jQuery('#wpvivid_dos_root_path').html(value);
|
523 |
+
});*/
|
524 |
</script>
|
525 |
<?php
|
526 |
}
|
529 |
{
|
530 |
?>
|
531 |
<div id="remote_storage_edit_s3compat" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
532 |
+
<div style="padding: 0 10px 10px 0;">
|
533 |
+
<strong>Enter Your DigitalOcean Spaces Account</strong>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
</div>
|
535 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
536 |
+
<tbody>
|
537 |
+
<tr>
|
538 |
+
<td class="plugin-title column-primary">
|
539 |
+
<div class="wpvivid-storage-form">
|
540 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-s3compat" name="name" placeholder="Enter a unique alias: e.g. DOS-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
541 |
+
</div>
|
542 |
+
</td>
|
543 |
+
<td class="column-description desc">
|
544 |
+
<div class="wpvivid-storage-form-desc">
|
545 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
546 |
+
</div>
|
547 |
+
</td>
|
548 |
+
</tr>
|
549 |
+
<tr>
|
550 |
+
<td class="plugin-title column-primary">
|
551 |
+
<div class="wpvivid-storage-form">
|
552 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-s3compat" name="access" placeholder="DigitalOcean Spaces access key" />
|
553 |
+
</div>
|
554 |
+
</td>
|
555 |
+
<td class="column-description desc">
|
556 |
+
<div class="wpvivid-storage-form-desc">
|
557 |
+
<i>Enter your DigitalOcean Spaces access key</i>
|
558 |
+
</div>
|
559 |
+
</td>
|
560 |
+
</tr>
|
561 |
+
<tr>
|
562 |
+
<td class="plugin-title column-primary">
|
563 |
+
<div class="wpvivid-storage-form">
|
564 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="edit-s3compat" name="secret" placeholder="DigitalOcean Spaces secret key" />
|
565 |
+
</div>
|
566 |
+
</td>
|
567 |
+
<td class="column-description desc">
|
568 |
+
<div class="wpvivid-storage-form-desc">
|
569 |
+
<i>Enter your DigitalOcean Spaces secret key</i>
|
570 |
+
</div>
|
571 |
+
</td>
|
572 |
+
</tr>
|
573 |
+
<tr>
|
574 |
+
<td class="plugin-title column-primary">
|
575 |
+
<div class="wpvivid-storage-form">
|
576 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-s3compat" name="bucket" placeholder="Space Name(e.g. test)" />
|
577 |
+
</div>
|
578 |
+
</td>
|
579 |
+
<td class="column-description desc">
|
580 |
+
<div class="wpvivid-storage-form-desc">
|
581 |
+
<i><span>Enter an existed Space to create a custom backup storage directory.</span></i>
|
582 |
+
</div>
|
583 |
+
</td>
|
584 |
+
</tr>
|
585 |
+
<tr>
|
586 |
+
<td class="plugin-title column-primary">
|
587 |
+
<div class="wpvivid-storage-form">
|
588 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-s3compat" name="path" placeholder="Custom Path" />
|
589 |
+
</div>
|
590 |
+
</td>
|
591 |
+
<td class="column-description desc">
|
592 |
+
<div class="wpvivid-storage-form-desc">
|
593 |
+
<i><span>Customize the directory where you want to store backups within the Space.</span></i><a href="https://wpvivid.com/wpvivid-backup-pro-digitalocean-space-custom-folder-name?utm_source=client_digitalocean&utm_medium=inner_link&utm_campaign=access">Create a directory for storing the backups of the site</a>
|
594 |
+
</div>
|
595 |
+
</td>
|
596 |
+
</tr>
|
597 |
+
<tr>
|
598 |
+
<td class="plugin-title column-primary">
|
599 |
+
<div class="wpvivid-storage-form">
|
600 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-s3compat" name="endpoint" placeholder="region.digitaloceanspaces.com" />
|
601 |
+
</div>
|
602 |
+
</td>
|
603 |
+
<td class="column-description desc">
|
604 |
+
<div class="wpvivid-storage-form-desc">
|
605 |
+
<i>Enter the DigitalOcean Endpoint for the storage</i>
|
606 |
+
</div>
|
607 |
+
</td>
|
608 |
+
</tr>
|
609 |
+
<tr>
|
610 |
+
<td class="plugin-title column-primary">
|
611 |
+
<div class="wpvivid-storage-form">
|
612 |
+
<input class="button-primary" option="edit-remote" type="submit" value="Save Changes" />
|
613 |
+
</div>
|
614 |
+
</td>
|
615 |
+
<td class="column-description desc">
|
616 |
+
<div class="wpvivid-storage-form-desc">
|
617 |
+
<i>Click the button to save the changes.</i>
|
618 |
+
</div>
|
619 |
+
</td>
|
620 |
+
</tr>
|
621 |
+
</tbody>
|
622 |
+
</table>
|
623 |
</div>
|
624 |
<script>
|
625 |
jQuery("input:text[option=edit-s3compat][name=s3directory]").keyup(function(){
|
696 |
return $ret;
|
697 |
}
|
698 |
|
699 |
+
if(empty($this->options['bucket']))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
{
|
701 |
+
$ret['error']="Warning: A Digital Space is required.";
|
702 |
return $ret;
|
703 |
}
|
704 |
|
705 |
+
if(!isset($this->options['path']))
|
|
|
|
|
706 |
{
|
707 |
+
$ret['error']="Warning: A directory name is required.";
|
708 |
return $ret;
|
709 |
}
|
710 |
|
711 |
+
$this->options['path']=sanitize_text_field($this->options['path']);
|
712 |
|
713 |
+
if(empty($this->options['path'])){
|
714 |
+
$ret['error']="Warning: A directory name is required.";
|
715 |
+
return $ret;
|
716 |
+
}
|
717 |
+
|
718 |
+
if(!isset($this->options['endpoint']))
|
719 |
{
|
720 |
$ret['error']="Warning: The end-point is required.";
|
721 |
return $ret;
|
722 |
}
|
723 |
|
724 |
+
$this->options['endpoint']=sanitize_text_field($this->options['endpoint']);
|
725 |
+
|
726 |
$ret['result']=WPVIVID_SUCCESS;
|
727 |
$ret['options']=$this->options;
|
728 |
return $ret;
|
730 |
|
731 |
public function wpvivid_get_out_of_date_s3compat($out_of_date_remote, $remote)
|
732 |
{
|
733 |
+
if($remote['type'] == WPVIVID_REMOTE_S3COMPAT)
|
734 |
+
{
|
735 |
+
if(isset($remote['s3directory']))
|
736 |
+
$out_of_date_remote = $remote['s3directory'].$remote['path'];
|
737 |
+
else
|
738 |
+
$out_of_date_remote = $remote['path'];
|
739 |
}
|
740 |
return $out_of_date_remote;
|
741 |
}
|
753 |
}
|
754 |
return array('result' => WPVIVID_SUCCESS);
|
755 |
}
|
756 |
+
|
757 |
+
|
758 |
}
|
includes/customclass/class-wpvivid-send-to-site.php
CHANGED
@@ -448,7 +448,8 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
448 |
else
|
449 |
{
|
450 |
$ret['result']=WPVIVID_FAILED;
|
451 |
-
|
|
|
452 |
}
|
453 |
}
|
454 |
|
@@ -651,7 +652,6 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
651 |
if ($option['expires'] != 0 && $option['expires'] < time()) {
|
652 |
die();
|
653 |
}
|
654 |
-
|
655 |
$crypt = new WPvivid_crypt(base64_decode($option['private_key']));
|
656 |
$body = base64_decode($_POST['wpvivid_content']);
|
657 |
$data = $crypt->decrypt_message($body);
|
@@ -661,7 +661,6 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
661 |
echo json_encode($ret);
|
662 |
die();
|
663 |
}
|
664 |
-
|
665 |
$params = json_decode($data, 1);
|
666 |
if (is_null($params)) {
|
667 |
$ret['result'] = WPVIVID_FAILED;
|
@@ -669,7 +668,6 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
669 |
echo json_encode($ret);
|
670 |
die();
|
671 |
}
|
672 |
-
|
673 |
global $wpvivid_plugin;
|
674 |
$wpvivid_plugin->wpvivid_log = new WPvivid_Log();
|
675 |
$wpvivid_plugin->wpvivid_log->OpenLogFile($params['backup_id'] . '_backup', 'no_folder', 'backup');
|
@@ -681,7 +679,6 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
681 |
$list[$params['backup_id']] = $backup_data;
|
682 |
WPvivid_Setting::update_option('wpvivid_backup_list', $list);
|
683 |
}
|
684 |
-
|
685 |
$ret['result'] = WPVIVID_SUCCESS;
|
686 |
echo json_encode($ret);
|
687 |
}
|
@@ -695,7 +692,8 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
695 |
die();
|
696 |
}
|
697 |
|
698 |
-
public function get_backup_data_by_task($task)
|
|
|
699 |
global $wpvivid_plugin;
|
700 |
$backup_data=array();
|
701 |
$backup_data['type']='Migration';
|
@@ -708,6 +706,7 @@ class WPvivid_Send_to_site extends WPvivid_Remote
|
|
708 |
$backup_data['backup']=$this->get_backup_result_by_task($task);
|
709 |
$backup_data['remote']=array();
|
710 |
$backup_data['lock']=0;
|
|
|
711 |
return $backup_data;
|
712 |
}
|
713 |
|
448 |
else
|
449 |
{
|
450 |
$ret['result']=WPVIVID_FAILED;
|
451 |
+
//$ret['error']= 'Upload error '.$response['response']['code'].' '.$response['body'];
|
452 |
+
$ret['error']= 'Upload error '.$response['response']['code'];
|
453 |
}
|
454 |
}
|
455 |
|
652 |
if ($option['expires'] != 0 && $option['expires'] < time()) {
|
653 |
die();
|
654 |
}
|
|
|
655 |
$crypt = new WPvivid_crypt(base64_decode($option['private_key']));
|
656 |
$body = base64_decode($_POST['wpvivid_content']);
|
657 |
$data = $crypt->decrypt_message($body);
|
661 |
echo json_encode($ret);
|
662 |
die();
|
663 |
}
|
|
|
664 |
$params = json_decode($data, 1);
|
665 |
if (is_null($params)) {
|
666 |
$ret['result'] = WPVIVID_FAILED;
|
668 |
echo json_encode($ret);
|
669 |
die();
|
670 |
}
|
|
|
671 |
global $wpvivid_plugin;
|
672 |
$wpvivid_plugin->wpvivid_log = new WPvivid_Log();
|
673 |
$wpvivid_plugin->wpvivid_log->OpenLogFile($params['backup_id'] . '_backup', 'no_folder', 'backup');
|
679 |
$list[$params['backup_id']] = $backup_data;
|
680 |
WPvivid_Setting::update_option('wpvivid_backup_list', $list);
|
681 |
}
|
|
|
682 |
$ret['result'] = WPVIVID_SUCCESS;
|
683 |
echo json_encode($ret);
|
684 |
}
|
692 |
die();
|
693 |
}
|
694 |
|
695 |
+
public function get_backup_data_by_task($task)
|
696 |
+
{
|
697 |
global $wpvivid_plugin;
|
698 |
$backup_data=array();
|
699 |
$backup_data['type']='Migration';
|
706 |
$backup_data['backup']=$this->get_backup_result_by_task($task);
|
707 |
$backup_data['remote']=array();
|
708 |
$backup_data['lock']=0;
|
709 |
+
$backup_data=apply_filters('wpvivid_get_backup_data_by_task',$backup_data,$task);
|
710 |
return $backup_data;
|
711 |
}
|
712 |
|
includes/customclass/class-wpvivid-sftpclass.php
CHANGED
@@ -44,32 +44,111 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
|
|
44 |
{
|
45 |
?>
|
46 |
<div id="storage_account_sftp" class="storage-account-page" style="display:none;">
|
47 |
-
<
|
48 |
-
|
49 |
-
<input type="text" autocomplete="off" option="sftp" name="name" placeholder="Enter an unique alias: e.g. SFTP-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
50 |
</div>
|
51 |
-
<
|
52 |
-
<
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</div>
|
74 |
<?php
|
75 |
}
|
@@ -78,26 +157,97 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
|
|
78 |
{
|
79 |
?>
|
80 |
<div id="remote_storage_edit_sftp" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
81 |
-
<
|
82 |
-
|
83 |
-
<input type="text" option="edit-sftp" name="name" placeholder="Enter an unique alias: e.g. SFTP-001" class="regular-text" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
84 |
-
</div>
|
85 |
-
<div class="storage-account-form">
|
86 |
-
<input type="text" option="edit-sftp" name="host" placeholder="Server IP Address" class="regular-text"/>
|
87 |
-
</div>
|
88 |
-
<div class="storage-account-form">
|
89 |
-
<input type="text" option="edit-sftp" name="username" placeholder="User Name" class="regular-text"/>
|
90 |
-
</div>
|
91 |
-
<div class="storage-account-form">
|
92 |
-
<input type="password" option="edit-sftp" name="password" placeholder="Root Password" class="regular-text"/>
|
93 |
-
</div>
|
94 |
-
<div class="storage-account-form">
|
95 |
-
<input type="text" option="edit-sftp" name="port" placeholder="Port" class="regular-text" onkeyup="value=value.replace(/\D/g,'')" />
|
96 |
-
</div>
|
97 |
-
<div class="storage-account-form">
|
98 |
-
<input type="text" option="edit-sftp" name="path" placeholder="Absolute path must exist(e.g. /var/)" class="regular-text"/>
|
99 |
</div>
|
100 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
</div>
|
102 |
<?php
|
103 |
}
|
44 |
{
|
45 |
?>
|
46 |
<div id="storage_account_sftp" class="storage-account-page" style="display:none;">
|
47 |
+
<div style="padding: 0 10px 10px 0;">
|
48 |
+
<strong>Enter Your SFTP Account</strong>
|
|
|
49 |
</div>
|
50 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
51 |
+
<tbody>
|
52 |
+
<tr>
|
53 |
+
<td class="plugin-title column-primary">
|
54 |
+
<div class="wpvivid-storage-form">
|
55 |
+
<input type="text" class="regular-text" autocomplete="off" option="sftp" name="name" placeholder="Enter a unique alias: e.g. SFTP-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
56 |
+
</div>
|
57 |
+
</td>
|
58 |
+
<td class="column-description desc">
|
59 |
+
<div class="wpvivid-storage-form-desc">
|
60 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
61 |
+
</div>
|
62 |
+
</td>
|
63 |
+
</tr>
|
64 |
+
<tr>
|
65 |
+
<td class="plugin-title column-primary">
|
66 |
+
<div class="wpvivid-storage-form">
|
67 |
+
<input type="text" class="regular-text" autocomplete="off" option="sftp" name="host" placeholder="Server Address" />
|
68 |
+
</div>
|
69 |
+
</td>
|
70 |
+
<td class="column-description desc">
|
71 |
+
<div class="wpvivid-storage-form-desc">
|
72 |
+
<i>Enter the server address.</i>
|
73 |
+
</div>
|
74 |
+
</td>
|
75 |
+
</tr>
|
76 |
+
<tr>
|
77 |
+
<td class="plugin-title column-primary">
|
78 |
+
<div class="wpvivid-storage-form">
|
79 |
+
<input type="text" class="regular-text" autocomplete="off" option="sftp" name="username" placeholder="User Name" />
|
80 |
+
</div>
|
81 |
+
</td>
|
82 |
+
<td class="column-description desc">
|
83 |
+
<div class="wpvivid-storage-form-desc">
|
84 |
+
<i>Enter the user name.</i>
|
85 |
+
</div>
|
86 |
+
</td>
|
87 |
+
</tr>
|
88 |
+
<tr>
|
89 |
+
<td class="plugin-title column-primary">
|
90 |
+
<div class="wpvivid-storage-form">
|
91 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="sftp" name="password" placeholder="User Password" />
|
92 |
+
</div>
|
93 |
+
</td>
|
94 |
+
<td class="column-description desc">
|
95 |
+
<div class="wpvivid-storage-form-desc">
|
96 |
+
<i>Enter the user password.</i>
|
97 |
+
</div>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
<tr>
|
101 |
+
<td class="plugin-title column-primary">
|
102 |
+
<div class="wpvivid-storage-form">
|
103 |
+
<input type="text" class="regular-text" autocomplete="off" option="sftp" name="port" placeholder="Port" onkeyup="value=value.replace(/\D/g,'')" />
|
104 |
+
</div>
|
105 |
+
</td>
|
106 |
+
<td class="column-description desc">
|
107 |
+
<div class="wpvivid-storage-form-desc">
|
108 |
+
<i>Enter the server port.</i>
|
109 |
+
</div>
|
110 |
+
</td>
|
111 |
+
</tr>
|
112 |
+
<tr>
|
113 |
+
<td class="plugin-title column-primary">
|
114 |
+
<div class="wpvivid-storage-form">
|
115 |
+
<input type="text" class="regular-text" autocomplete="off" option="sftp" name="path" placeholder="Absolute path must exist(e.g. /var)" />
|
116 |
+
</div>
|
117 |
+
</td>
|
118 |
+
<td class="column-description desc">
|
119 |
+
<div class="wpvivid-storage-form-desc">
|
120 |
+
<i>Enter an absolute path and a custom subdirectory (optional) for holding the backups of current website. For example, /var/customfolder/</i>
|
121 |
+
</div>
|
122 |
+
</td>
|
123 |
+
</tr>
|
124 |
+
<tr>
|
125 |
+
<td class="plugin-title column-primary">
|
126 |
+
<div class="wpvivid-storage-select">
|
127 |
+
<label>
|
128 |
+
<input type="checkbox" option="sftp" name="default" checked />Set as the default remote storage.
|
129 |
+
</label>
|
130 |
+
</div>
|
131 |
+
</td>
|
132 |
+
<td class="column-description desc">
|
133 |
+
<div class="wpvivid-storage-form-desc">
|
134 |
+
<i>Once checked, all this sites backups sent to a remote storage destination will be uploaded to this storage by default.</i>
|
135 |
+
</div>
|
136 |
+
</td>
|
137 |
+
</tr>
|
138 |
+
<tr>
|
139 |
+
<td class="plugin-title column-primary">
|
140 |
+
<div class="wpvivid-storage-form">
|
141 |
+
<input class="button-primary" option="add-remote" type="submit" value="Test and Add" />
|
142 |
+
</div>
|
143 |
+
</td>
|
144 |
+
<td class="column-description desc">
|
145 |
+
<div class="wpvivid-storage-form-desc">
|
146 |
+
<i>Click the button to connect to SFTP server and add it to the storage list below.</i>
|
147 |
+
</div>
|
148 |
+
</td>
|
149 |
+
</tr>
|
150 |
+
</tbody>
|
151 |
+
</table>
|
152 |
</div>
|
153 |
<?php
|
154 |
}
|
157 |
{
|
158 |
?>
|
159 |
<div id="remote_storage_edit_sftp" class="postbox storage-account-block remote-storage-edit" style="display:none;">
|
160 |
+
<div style="padding: 0 10px 10px 0;">
|
161 |
+
<strong>Enter Your SFTP Account</strong>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
</div>
|
163 |
+
<table class="wp-list-table widefat plugins" style="width:100%;">
|
164 |
+
<tbody>
|
165 |
+
<tr>
|
166 |
+
<td class="plugin-title column-primary">
|
167 |
+
<div class="wpvivid-storage-form">
|
168 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-sftp" name="name" placeholder="Enter a unique alias: e.g. SFTP-001" onkeyup="value=value.replace(/[^a-zA-Z0-9\-_]/g,'')" />
|
169 |
+
</div>
|
170 |
+
</td>
|
171 |
+
<td class="column-description desc">
|
172 |
+
<div class="wpvivid-storage-form-desc">
|
173 |
+
<i>A name to help you identify the storage if you have multiple remote storage connected.</i>
|
174 |
+
</div>
|
175 |
+
</td>
|
176 |
+
</tr>
|
177 |
+
<tr>
|
178 |
+
<td class="plugin-title column-primary">
|
179 |
+
<div class="wpvivid-storage-form">
|
180 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-sftp" name="host" placeholder="Server Address" />
|
181 |
+
</div>
|
182 |
+
</td>
|
183 |
+
<td class="column-description desc">
|
184 |
+
<div class="wpvivid-storage-form-desc">
|
185 |
+
<i>Enter the server address.</i>
|
186 |
+
</div>
|
187 |
+
</td>
|
188 |
+
</tr>
|
189 |
+
<tr>
|
190 |
+
<td class="plugin-title column-primary">
|
191 |
+
<div class="wpvivid-storage-form">
|
192 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-sftp" name="username" placeholder="User Name" />
|
193 |
+
</div>
|
194 |
+
</td>
|
195 |
+
<td class="column-description desc">
|
196 |
+
<div class="wpvivid-storage-form-desc">
|
197 |
+
<i>Enter the user name.</i>
|
198 |
+
</div>
|
199 |
+
</td>
|
200 |
+
</tr>
|
201 |
+
<tr>
|
202 |
+
<td class="plugin-title column-primary">
|
203 |
+
<div class="wpvivid-storage-form">
|
204 |
+
<input type="password" class="regular-text" autocomplete="new-password" option="edit-sftp" name="password" placeholder="User Password" />
|
205 |
+
</div>
|
206 |
+
</td>
|
207 |
+
<td class="column-description desc">
|
208 |
+
<div class="wpvivid-storage-form-desc">
|
209 |
+
<i>Enter the user password.</i>
|
210 |
+
</div>
|
211 |
+
</td>
|
212 |
+
</tr>
|
213 |
+
<tr>
|
214 |
+
<td class="plugin-title column-primary">
|
215 |
+
<div class="wpvivid-storage-form">
|
216 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-sftp" name="port" placeholder="Port" onkeyup="value=value.replace(/\D/g,'')" />
|
217 |
+
</div>
|
218 |
+
</td>
|
219 |
+
<td class="column-description desc">
|
220 |
+
<div class="wpvivid-storage-form-desc">
|
221 |
+
<i>Enter the server port.</i>
|
222 |
+
</div>
|
223 |
+
</td>
|
224 |
+
</tr>
|
225 |
+
<tr>
|
226 |
+
<td class="plugin-title column-primary">
|
227 |
+
<div class="wpvivid-storage-form">
|
228 |
+
<input type="text" class="regular-text" autocomplete="off" option="edit-sftp" name="path" placeholder="Absolute path must exist(e.g. /var)" />
|
229 |
+
</div>
|
230 |
+
</td>
|
231 |
+
<td class="column-description desc">
|
232 |
+
<div class="wpvivid-storage-form-desc">
|
233 |
+
<i>Enter an absolute path and a custom subdirectory (optional) for holding the backups of current website. For example, /var/customfolder/</i>
|
234 |
+
</div>
|
235 |
+
</td>
|
236 |
+
</tr>
|
237 |
+
<tr>
|
238 |
+
<td class="plugin-title column-primary">
|
239 |
+
<div class="wpvivid-storage-form">
|
240 |
+
<input class="button-primary" option="edit-remote" type="submit" value="Save Changes" />
|
241 |
+
</div>
|
242 |
+
</td>
|
243 |
+
<td class="column-description desc">
|
244 |
+
<div class="wpvivid-storage-form-desc">
|
245 |
+
<i>Click the button to save the changes.</i>
|
246 |
+
</div>
|
247 |
+
</td>
|
248 |
+
</tr>
|
249 |
+
</tbody>
|
250 |
+
</table>
|
251 |
</div>
|
252 |
<?php
|
253 |
}
|
readme.txt
CHANGED
@@ -1,19 +1,34 @@
|
|
1 |
-
===
|
2 |
Contributors: wpvivid
|
3 |
Tags: move, clone, migrate, copy, backup, restore, auto backup, cloud backup
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
11 |
-
|
12 |
|
13 |
== Description ==
|
14 |
WPvivid Backup Plugin is the only free all-in-one backup, restore and migration WordPress plugin.
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
== Supported Page Builders ==
|
19 |
WPvivid Backup Plugin has been tested by our users to migrate well on websites built with:
|
@@ -24,14 +39,14 @@ WPvivid Backup Plugin has been tested by our users to migrate well on websites b
|
|
24 |
== Core Features ==
|
25 |
|
26 |
= 1. Easy Site Move or Migration (New Feature) =
|
27 |
-
|
28 |
|
29 |
-
You can also
|
30 |
|
31 |
-
You are free to choose what to
|
32 |
= 2. Upload Backups (New Feature) =
|
33 |
-
Upload a backup to restore or
|
34 |
-
You can
|
35 |
= 3. Automatic Backup =
|
36 |
Setup and forget, the plugin will do the rest automatically backing up your website.
|
37 |
= 4. One-Click Restore =
|
@@ -41,15 +56,15 @@ Restore your WordPress site from a backup with a single click.
|
|
41 |
|
42 |
Dropbox, Google Drive, Microsoft OneDrive, Amazon S3, DigitalOcean Spaces, SFTP, FTP and more are coming soon.
|
43 |
|
44 |
-
== Site
|
45 |
1. Install the WPvivid Backup plugin on both the destination site and the sending site.
|
46 |
2. Generate a site key on the destination site with one click.
|
47 |
3. Paste the key in the sending site and save it.
|
48 |
-
4.
|
49 |
|
50 |
== Features Spotlight ==
|
51 |
* One-Click Site Move or Migration
|
52 |
-
* Upload Backups to Restore or
|
53 |
* Schedule Automated Backups
|
54 |
* One-Click Restore
|
55 |
* Manual Backup
|
@@ -104,7 +119,7 @@ In addition, the implementations of all migrations, backups and restores of your
|
|
104 |
The only personal data currently we can access are the contact data when you contact us by email, which may include your name, email address and other contact details. The data will only be used for the purposes of handling and resolving your enquiry.
|
105 |
= How does WPvivid Backup plugin help users create a GDPR compliant backup? =
|
106 |
In order to help users create a GDPR compliant backup, the plugin comes with multiple features including selection for backup content, backup and restore logs, and email report. Moreover, as the plugin itself does not collect any personal data, you do not need to sign a Data Processing Agreement (DPA) with us.
|
107 |
-
However, if you
|
108 |
Check out the [privacy policy](https://wpvivid.com/privacy-policy) involving the use of Google Drive, Dropbox and Microsoft OneDrive.
|
109 |
|
110 |
== License ==
|
@@ -116,12 +131,12 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
116 |
2. Backup list
|
117 |
3. Dashboard
|
118 |
4. Configure remote storage
|
119 |
-
5.
|
120 |
-
6. Upload a backup to restore or
|
121 |
|
122 |
== Frequently Asked Questions ==
|
123 |
= What does WPvivid Backup plugin do? =
|
124 |
-
As its name says, it is an all in one free WP backup plugin that enables you to easily
|
125 |
= Does the plugin also migrate my site? Is it a free feature? =
|
126 |
Yes, we have added website migration feature since version 0.9.14.
|
127 |
Yes, it's a completely free feature.
|
@@ -140,12 +155,18 @@ If your website is running on WordPress then yes it will.
|
|
140 |
|
141 |
The plugin has been extensively tested on the shared and dedicated hosting plans from the leading website hosting providers like Godaddy, Siteground, and many others.
|
142 |
= Do you have any get-started guides/docs? =
|
143 |
-
Yes, we do. Here are the guides for [
|
144 |
|
145 |
== Contact us ==
|
146 |
Feel free to let us know how we can help using the [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore) for the plugin on WordPress.org or our [contact form](https://wpvivid.com/contact-us). You can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
|
147 |
|
148 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
= 0.9.24 =
|
150 |
- Fixed some bugs in the plugin code.
|
151 |
- Fixed: Could not restore files to proper directories if one had customized the sites file structure.
|
1 |
+
=== Migrate & Backup WordPress - WPvivid Backup Plugin ===
|
2 |
Contributors: wpvivid
|
3 |
Tags: move, clone, migrate, copy, backup, restore, auto backup, cloud backup
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.25
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
11 |
+
Migrate a copy of WP site to a new host (a new domain),schedule backups,send backups to leading remote storage. All in one backup&migration plugin
|
12 |
|
13 |
== Description ==
|
14 |
WPvivid Backup Plugin is the only free all-in-one backup, restore and migration WordPress plugin.
|
15 |
|
16 |
+
Migrate a copy of WP site to a new host (a new domain),schedule backups,send backups to leading remote storage. All in one backup&migration plugin.
|
17 |
+
|
18 |
+
== WPvivid Backup for MainWP ==
|
19 |
+
[WPvivid Backup for MainWP](https://wordpress.org/plugins/wpvivid-backup-mainwp/) is now available to download.
|
20 |
+
This extension allows you to set up and control WPvivid Backup Plugin for all child sites directly from your MainWP dashboard.
|
21 |
+
|
22 |
+
== A Beta of Pro Version is Now Available ==
|
23 |
+
* Customize everything to backup
|
24 |
+
* Create a staging or dev environment
|
25 |
+
* Rollback WordPress core, themes, and plugins
|
26 |
+
* WordPress Multisite backup
|
27 |
+
* Advanced remote storage
|
28 |
+
* Advanced backup schedules
|
29 |
+
* Restore from remote storage
|
30 |
+
* Migrate everything via remote storage
|
31 |
+
[Welcome to test for free!](https://wpvivid.com/pro-version-beta-testing)
|
32 |
|
33 |
== Supported Page Builders ==
|
34 |
WPvivid Backup Plugin has been tested by our users to migrate well on websites built with:
|
39 |
== Core Features ==
|
40 |
|
41 |
= 1. Easy Site Move or Migration (New Feature) =
|
42 |
+
Migrate your WordPress site to a new domain with a single click. The plugin supports site migration from dev environment to a new server, from dev environment to a new domain or from a live server to another.
|
43 |
|
44 |
+
You can also migrate a site to a subdirectory, from a.com to b.com, from a.com to a.com/directory and from a.com to b.com/directory.
|
45 |
|
46 |
+
You are free to choose what to migrate: the entire site, files or just the database only.
|
47 |
= 2. Upload Backups (New Feature) =
|
48 |
+
Upload a backup to restore or migrate.
|
49 |
+
You can migrate or restore backups created with 0.9.14 or a higher version.
|
50 |
= 3. Automatic Backup =
|
51 |
Setup and forget, the plugin will do the rest automatically backing up your website.
|
52 |
= 4. One-Click Restore =
|
56 |
|
57 |
Dropbox, Google Drive, Microsoft OneDrive, Amazon S3, DigitalOcean Spaces, SFTP, FTP and more are coming soon.
|
58 |
|
59 |
+
== Site Migration Process ==
|
60 |
1. Install the WPvivid Backup plugin on both the destination site and the sending site.
|
61 |
2. Generate a site key on the destination site with one click.
|
62 |
3. Paste the key in the sending site and save it.
|
63 |
+
4. Migrate the site with one-click.
|
64 |
|
65 |
== Features Spotlight ==
|
66 |
* One-Click Site Move or Migration
|
67 |
+
* Upload Backups to Restore or Migrate
|
68 |
* Schedule Automated Backups
|
69 |
* One-Click Restore
|
70 |
* Manual Backup
|
119 |
The only personal data currently we can access are the contact data when you contact us by email, which may include your name, email address and other contact details. The data will only be used for the purposes of handling and resolving your enquiry.
|
120 |
= How does WPvivid Backup plugin help users create a GDPR compliant backup? =
|
121 |
In order to help users create a GDPR compliant backup, the plugin comes with multiple features including selection for backup content, backup and restore logs, and email report. Moreover, as the plugin itself does not collect any personal data, you do not need to sign a Data Processing Agreement (DPA) with us.
|
122 |
+
However, if you migrate your backups to cloud storage with Migrate & Backup WordPress - WPvivid Backup Plugin, the personal data is moved to that storage provider. You'll need to sign a Data Processing Agreement with that provider.
|
123 |
Check out the [privacy policy](https://wpvivid.com/privacy-policy) involving the use of Google Drive, Dropbox and Microsoft OneDrive.
|
124 |
|
125 |
== License ==
|
131 |
2. Backup list
|
132 |
3. Dashboard
|
133 |
4. Configure remote storage
|
134 |
+
5. Migrate a WordPress site to a new domain
|
135 |
+
6. Upload a backup to restore or migrate
|
136 |
|
137 |
== Frequently Asked Questions ==
|
138 |
= What does WPvivid Backup plugin do? =
|
139 |
+
As its name says, it is an all in one free WP backup plugin that enables you to easily migrate a WordPress site to a new domain, to perform manual and scheduled backups of your WordPress site, to back up to cloud storage and restore backups directly from your sites admin dashboard.
|
140 |
= Does the plugin also migrate my site? Is it a free feature? =
|
141 |
Yes, we have added website migration feature since version 0.9.14.
|
142 |
Yes, it's a completely free feature.
|
155 |
|
156 |
The plugin has been extensively tested on the shared and dedicated hosting plans from the leading website hosting providers like Godaddy, Siteground, and many others.
|
157 |
= Do you have any get-started guides/docs? =
|
158 |
+
Yes, we do. Here are the guides for [Migrating your site to a new host](https://wpvivid.com/get-started-transfer-site.html), [creating a manual backup](https://wpvivid.com/get-started-create-a-manual-backup.html), [restoring your site from a backup](https://wpvivid.com/get-started-restore-site.html), [the plugin settings](https://wpvivid.com/get-started-settings.html).
|
159 |
|
160 |
== Contact us ==
|
161 |
Feel free to let us know how we can help using the [support forum](https://wordpress.org/support/plugin/wpvivid-backuprestore) for the plugin on WordPress.org or our [contact form](https://wpvivid.com/contact-us). You can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
|
162 |
|
163 |
== Changelog ==
|
164 |
+
= 0.9.25 =
|
165 |
+
- Fixed: Could not restore websites in some cases.
|
166 |
+
- Fixed: The setting of PHP version that had been changed in .htaccess was lost after restoration.
|
167 |
+
- Added an option to merge all backup files into a package when a backup completes. This can increase backup and migration success rate in a website with insufficient server resources.
|
168 |
+
- Upgraded: Amazon S3 and DigitalOcean Space have upgraded their connection methods, so you will need to delete the previous connections and re-add your Amazon S3/DigtalOcean Space accounts to make sure the connections work.
|
169 |
+
- Optimized the plugin code.
|
170 |
= 0.9.24 =
|
171 |
- Fixed some bugs in the plugin code.
|
172 |
- Fixed: Could not restore files to proper directories if one had customized the sites file structure.
|
wpvivid-backuprestore.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid Backup Plugin
|
9 |
* Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
|
10 |
-
* Version: 0.9.
|
11 |
* Author: WPvivid Team
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
@@ -21,7 +21,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
21 |
die;
|
22 |
}
|
23 |
|
24 |
-
define( 'WPVIVID_PLUGIN_VERSION', '0.9.
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid Backup Plugin
|
9 |
* Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
|
10 |
+
* Version: 0.9.25
|
11 |
* Author: WPvivid Team
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
21 |
die;
|
22 |
}
|
23 |
|
24 |
+
define( 'WPVIVID_PLUGIN_VERSION', '0.9.25' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|