Version Description
- Fixed data type errors caused by the last update. The errors would cause the failure of running of scheduled backup tasks. We highly recommend you upgrade.
- Fixed a bug where the last backup information was not displayed in the backup schedule list.
- Changed a few error messages that appear during the backup process.
- Optimized the code of the plugin.
Download this release
Release Info
Developer | wpvivid |
Plugin | Migration, Backup, Staging – WPvivid |
Version | 0.9.7 |
Comparing to | |
See all releases |
Code changes from version 0.9.6 to 0.9.7
- admin/class-wpvivid-admin.php +0 -32
- admin/js/wpvivid-admin.js +153 -137
- admin/partials/wpvivid-admin-display.php +2 -2
- admin/partials/wpvivid-backup-restore-page-display.php +3 -2
- admin/partials/wpvivid-remote-storage-page-display.php +0 -2
- admin/partials/wpvivid-settings-page-display.php +6 -3
- includes/class-wpvivid-backup.php +9 -5
- includes/class-wpvivid-backuptoremote.php +0 -56
- includes/class-wpvivid-schedule.php +2 -0
- includes/class-wpvivid-setting.php +26 -1
- includes/class-wpvivid.php +205 -17
- includes/customclass/class-wpvivid-amazons3-plus.php +12 -6
- includes/customclass/class-wpvivid-ftpclass.php +2 -0
- includes/customclass/class-wpvivid-remote.php +0 -24
- includes/customclass/class-wpvivid-sftpclass.php +2 -19
- readme.txt +14 -7
- wpvivid-backuprestore.php +2 -2
admin/class-wpvivid-admin.php
CHANGED
@@ -218,8 +218,6 @@ class WPvivid_Admin {
|
|
218 |
global $wpvivid_pulgin;
|
219 |
$wpvivid_pulgin->clean_cache();
|
220 |
|
221 |
-
$this->wpvivid_show_add_my_review();
|
222 |
-
|
223 |
$restore = new WPvivid_restore_data();
|
224 |
if ($restore->has_restore()) {
|
225 |
$restore_status = $restore->get_restore_status();
|
@@ -267,34 +265,4 @@ class WPvivid_Admin {
|
|
267 |
return $request_page;
|
268 |
}
|
269 |
|
270 |
-
public static function wpvivid_show_add_my_review()
|
271 |
-
{
|
272 |
-
$review = get_option('wpvivid_need_review');
|
273 |
-
|
274 |
-
if (empty($review)) {
|
275 |
-
update_option('wpvivid_need_review', 'not');
|
276 |
-
} else {
|
277 |
-
if ($review == 'not') {
|
278 |
-
} else if ($review == 'show') {
|
279 |
-
_e('<div class="notice notice-info is-dismissible" id="wpvivid_notice_rate">
|
280 |
-
<p>Rate WPvivid Backup/Restore?
|
281 |
-
<span><input type="button" class="button-primary" id="wpvivid_review_comment" value="Rate now" /></span>
|
282 |
-
<span><input type="button" class="button-primary" id="wpvivid_review_not_ask" value="Never ask again" /></span>
|
283 |
-
<span><input type="button" class="button-primary" id="wpvivid_review_ask_later" value="Ask me later" /></span>
|
284 |
-
</p>
|
285 |
-
</div>');
|
286 |
-
} else if ($review == 'do_not_ask') {
|
287 |
-
} else {
|
288 |
-
if (time() > $review) {
|
289 |
-
_e('<div class="notice notice-info is-dismissible" id="wpvivid_notice_rate">
|
290 |
-
<p>Rate WPvivid Backup/Restore?
|
291 |
-
<span><input type="button" class="button-primary" id="wpvivid_review_comment" value="Rate now" /></span>
|
292 |
-
<span><input type="button" class="button-primary" id="wpvivid_review_not_ask" value="Never ask again" /></span>
|
293 |
-
<span><input type="button" class="button-primary" id="wpvivid_review_ask_later" value="Ask me later" /></span>
|
294 |
-
</p>
|
295 |
-
</div>');
|
296 |
-
}
|
297 |
-
}
|
298 |
-
}
|
299 |
-
}
|
300 |
}
|
218 |
global $wpvivid_pulgin;
|
219 |
$wpvivid_pulgin->clean_cache();
|
220 |
|
|
|
|
|
221 |
$restore = new WPvivid_restore_data();
|
222 |
if ($restore->has_restore()) {
|
223 |
$restore_status = $restore->get_restore_status();
|
265 |
return $request_page;
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
admin/js/wpvivid-admin.js
CHANGED
@@ -5,6 +5,7 @@ var m_need_update=true;
|
|
5 |
var m_restore_backup_id;
|
6 |
var m_backup_task_id;
|
7 |
var m_downloading_file_name = '';
|
|
|
8 |
var wpvivid_settings_changed = false;
|
9 |
var wpvivid_cur_log_page = 1;
|
10 |
var wpvivid_completed_backup = 1;
|
@@ -61,7 +62,7 @@ var wpvivid_location_href=false;
|
|
61 |
wpvivid_settings_changed = false;
|
62 |
});
|
63 |
|
64 |
-
$('
|
65 |
var storage_type = $(".storage-providers-active").attr("remote_type");
|
66 |
wpvivid_add_remote_storage('wpvivid_test_remote_connection', storage_type);
|
67 |
wpvivid_settings_changed = false;
|
@@ -163,19 +164,6 @@ var wpvivid_location_href=false;
|
|
163 |
$('#wpvivid_download_website_info').click(function(){
|
164 |
wpvivid_download_website_info();
|
165 |
});
|
166 |
-
|
167 |
-
$('#wpvivid_review_comment').click(function(){
|
168 |
-
window.open('https://wordpress.org/support/plugin/wpvivid-backuprestore/reviews/?filter=5');
|
169 |
-
wpvivid_add_review_info('do_not_ask');
|
170 |
-
});
|
171 |
-
|
172 |
-
$('#wpvivid_review_not_ask').click(function(){
|
173 |
-
wpvivid_add_review_info('do_not_ask');
|
174 |
-
});
|
175 |
-
|
176 |
-
$('#wpvivid_review_ask_later').click(function(){
|
177 |
-
wpvivid_add_review_info('next_time');
|
178 |
-
});
|
179 |
});
|
180 |
|
181 |
})(jQuery);
|
@@ -424,6 +412,8 @@ function wpvivid_check_runningtask(){
|
|
424 |
else if (value1.status === 'completed') {
|
425 |
if (m_downloading_file_name === file_name) {
|
426 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
|
|
|
|
427 |
}
|
428 |
progress = '100%';
|
429 |
jQuery('#' + tmp_current_click_backupid + '-text-part-' + i).html('<a onclick="wpvivid_download(\'' + tmp_current_click_backupid + '\', \'' + index + '\', \'' + file_name + '\');" style="cursor: pointer">Download</a>');
|
@@ -432,6 +422,8 @@ function wpvivid_check_runningtask(){
|
|
432 |
else if (value1.status === 'error') {
|
433 |
if (m_downloading_file_name === file_name) {
|
434 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
|
|
|
|
435 |
}
|
436 |
alert(value1.error);
|
437 |
progress = '0%';
|
@@ -441,6 +433,8 @@ function wpvivid_check_runningtask(){
|
|
441 |
else if (value1.stauts === 'timeout') {
|
442 |
if (m_downloading_file_name === file_name) {
|
443 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
|
|
|
|
444 |
}
|
445 |
alert('Download timeout, please retry.');
|
446 |
progress = '0%';
|
@@ -511,64 +505,81 @@ function wpvivid_read_backup_log(){
|
|
511 |
* Start backing up
|
512 |
*/
|
513 |
function wpvivid_start_backup(){
|
514 |
-
var
|
515 |
-
var
|
516 |
-
|
517 |
-
'backup'
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
}
|
543 |
-
else{
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
}
|
560 |
}
|
561 |
}
|
562 |
}
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
}
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
}
|
571 |
-
|
572 |
}
|
573 |
|
574 |
function wpvivid_delete_ready_task(error){
|
@@ -615,6 +626,7 @@ function wpvivid_delete_selected_backup(backup_id){
|
|
615 |
});
|
616 |
var descript = '';
|
617 |
var force_del = 0;
|
|
|
618 |
if(name === 'lock') {
|
619 |
descript = 'This backup is locked, are you sure to remove it? This backup will be deleted permanently from your hosting (localhost) and remote storages.';
|
620 |
force_del = 1;
|
@@ -623,6 +635,11 @@ function wpvivid_delete_selected_backup(backup_id){
|
|
623 |
descript = 'Are you sure to remove this backup? This backup will be deleted permanently from your hosting (localhost) and remote storages.';
|
624 |
force_del = 0;
|
625 |
}
|
|
|
|
|
|
|
|
|
|
|
626 |
var ret = confirm(descript);
|
627 |
if(ret === true){
|
628 |
var ajax_data={
|
@@ -632,6 +649,9 @@ function wpvivid_delete_selected_backup(backup_id){
|
|
632 |
};
|
633 |
wpvivid_post_request(ajax_data, function(data){
|
634 |
wpvivid_handle_backup_data(data);
|
|
|
|
|
|
|
635 |
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
636 |
var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
|
637 |
alert(error_message);
|
@@ -645,11 +665,15 @@ function wpvivid_delete_selected_backup(backup_id){
|
|
645 |
function wpvivid_delete_backups_inbatches(){
|
646 |
var delete_backup_array = new Array();
|
647 |
var count = 0;
|
|
|
648 |
jQuery('#wpvivid_backuplist tr').each(function (i) {
|
649 |
jQuery(this).children('th').each(function (j) {
|
650 |
if (j == 0) {
|
651 |
if(jQuery(this).find('input[type=checkbox]').prop('checked')){
|
652 |
delete_backup_array[count] = jQuery(this).find('input[type=checkbox]').attr('id');
|
|
|
|
|
|
|
653 |
count++;
|
654 |
}
|
655 |
}
|
@@ -659,7 +683,13 @@ function wpvivid_delete_backups_inbatches(){
|
|
659 |
alert('Please select at least one item.');
|
660 |
}
|
661 |
else {
|
662 |
-
var descript = '
|
|
|
|
|
|
|
|
|
|
|
|
|
663 |
var ret = confirm(descript);
|
664 |
if (ret === true) {
|
665 |
var ajax_data = {
|
@@ -668,6 +698,10 @@ function wpvivid_delete_backups_inbatches(){
|
|
668 |
};
|
669 |
wpvivid_post_request(ajax_data, function (data) {
|
670 |
wpvivid_handle_backup_data(data);
|
|
|
|
|
|
|
|
|
671 |
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
672 |
var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
|
673 |
alert(error_message);
|
@@ -763,6 +797,7 @@ function wpvivid_add_remote_storage(action, storage_type)
|
|
763 |
'remote': remote_from,
|
764 |
'type': storage_type
|
765 |
};
|
|
|
766 |
wpvivid_post_request(ajax_data, function (data) {
|
767 |
if (action === 'wpvivid_test_remote_connection') {
|
768 |
try {
|
@@ -772,15 +807,16 @@ function wpvivid_add_remote_storage(action, storage_type)
|
|
772 |
}
|
773 |
else if (jsonarray.result === 'failed') {
|
774 |
alert(jsonarray.error);
|
775 |
-
jQuery('
|
776 |
}
|
777 |
}
|
778 |
catch (err) {
|
779 |
alert(err);
|
780 |
-
jQuery('
|
781 |
}
|
782 |
}
|
783 |
else if (action === 'wpvivid_add_remote') {
|
|
|
784 |
jQuery('input:text[option='+storage_type+']').each(function(){
|
785 |
jQuery(this).val('');
|
786 |
});
|
@@ -790,7 +826,7 @@ function wpvivid_add_remote_storage(action, storage_type)
|
|
790 |
wpvivid_handle_remote_storage_data(data);
|
791 |
}
|
792 |
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
793 |
-
jQuery('
|
794 |
if (action === 'wpvivid_test_remote_connection') {
|
795 |
var error_message = wpvivid_output_ajaxerror('testing the remote storage connection', textStatus, errorThrown);
|
796 |
}
|
@@ -837,9 +873,6 @@ function wpvivid_delete_remote_storage(storage_id){
|
|
837 |
'remote_id':storage_id
|
838 |
};
|
839 |
wpvivid_post_request(ajax_data, function(data){
|
840 |
-
if(storage_id === wpvivid_default_remote_storage){
|
841 |
-
wpvivid_default_remote_storage = '';
|
842 |
-
}
|
843 |
wpvivid_handle_remote_storage_data(data);
|
844 |
},function(XMLHttpRequest, textStatus, errorThrown) {
|
845 |
var error_message = wpvivid_output_ajaxerror('deleting the remote storage', textStatus, errorThrown);
|
@@ -886,70 +919,35 @@ function wpvivid_handle_backup_data(data){
|
|
886 |
*/
|
887 |
function wpvivid_set_general_settings()
|
888 |
{
|
889 |
-
var
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
break;
|
901 |
-
case 'max_execution_time':
|
902 |
-
alert('The maximum execution time for PHP script is required.');
|
903 |
-
break;
|
904 |
-
case 'path':
|
905 |
-
alert('The local storage path is required.');
|
906 |
-
break;
|
907 |
-
default:
|
908 |
-
bcheck = true;
|
909 |
-
break;
|
910 |
-
}
|
911 |
-
return false;
|
912 |
-
}
|
913 |
-
});
|
914 |
-
if(bcheck) {
|
915 |
-
if (jQuery('input:checkbox[name=email_enable]').prop('checked')) {
|
916 |
-
if (jQuery('input:text[name=send_to]').val() === '') {
|
917 |
-
bcheck = false;
|
918 |
-
alert('An email address is required.');
|
919 |
-
}
|
920 |
-
}
|
921 |
-
}
|
922 |
-
if(bcheck) {
|
923 |
-
var setting_data = wpvivid_ajax_data_transfer('setting');
|
924 |
-
var schedule_data = wpvivid_ajax_data_transfer('schedule');
|
925 |
-
var ajax_data = {
|
926 |
-
'action': 'wpvivid_set_general_setting',
|
927 |
-
'setting': setting_data,
|
928 |
-
'schedule': schedule_data
|
929 |
-
};
|
930 |
-
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'none', 'opacity': '0.4'});
|
931 |
-
wpvivid_post_request(ajax_data, function (data) {
|
932 |
-
try {
|
933 |
-
var jsonarray = jQuery.parseJSON(data);
|
934 |
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
}
|
939 |
-
else {
|
940 |
-
alert(jsonarray.error);
|
941 |
-
}
|
942 |
}
|
943 |
-
|
944 |
-
alert(
|
945 |
-
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
946 |
}
|
947 |
-
}
|
|
|
|
|
948 |
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
949 |
-
|
950 |
-
|
951 |
-
});
|
952 |
-
|
|
|
|
|
953 |
}
|
954 |
|
955 |
/**
|
@@ -1400,6 +1398,8 @@ function wpvivid_initialize_download(backup_id){
|
|
1400 |
else if (value1.status === 'completed') {
|
1401 |
if (m_downloading_file_name === file_name) {
|
1402 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
|
|
|
|
1403 |
}
|
1404 |
file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
|
1405 |
"<span>Part" + part_num + "</span></br>" +
|
@@ -1412,6 +1412,8 @@ function wpvivid_initialize_download(backup_id){
|
|
1412 |
else if (value1.status === 'error') {
|
1413 |
if (m_downloading_file_name === file_name) {
|
1414 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
|
|
|
|
1415 |
}
|
1416 |
alert(value1.error);
|
1417 |
file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
|
@@ -1425,6 +1427,8 @@ function wpvivid_initialize_download(backup_id){
|
|
1425 |
else if (value1.status === 'timeout') {
|
1426 |
if (m_downloading_file_name === file_name) {
|
1427 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
|
|
|
|
1428 |
}
|
1429 |
file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
|
1430 |
"<span>Part" + part_num + "</span></br>" +
|
@@ -1628,6 +1632,7 @@ function wpvivid_prepare_download(part_num, backup_id, file_name){
|
|
1628 |
task_retry_times = 0;
|
1629 |
m_need_update = true;
|
1630 |
wpvivid_lock_download(backup_id);
|
|
|
1631 |
m_downloading_file_name = file_name;
|
1632 |
wpvivid_post_request(ajax_data, function(data){
|
1633 |
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
@@ -1636,6 +1641,7 @@ function wpvivid_prepare_download(part_num, backup_id, file_name){
|
|
1636 |
wpvivid_unlock_download(backup_id);
|
1637 |
jQuery("#"+backup_id+"-text-part-"+part_num).html("<a onclick=\"wpvivid_prepare_download('" + part_num + "', '" + backup_id + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a>");
|
1638 |
jQuery("#"+backup_id+"-progress-part-"+part_num).css('width', progress);
|
|
|
1639 |
m_downloading_file_name = '';
|
1640 |
}, 0);
|
1641 |
}
|
@@ -1794,7 +1800,7 @@ function wpvivid_click_switch_page(type, page){
|
|
1794 |
}
|
1795 |
}
|
1796 |
|
1797 |
-
function wpvivid_close_tab(type){
|
1798 |
event.stopPropagation();
|
1799 |
if(type === 'log'){
|
1800 |
jQuery('#wpvivid_tab_backup_log').hide();
|
@@ -2000,14 +2006,24 @@ function wpvivid_set_backup_lock(backup_id, lock_status){
|
|
2000 |
'lock': lock
|
2001 |
};
|
2002 |
wpvivid_post_request(ajax_data, function(data) {
|
2003 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004 |
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
2005 |
var error_message = wpvivid_output_ajaxerror('setting up a lock for the backup', textStatus, errorThrown);
|
2006 |
alert(error_message);
|
2007 |
});
|
2008 |
}
|
2009 |
|
2010 |
-
function wpvivid_close_main_tab(type){
|
2011 |
event.stopPropagation();
|
2012 |
if(type === 'log'){
|
2013 |
jQuery('#wpvivid_tab_read_log').hide();
|
5 |
var m_restore_backup_id;
|
6 |
var m_backup_task_id;
|
7 |
var m_downloading_file_name = '';
|
8 |
+
var m_downloading_id = '';
|
9 |
var wpvivid_settings_changed = false;
|
10 |
var wpvivid_cur_log_page = 1;
|
11 |
var wpvivid_completed_backup = 1;
|
62 |
wpvivid_settings_changed = false;
|
63 |
});
|
64 |
|
65 |
+
$('input[option=add-remote]').click(function(){
|
66 |
var storage_type = $(".storage-providers-active").attr("remote_type");
|
67 |
wpvivid_add_remote_storage('wpvivid_test_remote_connection', storage_type);
|
68 |
wpvivid_settings_changed = false;
|
164 |
$('#wpvivid_download_website_info').click(function(){
|
165 |
wpvivid_download_website_info();
|
166 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
});
|
168 |
|
169 |
})(jQuery);
|
412 |
else if (value1.status === 'completed') {
|
413 |
if (m_downloading_file_name === file_name) {
|
414 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
415 |
+
m_downloading_id = '';
|
416 |
+
m_downloading_file_name = '';
|
417 |
}
|
418 |
progress = '100%';
|
419 |
jQuery('#' + tmp_current_click_backupid + '-text-part-' + i).html('<a onclick="wpvivid_download(\'' + tmp_current_click_backupid + '\', \'' + index + '\', \'' + file_name + '\');" style="cursor: pointer">Download</a>');
|
422 |
else if (value1.status === 'error') {
|
423 |
if (m_downloading_file_name === file_name) {
|
424 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
425 |
+
m_downloading_id = '';
|
426 |
+
m_downloading_file_name = '';
|
427 |
}
|
428 |
alert(value1.error);
|
429 |
progress = '0%';
|
433 |
else if (value1.stauts === 'timeout') {
|
434 |
if (m_downloading_file_name === file_name) {
|
435 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
436 |
+
m_downloading_id = '';
|
437 |
+
m_downloading_file_name = '';
|
438 |
}
|
439 |
alert('Download timeout, please retry.');
|
440 |
progress = '0%';
|
505 |
* Start backing up
|
506 |
*/
|
507 |
function wpvivid_start_backup(){
|
508 |
+
var bcheck=true;
|
509 |
+
var bdownloading=false;
|
510 |
+
if(m_downloading_id !== '') {
|
511 |
+
var descript = 'This request might delete the backup being downloaded, are you sure you want to continue?';
|
512 |
+
var ret = confirm(descript);
|
513 |
+
if (ret === true) {
|
514 |
+
bcheck=true;
|
515 |
+
bdownloading=true;
|
516 |
+
}
|
517 |
+
else{
|
518 |
+
bcheck=false;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
if(bcheck) {
|
522 |
+
var backup_data = wpvivid_ajax_data_transfer('backup');
|
523 |
+
var ajax_data = {
|
524 |
+
'action': 'wpvivid_prepare_backup',
|
525 |
+
'backup': backup_data
|
526 |
+
};
|
527 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
528 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
529 |
+
jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
|
530 |
+
jQuery('#wpvivid_postbox_backup_percent').show();
|
531 |
+
jQuery('#wpvivid_current_doing').html('Ready to backup. Progress: 0%, running time: 0second.');
|
532 |
+
var percent = '0%';
|
533 |
+
jQuery('#wpvivid_action_progress_bar_percent').css('width', percent);
|
534 |
+
jQuery('#wpvivid_backup_database_size').html('');
|
535 |
+
jQuery('#wpvivid_backup_file_size').html('');
|
536 |
+
jQuery('#wpvivid_current_doing').html('');
|
537 |
+
wpvivid_completed_backup = 1;
|
538 |
+
wpvivid_prepare_backup = true;
|
539 |
+
wpvivid_post_request(ajax_data, function (data) {
|
540 |
+
try {
|
541 |
+
var jsonarray = jQuery.parseJSON(data);
|
542 |
+
if (jsonarray.result === 'failed') {
|
543 |
+
wpvivid_delete_ready_task(jsonarray.error);
|
544 |
}
|
545 |
+
else if (jsonarray.result === 'success') {
|
546 |
+
if(bdownloading) {
|
547 |
+
m_downloading_id = '';
|
548 |
+
}
|
549 |
+
m_backup_task_id = jsonarray.task_id;
|
550 |
+
if (jsonarray.check.alert_db === false && jsonarray.check.alter_files === false && jsonarray.check.alter_fcgi === false) {
|
551 |
+
wpvivid_retrieve_backup_list();
|
552 |
+
wpvivid_backup_now(jsonarray.task_id);
|
553 |
+
}
|
554 |
+
else {
|
555 |
+
var descript = '';
|
556 |
+
if (jsonarray.check.alert_db === true || jsonarray.check.alter_files === true) {
|
557 |
+
descript = 'The database (the dumping SQL file) might be too large, backing up the database may run out of server memory and result in a backup failure.\n' +
|
558 |
+
'One or more files might be too large, backing up the file(s) may run out of server memory and result in a backup failure.\n' +
|
559 |
+
'Click OK button and continue to back up.';
|
560 |
+
var ret = confirm(descript);
|
561 |
+
if (ret === true) {
|
562 |
+
wpvivid_retrieve_backup_list();
|
563 |
+
wpvivid_backup_now(m_backup_task_id);
|
564 |
+
}
|
565 |
+
else {
|
566 |
+
jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
567 |
+
jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
568 |
+
jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
|
569 |
+
jQuery('#wpvivid_postbox_backup_percent').hide();
|
570 |
+
}
|
571 |
}
|
572 |
}
|
573 |
}
|
574 |
}
|
575 |
+
catch (err) {
|
576 |
+
wpvivid_delete_ready_task(err);
|
577 |
+
}
|
578 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
579 |
+
var error_message = wpvivid_output_ajaxerror('preparing the backup', textStatus, errorThrown);
|
580 |
+
wpvivid_delete_ready_task(error_message);
|
581 |
+
});
|
582 |
+
}
|
|
|
583 |
}
|
584 |
|
585 |
function wpvivid_delete_ready_task(error){
|
626 |
});
|
627 |
var descript = '';
|
628 |
var force_del = 0;
|
629 |
+
var bdownloading = false;
|
630 |
if(name === 'lock') {
|
631 |
descript = 'This backup is locked, are you sure to remove it? This backup will be deleted permanently from your hosting (localhost) and remote storages.';
|
632 |
force_del = 1;
|
635 |
descript = 'Are you sure to remove this backup? This backup will be deleted permanently from your hosting (localhost) and remote storages.';
|
636 |
force_del = 0;
|
637 |
}
|
638 |
+
if(m_downloading_id === backup_id){
|
639 |
+
bdownloading = true;
|
640 |
+
descript = 'This request will delete the backup being downloaded, are you sure you want to continue?';
|
641 |
+
force_del = 1;
|
642 |
+
}
|
643 |
var ret = confirm(descript);
|
644 |
if(ret === true){
|
645 |
var ajax_data={
|
649 |
};
|
650 |
wpvivid_post_request(ajax_data, function(data){
|
651 |
wpvivid_handle_backup_data(data);
|
652 |
+
if(bdownloading){
|
653 |
+
m_downloading_id = '';
|
654 |
+
}
|
655 |
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
656 |
var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
|
657 |
alert(error_message);
|
665 |
function wpvivid_delete_backups_inbatches(){
|
666 |
var delete_backup_array = new Array();
|
667 |
var count = 0;
|
668 |
+
var bdownloading = false;
|
669 |
jQuery('#wpvivid_backuplist tr').each(function (i) {
|
670 |
jQuery(this).children('th').each(function (j) {
|
671 |
if (j == 0) {
|
672 |
if(jQuery(this).find('input[type=checkbox]').prop('checked')){
|
673 |
delete_backup_array[count] = jQuery(this).find('input[type=checkbox]').attr('id');
|
674 |
+
if(m_downloading_id === jQuery(this).find('input[type=checkbox]').attr('id')){
|
675 |
+
bdownloading = true;
|
676 |
+
}
|
677 |
count++;
|
678 |
}
|
679 |
}
|
683 |
alert('Please select at least one item.');
|
684 |
}
|
685 |
else {
|
686 |
+
var descript = '';
|
687 |
+
if(bdownloading) {
|
688 |
+
descript = 'This request might delete the backup being downloaded, are you sure you want to continue?';
|
689 |
+
}
|
690 |
+
else{
|
691 |
+
descript = 'Are you sure to remove the selected backups? These backups will be deleted permanently from your hosting (localhost).';
|
692 |
+
}
|
693 |
var ret = confirm(descript);
|
694 |
if (ret === true) {
|
695 |
var ajax_data = {
|
698 |
};
|
699 |
wpvivid_post_request(ajax_data, function (data) {
|
700 |
wpvivid_handle_backup_data(data);
|
701 |
+
jQuery('#backup_list_all_check').prop('checked', false);
|
702 |
+
if(bdownloading){
|
703 |
+
m_downloading_id = '';
|
704 |
+
}
|
705 |
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
706 |
var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
|
707 |
alert(error_message);
|
797 |
'remote': remote_from,
|
798 |
'type': storage_type
|
799 |
};
|
800 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'nano', 'opacity': '0.4'});
|
801 |
wpvivid_post_request(ajax_data, function (data) {
|
802 |
if (action === 'wpvivid_test_remote_connection') {
|
803 |
try {
|
807 |
}
|
808 |
else if (jsonarray.result === 'failed') {
|
809 |
alert(jsonarray.error);
|
810 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
811 |
}
|
812 |
}
|
813 |
catch (err) {
|
814 |
alert(err);
|
815 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
816 |
}
|
817 |
}
|
818 |
else if (action === 'wpvivid_add_remote') {
|
819 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
820 |
jQuery('input:text[option='+storage_type+']').each(function(){
|
821 |
jQuery(this).val('');
|
822 |
});
|
826 |
wpvivid_handle_remote_storage_data(data);
|
827 |
}
|
828 |
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
829 |
+
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
|
830 |
if (action === 'wpvivid_test_remote_connection') {
|
831 |
var error_message = wpvivid_output_ajaxerror('testing the remote storage connection', textStatus, errorThrown);
|
832 |
}
|
873 |
'remote_id':storage_id
|
874 |
};
|
875 |
wpvivid_post_request(ajax_data, function(data){
|
|
|
|
|
|
|
876 |
wpvivid_handle_remote_storage_data(data);
|
877 |
},function(XMLHttpRequest, textStatus, errorThrown) {
|
878 |
var error_message = wpvivid_output_ajaxerror('deleting the remote storage', textStatus, errorThrown);
|
919 |
*/
|
920 |
function wpvivid_set_general_settings()
|
921 |
{
|
922 |
+
var setting_data = wpvivid_ajax_data_transfer('setting');
|
923 |
+
var schedule_data = wpvivid_ajax_data_transfer('schedule');
|
924 |
+
var ajax_data = {
|
925 |
+
'action': 'wpvivid_set_general_setting',
|
926 |
+
'setting': setting_data,
|
927 |
+
'schedule': schedule_data
|
928 |
+
};
|
929 |
+
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'none', 'opacity': '0.4'});
|
930 |
+
wpvivid_post_request(ajax_data, function (data) {
|
931 |
+
try {
|
932 |
+
var jsonarray = jQuery.parseJSON(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
933 |
|
934 |
+
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
935 |
+
if (jsonarray.result === 'success') {
|
936 |
+
location.reload();
|
|
|
|
|
|
|
|
|
937 |
}
|
938 |
+
else {
|
939 |
+
alert(jsonarray.error);
|
|
|
940 |
}
|
941 |
+
}
|
942 |
+
catch (err) {
|
943 |
+
alert(err);
|
944 |
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
945 |
+
}
|
946 |
+
}, function (XMLHttpRequest, textStatus, errorThrown) {
|
947 |
+
jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
|
948 |
+
var error_message = wpvivid_output_ajaxerror('changing base settings', textStatus, errorThrown);
|
949 |
+
alert(error_message);
|
950 |
+
});
|
951 |
}
|
952 |
|
953 |
/**
|
1398 |
else if (value1.status === 'completed') {
|
1399 |
if (m_downloading_file_name === file_name) {
|
1400 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
1401 |
+
m_downloading_id = '';
|
1402 |
+
m_downloading_file_name = '';
|
1403 |
}
|
1404 |
file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
|
1405 |
"<span>Part" + part_num + "</span></br>" +
|
1412 |
else if (value1.status === 'error') {
|
1413 |
if (m_downloading_file_name === file_name) {
|
1414 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
1415 |
+
m_downloading_id = '';
|
1416 |
+
m_downloading_file_name = '';
|
1417 |
}
|
1418 |
alert(value1.error);
|
1419 |
file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
|
1427 |
else if (value1.status === 'timeout') {
|
1428 |
if (m_downloading_file_name === file_name) {
|
1429 |
wpvivid_unlock_download(tmp_current_click_backupid);
|
1430 |
+
m_downloading_id = '';
|
1431 |
+
m_downloading_file_name = '';
|
1432 |
}
|
1433 |
file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
|
1434 |
"<span>Part" + part_num + "</span></br>" +
|
1632 |
task_retry_times = 0;
|
1633 |
m_need_update = true;
|
1634 |
wpvivid_lock_download(backup_id);
|
1635 |
+
m_downloading_id = backup_id;
|
1636 |
m_downloading_file_name = file_name;
|
1637 |
wpvivid_post_request(ajax_data, function(data){
|
1638 |
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
1641 |
wpvivid_unlock_download(backup_id);
|
1642 |
jQuery("#"+backup_id+"-text-part-"+part_num).html("<a onclick=\"wpvivid_prepare_download('" + part_num + "', '" + backup_id + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a>");
|
1643 |
jQuery("#"+backup_id+"-progress-part-"+part_num).css('width', progress);
|
1644 |
+
m_downloading_id = '';
|
1645 |
m_downloading_file_name = '';
|
1646 |
}, 0);
|
1647 |
}
|
1800 |
}
|
1801 |
}
|
1802 |
|
1803 |
+
function wpvivid_close_tab(event, type){
|
1804 |
event.stopPropagation();
|
1805 |
if(type === 'log'){
|
1806 |
jQuery('#wpvivid_tab_backup_log').hide();
|
2006 |
'lock': lock
|
2007 |
};
|
2008 |
wpvivid_post_request(ajax_data, function(data) {
|
2009 |
+
try {
|
2010 |
+
var jsonarray = jQuery.parseJSON(data);
|
2011 |
+
if (jsonarray.result === 'success') {
|
2012 |
+
jQuery('#wpvivid_lock_'+backup_id).html(jsonarray.html);
|
2013 |
+
}
|
2014 |
+
}
|
2015 |
+
catch(err){
|
2016 |
+
alert(err);
|
2017 |
+
}
|
2018 |
+
|
2019 |
+
//wpvivid_handle_backup_data(data);
|
2020 |
}, function(XMLHttpRequest, textStatus, errorThrown) {
|
2021 |
var error_message = wpvivid_output_ajaxerror('setting up a lock for the backup', textStatus, errorThrown);
|
2022 |
alert(error_message);
|
2023 |
});
|
2024 |
}
|
2025 |
|
2026 |
+
function wpvivid_close_main_tab(event, type){
|
2027 |
event.stopPropagation();
|
2028 |
if(type === 'log'){
|
2029 |
jQuery('#wpvivid_tab_read_log').hide();
|
admin/partials/wpvivid-admin-display.php
CHANGED
@@ -14,13 +14,13 @@ if (!defined('WPVIVID_PLUGIN_DIR')){
|
|
14 |
die;
|
15 |
}
|
16 |
|
|
|
17 |
$last_backup_message=WPvivid_Setting::get_option('wpvivid_last_msg');
|
18 |
$backuplist=WPvivid_Backuplist::get_backuplist();
|
19 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
20 |
$schedule=WPvivid_Schedule::get_schedule();
|
21 |
$backupdir=WPvivid_Setting::get_backupdir();
|
22 |
$general_setting=WPvivid_Setting::get_setting(true, "");
|
23 |
-
global $wpvivid_pulgin;
|
24 |
$out_of_date=$wpvivid_pulgin->_get_out_of_date_info();
|
25 |
$junk_file=$wpvivid_pulgin->_junk_files_info();
|
26 |
$website_info=$wpvivid_pulgin->get_website_info();
|
@@ -48,7 +48,7 @@ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
|
|
48 |
<a href="#" id="wpvivid_tab_read_log" class="nav-tab wrap-nav-tab delete" onclick="switchTabs(event,'log-read-page')" style="display: none;">
|
49 |
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid'); ?></div>
|
50 |
<div class="nav-tab-delete-img">
|
51 |
-
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_main_tab('log');" />
|
52 |
</div>
|
53 |
</a>
|
54 |
<?php do_action('wpvivid_backuprestore_add_tab');?>
|
14 |
die;
|
15 |
}
|
16 |
|
17 |
+
global $wpvivid_pulgin;
|
18 |
$last_backup_message=WPvivid_Setting::get_option('wpvivid_last_msg');
|
19 |
$backuplist=WPvivid_Backuplist::get_backuplist();
|
20 |
$remoteslist=WPvivid_Setting::get_all_remote_options();
|
21 |
$schedule=WPvivid_Schedule::get_schedule();
|
22 |
$backupdir=WPvivid_Setting::get_backupdir();
|
23 |
$general_setting=WPvivid_Setting::get_setting(true, "");
|
|
|
24 |
$out_of_date=$wpvivid_pulgin->_get_out_of_date_info();
|
25 |
$junk_file=$wpvivid_pulgin->_junk_files_info();
|
26 |
$website_info=$wpvivid_pulgin->get_website_info();
|
48 |
<a href="#" id="wpvivid_tab_read_log" class="nav-tab wrap-nav-tab delete" onclick="switchTabs(event,'log-read-page')" style="display: none;">
|
49 |
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid'); ?></div>
|
50 |
<div class="nav-tab-delete-img">
|
51 |
+
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_main_tab(event, 'log');" />
|
52 |
</div>
|
53 |
</a>
|
54 |
<?php do_action('wpvivid_backuprestore_add_tab');?>
|
admin/partials/wpvivid-backup-restore-page-display.php
CHANGED
@@ -95,6 +95,7 @@ function wpvivid_backup_manual(){
|
|
95 |
}
|
96 |
|
97 |
function wpvivid_backup_schedule(){
|
|
|
98 |
?>
|
99 |
<div class="postbox qucikbackup-schedule" id="wpvivid_postbox_backup_schedule">
|
100 |
<h2><span><?php _e( 'Backup Schedule','wpvivid'); ?></span></h2>
|
@@ -150,7 +151,7 @@ function wpvivid_add_tab_log(){
|
|
150 |
<a href="#" id="wpvivid_tab_backup_log" class="nav-tab table-nav-tab delete" onclick="switchrestoreTabs(event,'page-log')" style="display: none;">
|
151 |
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid'); ?></div>
|
152 |
<div class="nav-tab-delete-img">
|
153 |
-
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab('log');" />
|
154 |
</div>
|
155 |
</a>
|
156 |
<?php
|
@@ -161,7 +162,7 @@ function wpvivid_add_tab_restore(){
|
|
161 |
<a href="#" id="wpvivid_tab_restore" class="nav-tab table-nav-tab delete" onclick="switchrestoreTabs(event,'page-restore')" style="display: none;">
|
162 |
<div style="margin-right: 15px;"><?php _e('Restore', 'wpvivid'); ?></div>
|
163 |
<div class="nav-tab-delete-img">
|
164 |
-
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab('restore');" />
|
165 |
</div>
|
166 |
</a>
|
167 |
<?php
|
95 |
}
|
96 |
|
97 |
function wpvivid_backup_schedule(){
|
98 |
+
$last_backup_message=WPvivid_Setting::get_option('wpvivid_last_msg');
|
99 |
?>
|
100 |
<div class="postbox qucikbackup-schedule" id="wpvivid_postbox_backup_schedule">
|
101 |
<h2><span><?php _e( 'Backup Schedule','wpvivid'); ?></span></h2>
|
151 |
<a href="#" id="wpvivid_tab_backup_log" class="nav-tab table-nav-tab delete" onclick="switchrestoreTabs(event,'page-log')" style="display: none;">
|
152 |
<div style="margin-right: 15px;"><?php _e('Log', 'wpvivid'); ?></div>
|
153 |
<div class="nav-tab-delete-img">
|
154 |
+
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'log');" />
|
155 |
</div>
|
156 |
</a>
|
157 |
<?php
|
162 |
<a href="#" id="wpvivid_tab_restore" class="nav-tab table-nav-tab delete" onclick="switchrestoreTabs(event,'page-restore')" style="display: none;">
|
163 |
<div style="margin-right: 15px;"><?php _e('Restore', 'wpvivid'); ?></div>
|
164 |
<div class="nav-tab-delete-img">
|
165 |
+
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'restore');" />
|
166 |
</div>
|
167 |
</a>
|
168 |
<?php
|
admin/partials/wpvivid-remote-storage-page-display.php
CHANGED
@@ -9,8 +9,6 @@
|
|
9 |
</div>
|
10 |
<div class="postbox storage-account-block" id="wpvivid_storage_account_block">
|
11 |
<?php do_action('wpvivid_add_storage_page'); ?>
|
12 |
-
<div id="wpvivid_storage_account_notice"></div>
|
13 |
-
<div class=""><input class="button-primary storage-account-button" id="storage_account_button" type="submit" name="Example" value="<?php _e( 'Test and Add', 'wpvivid' ); ?>" /></div>
|
14 |
</div>
|
15 |
<div class="schedule-tab-block"><?php _e('Please choose one storage to save your backups (remote storage)', 'wpvivid'); ?></div>
|
16 |
<div class="">
|
9 |
</div>
|
10 |
<div class="postbox storage-account-block" id="wpvivid_storage_account_block">
|
11 |
<?php do_action('wpvivid_add_storage_page'); ?>
|
|
|
|
|
12 |
</div>
|
13 |
<div class="schedule-tab-block"><?php _e('Please choose one storage to save your backups (remote storage)', 'wpvivid'); ?></div>
|
14 |
<div class="">
|
admin/partials/wpvivid-settings-page-display.php
CHANGED
@@ -337,6 +337,9 @@ function wpvivid_schedule_settings()
|
|
337 |
<input type="radio" option="schedule" name="save_local_remote" value="remote"/>
|
338 |
<span><?php _e( 'Send backups to remote storage (choose this option, the local backup will be deleted after uploading to remote storage completely)', 'wpvivid' ); ?></span>
|
339 |
</label>
|
|
|
|
|
|
|
340 |
</fieldset>
|
341 |
</div>
|
342 |
<div id="schedule_upload_storage">
|
@@ -389,7 +392,7 @@ function wpvivid_schedule_backup_type($html)
|
|
389 |
function wpvivid_schedule_do_js()
|
390 |
{
|
391 |
$schedule=WPvivid_Schedule::get_schedule();
|
392 |
-
if($schedule['enable']
|
393 |
{
|
394 |
?>
|
395 |
jQuery("#wpvivid_schedule_enable").prop('checked', true);
|
@@ -419,8 +422,8 @@ function wpvivid_schedule_do_js()
|
|
419 |
<?php
|
420 |
}
|
421 |
|
422 |
-
add_action('wpvivid_setting_add_cell','
|
423 |
-
add_action('wpvivid_setting_add_cell','
|
424 |
add_action('wpvivid_setting_add_cell','wpvivid_compressing',12);
|
425 |
add_action('wpvivid_setting_add_cell','wpvivid_email_report',13);
|
426 |
add_action('wpvivid_setting_add_cell','wpvivid_clean_junk',14);
|
337 |
<input type="radio" option="schedule" name="save_local_remote" value="remote"/>
|
338 |
<span><?php _e( 'Send backups to remote storage (choose this option, the local backup will be deleted after uploading to remote storage completely)', 'wpvivid' ); ?></span>
|
339 |
</label>
|
340 |
+
<label style="display: none;">
|
341 |
+
<input type="checkbox" option="schedule" name="lock" value="0" />
|
342 |
+
</label>
|
343 |
</fieldset>
|
344 |
</div>
|
345 |
<div id="schedule_upload_storage">
|
392 |
function wpvivid_schedule_do_js()
|
393 |
{
|
394 |
$schedule=WPvivid_Schedule::get_schedule();
|
395 |
+
if($schedule['enable'] == true)
|
396 |
{
|
397 |
?>
|
398 |
jQuery("#wpvivid_schedule_enable").prop('checked', true);
|
422 |
<?php
|
423 |
}
|
424 |
|
425 |
+
add_action('wpvivid_setting_add_cell','wpvivid_schedule_settings',10);
|
426 |
+
add_action('wpvivid_setting_add_cell','wpvivid_general_settings',11);
|
427 |
add_action('wpvivid_setting_add_cell','wpvivid_compressing',12);
|
428 |
add_action('wpvivid_setting_add_cell','wpvivid_email_report',13);
|
429 |
add_action('wpvivid_setting_add_cell','wpvivid_clean_junk',14);
|
includes/class-wpvivid-backup.php
CHANGED
@@ -122,7 +122,6 @@ class WPvivid_Backup{
|
|
122 |
{
|
123 |
global $wpvivid_pulgin;
|
124 |
$wpvivid_pulgin->set_time_limit($this->task_id);
|
125 |
-
|
126 |
$data=$this->get_backup_needed_data($type_name,$extra_data);
|
127 |
$result = $this->backup_loop_ex($data);
|
128 |
}
|
@@ -486,10 +485,14 @@ class WPvivid_Backup{
|
|
486 |
|
487 |
public function get_files_list($files,$data)
|
488 |
{
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
|
|
|
|
|
|
|
|
493 |
|
494 |
if($file_path=='')
|
495 |
{
|
@@ -513,6 +516,7 @@ class WPvivid_Backup{
|
|
513 |
foreach($_files as $_files_test) {
|
514 |
$files = array_merge($_files_test, $files);
|
515 |
}
|
|
|
516 |
return $files;
|
517 |
}
|
518 |
}
|
122 |
{
|
123 |
global $wpvivid_pulgin;
|
124 |
$wpvivid_pulgin->set_time_limit($this->task_id);
|
|
|
125 |
$data=$this->get_backup_needed_data($type_name,$extra_data);
|
126 |
$result = $this->backup_loop_ex($data);
|
127 |
}
|
485 |
|
486 |
public function get_files_list($files,$data)
|
487 |
{
|
488 |
+
if($data['type'] === WPVIVID_BACKUP_TYPE_OTHERS){
|
489 |
+
$file_path = $data['extra_data'];
|
490 |
+
}
|
491 |
+
else {
|
492 |
+
$file_path = $this->get_default_directory($data['type']);
|
493 |
+
$data['exclude_regex'] = $this->get_default_exclude_regex($data['type']);
|
494 |
+
$data['include_regex'] = array();
|
495 |
+
}
|
496 |
|
497 |
if($file_path=='')
|
498 |
{
|
516 |
foreach($_files as $_files_test) {
|
517 |
$files = array_merge($_files_test, $files);
|
518 |
}
|
519 |
+
|
520 |
return $files;
|
521 |
}
|
522 |
}
|
includes/class-wpvivid-backuptoremote.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!defined('WPVIVID_PLUGIN_DIR')){
|
4 |
-
die;
|
5 |
-
}
|
6 |
-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-tools.php';
|
7 |
-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/customclass/class-wpvivid-ftpclass.php';
|
8 |
-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/customclass/class-wpvivid-sftpclass.php';
|
9 |
-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/customclass/class-wpvivid-amazons3-plus.php';
|
10 |
-
class WPvivid_Backup_Remote
|
11 |
-
{
|
12 |
-
|
13 |
-
|
14 |
-
public function backup_with_ftp($data = array())
|
15 |
-
{
|
16 |
-
$host = $data['options']['host'];
|
17 |
-
$username = $data['options']['username'];
|
18 |
-
$password = $data['options']['password'];
|
19 |
-
$path = $data['options']['path'];
|
20 |
-
$passive = $data['options']['passive'];
|
21 |
-
$port = empty($data['options']['port'])?21:$data['options']['port'];
|
22 |
-
|
23 |
-
$ftpclass = new WPvivid_FTPClass();
|
24 |
-
$res = $ftpclass -> upload($host,$username,$password,$path,$data['files'],$data['task_id'],$passive,$port,$data['log']);
|
25 |
-
return $res;
|
26 |
-
}
|
27 |
-
|
28 |
-
public function backup_with_sftp($data)
|
29 |
-
{
|
30 |
-
if(empty($data['port']))
|
31 |
-
$data['options']['port'] = 22;
|
32 |
-
$host = $data['options']['host'];
|
33 |
-
$username = $data['options']['username'];
|
34 |
-
$password = $data['options']['password'];
|
35 |
-
$path = $data['options']['path'];
|
36 |
-
$port = $data['options']['port'];
|
37 |
-
$scp = $data['options']['scp'];
|
38 |
-
|
39 |
-
$sftpclass = new WPvivid_SFTPClass();
|
40 |
-
$result = $sftpclass -> upload($host,$username,$password,$path,$data['files'],$data['task_id'],$port,$scp,$data['log']);
|
41 |
-
return $result;
|
42 |
-
}
|
43 |
-
|
44 |
-
public function backup_with_amazonS3($data = array())
|
45 |
-
{
|
46 |
-
$files = $data['files'];
|
47 |
-
$access = $data['options']['access'];
|
48 |
-
$secret = $data['options']['secret'];
|
49 |
-
$s3Path = $data['options']['s3Path'];
|
50 |
-
$region = $data['options']['region'];
|
51 |
-
$amazonS3 = new WPvivid_AMAZONS3Class();
|
52 |
-
$amazonS3 ->init($access,$secret,$region);
|
53 |
-
$res = $amazonS3 -> upload($files,$s3Path,$data['task_id'],$data['log']);
|
54 |
-
return $res;
|
55 |
-
}
|
56 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wpvivid-schedule.php
CHANGED
@@ -167,6 +167,7 @@ class WPvivid_Schedule
|
|
167 |
$schedule['backup']['local']=1;
|
168 |
$schedule['backup']['remote']=0;
|
169 |
$schedule['backup']['ismerge']=1;
|
|
|
170 |
}
|
171 |
|
172 |
$recurrence = wp_get_schedule(WPVIVID_MAIN_SCHEDULE_EVENT);
|
@@ -214,6 +215,7 @@ class WPvivid_Schedule
|
|
214 |
$schedule_data['backup']['remote']=0;
|
215 |
}
|
216 |
$schedule_data['backup']['ismerge']=1;
|
|
|
217 |
}
|
218 |
else
|
219 |
{
|
167 |
$schedule['backup']['local']=1;
|
168 |
$schedule['backup']['remote']=0;
|
169 |
$schedule['backup']['ismerge']=1;
|
170 |
+
$schedule['backup']['lock']=0;
|
171 |
}
|
172 |
|
173 |
$recurrence = wp_get_schedule(WPVIVID_MAIN_SCHEDULE_EVENT);
|
215 |
$schedule_data['backup']['remote']=0;
|
216 |
}
|
217 |
$schedule_data['backup']['ismerge']=1;
|
218 |
+
$schedule_data['backup']['lock']=$schedule['lock'];
|
219 |
}
|
220 |
else
|
221 |
{
|
includes/class-wpvivid-setting.php
CHANGED
@@ -340,12 +340,22 @@ class WPvivid_Setting
|
|
340 |
return $upload_options;
|
341 |
}
|
342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
public static function add_remote_options($remote)
|
344 |
{
|
345 |
$upload_options=self::get_option('wpvivid_upload_setting');
|
346 |
$id=uniqid('wpvivid-remote-');
|
347 |
-
$upload_options[$id]=$remote;
|
348 |
|
|
|
|
|
|
|
349 |
self::update_option('wpvivid_upload_setting',$upload_options);
|
350 |
return $id;
|
351 |
}
|
@@ -415,6 +425,21 @@ class WPvivid_Setting
|
|
415 |
if($setting)
|
416 |
{
|
417 |
$json['data']['wpvivid_schedule_setting']=self::get_option('wpvivid_schedule_setting');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
$json['data']['wpvivid_compress_setting']=self::get_option('wpvivid_compress_setting');
|
419 |
$json['data']['wpvivid_local_setting']=self::get_option('wpvivid_local_setting');
|
420 |
$json['data']['wpvivid_upload_setting']=self::get_option('wpvivid_upload_setting');
|
340 |
return $upload_options;
|
341 |
}
|
342 |
|
343 |
+
public static function update_remote_option($id,$remote)
|
344 |
+
{
|
345 |
+
$upload_options=self::get_option('wpvivid_upload_setting');
|
346 |
+
$upload_options[$id]=$remote;
|
347 |
+
|
348 |
+
self::update_option('wpvivid_upload_setting',$upload_options);
|
349 |
+
}
|
350 |
+
|
351 |
public static function add_remote_options($remote)
|
352 |
{
|
353 |
$upload_options=self::get_option('wpvivid_upload_setting');
|
354 |
$id=uniqid('wpvivid-remote-');
|
|
|
355 |
|
356 |
+
$remote=apply_filters('wpvivid_pre_add_remote',$remote,$id);
|
357 |
+
|
358 |
+
$upload_options[$id]=$remote;
|
359 |
self::update_option('wpvivid_upload_setting',$upload_options);
|
360 |
return $id;
|
361 |
}
|
425 |
if($setting)
|
426 |
{
|
427 |
$json['data']['wpvivid_schedule_setting']=self::get_option('wpvivid_schedule_setting');
|
428 |
+
$json['data']['wpvivid_schedule_setting']['backup_type']=$json['data']['wpvivid_schedule_setting']['backup']['backup_files'];
|
429 |
+
if($json['data']['wpvivid_schedule_setting']['backup']['local'] == 1){
|
430 |
+
$json['data']['wpvivid_schedule_setting']['save_local_remote']='local';
|
431 |
+
}
|
432 |
+
else{
|
433 |
+
$json['data']['wpvivid_schedule_setting']['save_local_remote']='remote';
|
434 |
+
}
|
435 |
+
$json['data']['wpvivid_schedule_setting']['lock']=0;
|
436 |
+
if(wp_get_schedule(WPVIVID_MAIN_SCHEDULE_EVENT))
|
437 |
+
{
|
438 |
+
$recurrence = wp_get_schedule(WPVIVID_MAIN_SCHEDULE_EVENT);
|
439 |
+
$timestamp = wp_next_scheduled(WPVIVID_MAIN_SCHEDULE_EVENT);
|
440 |
+
$json['data']['wpvivid_schedule_setting']['recurrence']=$recurrence;
|
441 |
+
$json['data']['wpvivid_schedule_setting']['next_start']=$timestamp;
|
442 |
+
}
|
443 |
$json['data']['wpvivid_compress_setting']=self::get_option('wpvivid_compress_setting');
|
444 |
$json['data']['wpvivid_local_setting']=self::get_option('wpvivid_local_setting');
|
445 |
$json['data']['wpvivid_upload_setting']=self::get_option('wpvivid_upload_setting');
|
includes/class-wpvivid.php
CHANGED
@@ -123,8 +123,6 @@ class WPvivid {
|
|
123 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backup.php';
|
124 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-mail-report.php';
|
125 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-restore.php';
|
126 |
-
//include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/customclass/class-wpvivid-remote-default.php';
|
127 |
-
//include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backuptoremote.php';
|
128 |
|
129 |
|
130 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-remote-collection.php';
|
@@ -289,7 +287,7 @@ class WPvivid {
|
|
289 |
$backup_type= array('files+db','files', 'db');
|
290 |
if(!in_array($backup_options['backup_files'],$backup_type))
|
291 |
{
|
292 |
-
|
293 |
}
|
294 |
|
295 |
if($backup_options['remote']=='1')
|
@@ -323,6 +321,13 @@ class WPvivid {
|
|
323 |
die();
|
324 |
}
|
325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
add_filter('wpvivid_check_backup_options_valid',array($this,'check_backup_options_valid'),10);
|
327 |
$backup_options=apply_filters('wpvivid_check_backup_options_valid',$backup_options);
|
328 |
|
@@ -345,6 +350,50 @@ class WPvivid {
|
|
345 |
die();
|
346 |
}
|
347 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
/**
|
349 |
* Delete tasks had [ready] status.
|
350 |
*
|
@@ -583,6 +632,10 @@ class WPvivid {
|
|
583 |
{
|
584 |
die();
|
585 |
}
|
|
|
|
|
|
|
|
|
586 |
//Initialization backup task.
|
587 |
add_filter('wpvivid_check_backup_options_valid',array($this,'check_backup_options_valid'),10);
|
588 |
$schedule_options['backup']=apply_filters('wpvivid_check_backup_options_valid',$schedule_options['backup']);
|
@@ -903,6 +956,7 @@ class WPvivid {
|
|
903 |
//start upload files to remote
|
904 |
$this->upload_start($task_id,$backup_ret);
|
905 |
$this->finish_upload_task($task_id);
|
|
|
906 |
}
|
907 |
}
|
908 |
catch (Exception $e)
|
@@ -2145,7 +2199,7 @@ class WPvivid {
|
|
2145 |
|
2146 |
if(isset($_REQUEST['backup_id'])&&isset($_REQUEST['download_type'])&&isset($_REQUEST['file_name']))
|
2147 |
{
|
2148 |
-
if(!empty(
|
2149 |
{
|
2150 |
$backup_id=sanitize_key($_REQUEST['backup_id']);
|
2151 |
}
|
@@ -2154,7 +2208,7 @@ class WPvivid {
|
|
2154 |
die();
|
2155 |
}
|
2156 |
|
2157 |
-
if(!empty(
|
2158 |
{
|
2159 |
$file_name=sanitize_file_name($_REQUEST['file_name']);
|
2160 |
}
|
@@ -2163,7 +2217,7 @@ class WPvivid {
|
|
2163 |
die();
|
2164 |
}
|
2165 |
|
2166 |
-
if(!empty(
|
2167 |
{
|
2168 |
$download_type=sanitize_text_field($_REQUEST['download_type']);
|
2169 |
}
|
@@ -3156,9 +3210,37 @@ class WPvivid {
|
|
3156 |
|
3157 |
WPvivid_Backuplist::set_security_lock($backup_id,$lock);
|
3158 |
$ret['result']='success';
|
3159 |
-
$
|
3160 |
-
|
3161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3162 |
echo json_encode($ret);
|
3163 |
}
|
3164 |
die();
|
@@ -3569,6 +3651,12 @@ class WPvivid {
|
|
3569 |
if (is_null($setting)){
|
3570 |
die();
|
3571 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3572 |
add_filter('wpvivid_set_general_setting', array('WPvivid', 'wpvivid_set_general_setting'), 10, 3);
|
3573 |
$options=WPvivid_Setting::get_setting(true, "");
|
3574 |
$setting_data = array();
|
@@ -3585,6 +3673,12 @@ class WPvivid {
|
|
3585 |
{
|
3586 |
die();
|
3587 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3588 |
//set_schedule_ex
|
3589 |
$ret=WPvivid_Schedule::set_schedule_ex($schedule);
|
3590 |
if($ret['result']!='success')
|
@@ -3598,6 +3692,102 @@ class WPvivid {
|
|
3598 |
die();
|
3599 |
}
|
3600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3601 |
public function export_setting()
|
3602 |
{
|
3603 |
$this->ajax_check_security('manage_options');
|
@@ -3720,7 +3910,7 @@ class WPvivid {
|
|
3720 |
}
|
3721 |
$archive = new PclZip($path);
|
3722 |
|
3723 |
-
if(empty(
|
3724 |
{
|
3725 |
if(!$archive->add($files,PCLZIP_OPT_REMOVE_ALL_PATH))
|
3726 |
{
|
@@ -4080,7 +4270,7 @@ class WPvivid {
|
|
4080 |
$lock_status='unlock';
|
4081 |
}
|
4082 |
else{
|
4083 |
-
if($value['lock']
|
4084 |
$backup_lock='/admin/partials/images/unlocked.png';
|
4085 |
$lock_status='unlock';
|
4086 |
}
|
@@ -4109,10 +4299,10 @@ class WPvivid {
|
|
4109 |
<div style="float:left;padding:0px 10px 10px 0px;">
|
4110 |
<div class="backuptime"><strong>'.__(date('M d, Y H:i',$value['create_time']), 'wpvivid').'</strong></div>
|
4111 |
<div class="common-table">
|
4112 |
-
<span title="To lock the backup, the backup can only be deleted manually">
|
4113 |
-
|
4114 |
</span>
|
4115 |
-
|
4116 |
|<span title="Backup log"><a href="#" onclick="wpvivid_initialize_log(\''.__($key, 'wpvivid').'\');"><img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Log.png').'" style="vertical-align:middle;cursor:pointer;"/>'.__('Log', 'wpvivid').'</a></span>
|
4117 |
|<span title="Restore Website from The Backup"><a href="#" onclick="wpvivid_initialize_restore(\''.__($key, 'wpvivid').'\',\''.__(date('M d, Y H:i',$value['create_time']), 'wpvivid').'\');"><img src="'.esc_url(WPVIVID_PLUGIN_URL. '/admin/partials/images/Restore.png').'" style="vertical-align:middle;cursor:pointer;"/>'.__('Restore', 'wpvivid').'</a></span>
|
4118 |
</div>
|
@@ -4172,8 +4362,7 @@ class WPvivid {
|
|
4172 |
<td><input type="checkbox" name="remote_storage" value="'.esc_attr($key, 'wpvivid').'" '.esc_attr($check_status, 'wpvivid').' /></td>
|
4173 |
<td>'.__($storage_type, 'wpvivid').'</td>
|
4174 |
<td class="row-title"><label for="tablecell">'.__($value['name'], 'wpvivid').'</label></td>
|
4175 |
-
<td onclick="wpvivid_delete_remote_storage(\''.__($key, 'wpvivid').'\');"
|
4176 |
-
<img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Delete.png').'" style="vertical-align:middle; cursor:pointer;" title="Delete the backup"/>
|
4177 |
</td>
|
4178 |
</tr>';
|
4179 |
|
@@ -4294,7 +4483,6 @@ class WPvivid {
|
|
4294 |
{
|
4295 |
foreach ($value['remote'] as $remote_key=>$storage_type)
|
4296 |
{
|
4297 |
-
//$remote
|
4298 |
if(!array_key_exists('options',$storage_type))
|
4299 |
{
|
4300 |
continue;
|
123 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-backup.php';
|
124 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-mail-report.php';
|
125 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-restore.php';
|
|
|
|
|
126 |
|
127 |
|
128 |
include_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpvivid-remote-collection.php';
|
287 |
$backup_type= array('files+db','files', 'db');
|
288 |
if(!in_array($backup_options['backup_files'],$backup_type))
|
289 |
{
|
290 |
+
return false;
|
291 |
}
|
292 |
|
293 |
if($backup_options['remote']=='1')
|
321 |
die();
|
322 |
}
|
323 |
|
324 |
+
$ret = $this->check_backup_option($backup_options);
|
325 |
+
if($ret['result']!=WPVIVID_SUCCESS)
|
326 |
+
{
|
327 |
+
echo json_encode($ret);
|
328 |
+
die();
|
329 |
+
}
|
330 |
+
|
331 |
add_filter('wpvivid_check_backup_options_valid',array($this,'check_backup_options_valid'),10);
|
332 |
$backup_options=apply_filters('wpvivid_check_backup_options_valid',$backup_options);
|
333 |
|
350 |
die();
|
351 |
}
|
352 |
}
|
353 |
+
public function check_backup_option($data)
|
354 |
+
{
|
355 |
+
$ret['result']=WPVIVID_FAILED;
|
356 |
+
if(!isset($data['backup_files']))
|
357 |
+
{
|
358 |
+
$ret['error']=__('A backup type is required.', 'wpvivid');
|
359 |
+
return $ret;
|
360 |
+
}
|
361 |
+
|
362 |
+
$data['backup_files']=sanitize_text_field($data['backup_files']);
|
363 |
+
|
364 |
+
if(empty($data['backup_files']))
|
365 |
+
{
|
366 |
+
$ret['error']=__('A backup type is required.', 'wpvivid');
|
367 |
+
return $ret;
|
368 |
+
}
|
369 |
+
|
370 |
+
if(!isset($data['local']) && !isset($data['remote']))
|
371 |
+
{
|
372 |
+
$ret['error']=__('Choose at least one storage location for backups.', 'wpvivid');
|
373 |
+
return $ret;
|
374 |
+
}
|
375 |
+
|
376 |
+
$data['local']=sanitize_text_field($data['local']);
|
377 |
+
$data['remote']=sanitize_text_field($data['remote']);
|
378 |
+
|
379 |
+
if(empty($data['local']) && empty($data['remote']))
|
380 |
+
{
|
381 |
+
$ret['error']=__('Choose at least one storage location for backups.', 'wpvivid');
|
382 |
+
return $ret;
|
383 |
+
}
|
384 |
+
|
385 |
+
if($data['remote'] === '1')
|
386 |
+
{
|
387 |
+
$remote_storage=WPvivid_Setting::get_remote_options();
|
388 |
+
if($remote_storage == false) {
|
389 |
+
$ret['error']=__('There is no default remote storage configured. Please set it up first.', 'wpvivid');
|
390 |
+
return $ret;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
$ret['result']=WPVIVID_SUCCESS;
|
395 |
+
return $ret;
|
396 |
+
}
|
397 |
/**
|
398 |
* Delete tasks had [ready] status.
|
399 |
*
|
632 |
{
|
633 |
die();
|
634 |
}
|
635 |
+
$schedule_options['backup']['local']=strval($schedule_options['backup']['local']);
|
636 |
+
$schedule_options['backup']['remote']=strval($schedule_options['backup']['remote']);
|
637 |
+
$schedule_options['backup']['ismerge']=strval($schedule_options['backup']['ismerge']);
|
638 |
+
$schedule_options['backup']['lock']=strval($schedule_options['backup']['lock']);
|
639 |
//Initialization backup task.
|
640 |
add_filter('wpvivid_check_backup_options_valid',array($this,'check_backup_options_valid'),10);
|
641 |
$schedule_options['backup']=apply_filters('wpvivid_check_backup_options_valid',$schedule_options['backup']);
|
956 |
//start upload files to remote
|
957 |
$this->upload_start($task_id,$backup_ret);
|
958 |
$this->finish_upload_task($task_id);
|
959 |
+
$this->update_last_backup_task($task_id);
|
960 |
}
|
961 |
}
|
962 |
catch (Exception $e)
|
2199 |
|
2200 |
if(isset($_REQUEST['backup_id'])&&isset($_REQUEST['download_type'])&&isset($_REQUEST['file_name']))
|
2201 |
{
|
2202 |
+
if(!empty($_REQUEST['backup_id'])&&is_string($_REQUEST['backup_id']))
|
2203 |
{
|
2204 |
$backup_id=sanitize_key($_REQUEST['backup_id']);
|
2205 |
}
|
2208 |
die();
|
2209 |
}
|
2210 |
|
2211 |
+
if(!empty($_REQUEST['file_name'])&&is_string($_REQUEST['file_name']))
|
2212 |
{
|
2213 |
$file_name=sanitize_file_name($_REQUEST['file_name']);
|
2214 |
}
|
2217 |
die();
|
2218 |
}
|
2219 |
|
2220 |
+
if(!empty($_REQUEST['download_type'])&&is_string($_REQUEST['download_type']))
|
2221 |
{
|
2222 |
$download_type=sanitize_text_field($_REQUEST['download_type']);
|
2223 |
}
|
3210 |
|
3211 |
WPvivid_Backuplist::set_security_lock($backup_id,$lock);
|
3212 |
$ret['result']='success';
|
3213 |
+
$list = WPvivid_Setting::get_option('wpvivid_backup_list');
|
3214 |
+
if(array_key_exists($backup_id,$list))
|
3215 |
+
{
|
3216 |
+
if(isset($list[$backup_id]['lock']))
|
3217 |
+
{
|
3218 |
+
if($list[$backup_id]['lock'] == 1)
|
3219 |
+
{
|
3220 |
+
$backup_lock='/admin/partials/images/locked.png';
|
3221 |
+
$lock_status='lock';
|
3222 |
+
$ret['html'] = '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $backup_lock) . '" name="' . esc_attr($lock_status, 'wpvivid') . '" onclick="wpvivid_set_backup_lock(\'' . __($backup_id, 'wpvivid') . '\', \'' . __($lock_status, 'wpvivid') . '\');" style="vertical-align:middle; cursor:pointer;"/>';
|
3223 |
+
}
|
3224 |
+
else
|
3225 |
+
{
|
3226 |
+
$backup_lock = '/admin/partials/images/unlocked.png';
|
3227 |
+
$lock_status = 'unlock';
|
3228 |
+
$ret['html'] = '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $backup_lock) . '" name="' . esc_attr($lock_status, 'wpvivid') . '" onclick="wpvivid_set_backup_lock(\'' . __($backup_id, 'wpvivid') . '\', \'' . __($lock_status, 'wpvivid') . '\');" style="vertical-align:middle; cursor:pointer;"/>';
|
3229 |
+
}
|
3230 |
+
}
|
3231 |
+
else
|
3232 |
+
{
|
3233 |
+
$backup_lock = '/admin/partials/images/unlocked.png';
|
3234 |
+
$lock_status = 'unlock';
|
3235 |
+
$ret['html'] = '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $backup_lock) . '" name="' . esc_attr($lock_status, 'wpvivid') . '" onclick="wpvivid_set_backup_lock(\'' . __($backup_id, 'wpvivid') . '\', \'' . __($lock_status, 'wpvivid') . '\');" style="vertical-align:middle; cursor:pointer;"/>';
|
3236 |
+
}
|
3237 |
+
}
|
3238 |
+
else
|
3239 |
+
{
|
3240 |
+
$backup_lock = '/admin/partials/images/unlocked.png';
|
3241 |
+
$lock_status = 'unlock';
|
3242 |
+
$ret['html'] = '<img src="' . esc_url(WPVIVID_PLUGIN_URL . $backup_lock) . '" name="' . esc_attr($lock_status, 'wpvivid') . '" onclick="wpvivid_set_backup_lock(\'' . __($backup_id, 'wpvivid') . '\', \'' . __($lock_status, 'wpvivid') . '\');" style="vertical-align:middle; cursor:pointer;"/>';
|
3243 |
+
}
|
3244 |
echo json_encode($ret);
|
3245 |
}
|
3246 |
die();
|
3651 |
if (is_null($setting)){
|
3652 |
die();
|
3653 |
}
|
3654 |
+
$ret = $this->check_setting_option($setting);
|
3655 |
+
if($ret['result']!=WPVIVID_SUCCESS)
|
3656 |
+
{
|
3657 |
+
echo json_encode($ret);
|
3658 |
+
die();
|
3659 |
+
}
|
3660 |
add_filter('wpvivid_set_general_setting', array('WPvivid', 'wpvivid_set_general_setting'), 10, 3);
|
3661 |
$options=WPvivid_Setting::get_setting(true, "");
|
3662 |
$setting_data = array();
|
3673 |
{
|
3674 |
die();
|
3675 |
}
|
3676 |
+
$ret = $this->check_schedule_option($schedule);
|
3677 |
+
if($ret['result']!=WPVIVID_SUCCESS)
|
3678 |
+
{
|
3679 |
+
echo json_encode($ret);
|
3680 |
+
die();
|
3681 |
+
}
|
3682 |
//set_schedule_ex
|
3683 |
$ret=WPvivid_Schedule::set_schedule_ex($schedule);
|
3684 |
if($ret['result']!='success')
|
3692 |
die();
|
3693 |
}
|
3694 |
|
3695 |
+
public function check_setting_option($data)
|
3696 |
+
{
|
3697 |
+
$ret['result']=WPVIVID_FAILED;
|
3698 |
+
if(!isset($data['max_file_size']))
|
3699 |
+
{
|
3700 |
+
$ret['error']=__('The maximum zip file size is required.', 'wpvivid');
|
3701 |
+
return $ret;
|
3702 |
+
}
|
3703 |
+
|
3704 |
+
$data['max_file_size']=sanitize_text_field($data['max_file_size']);
|
3705 |
+
|
3706 |
+
if(empty($data['max_file_size']))
|
3707 |
+
{
|
3708 |
+
$ret['error']=__('The maximum zip file size is required.', 'wpvivid');
|
3709 |
+
return $ret;
|
3710 |
+
}
|
3711 |
+
|
3712 |
+
if(!isset($data['exclude_file_size']))
|
3713 |
+
{
|
3714 |
+
$ret['error']=__('The size for excluded files is required.', 'wpvivid');
|
3715 |
+
}
|
3716 |
+
|
3717 |
+
$data['exclude_file_size']=sanitize_text_field($data['exclude_file_size']);
|
3718 |
+
|
3719 |
+
if(empty($data['exclude_file_size']))
|
3720 |
+
{
|
3721 |
+
$ret['error']=__('The size for excluded files is required.', 'wpvivid');
|
3722 |
+
return $ret;
|
3723 |
+
}
|
3724 |
+
|
3725 |
+
if(!isset($data['max_execution_time']))
|
3726 |
+
{
|
3727 |
+
$ret['error']=__('The maximum execution time for PHP script is required.', 'wpvivid');
|
3728 |
+
}
|
3729 |
+
|
3730 |
+
$data['max_execution_time']=sanitize_text_field($data['max_execution_time']);
|
3731 |
+
|
3732 |
+
if(empty($data['max_execution_time']))
|
3733 |
+
{
|
3734 |
+
$ret['error']=__('The maximum execution time for PHP script is required.', 'wpvivid');
|
3735 |
+
return $ret;
|
3736 |
+
}
|
3737 |
+
|
3738 |
+
if(!isset($data['path']))
|
3739 |
+
{
|
3740 |
+
$ret['error']=__('The local storage path is required.', 'wpvivid');
|
3741 |
+
}
|
3742 |
+
|
3743 |
+
$data['path']=sanitize_text_field($data['path']);
|
3744 |
+
|
3745 |
+
if(empty($data['path']))
|
3746 |
+
{
|
3747 |
+
$ret['error']=__('The local storage path is required.', 'wpvivid');
|
3748 |
+
return $ret;
|
3749 |
+
}
|
3750 |
+
|
3751 |
+
$data['email_enable']=sanitize_text_field($data['email_enable']);
|
3752 |
+
$data['send_to']=sanitize_text_field($data['send_to']);
|
3753 |
+
if($data['email_enable'] == '1')
|
3754 |
+
{
|
3755 |
+
if(empty($data['send_to']))
|
3756 |
+
{
|
3757 |
+
$ret['error']=__('An email address is required.', 'wpvivid');
|
3758 |
+
return $ret;
|
3759 |
+
}
|
3760 |
+
}
|
3761 |
+
|
3762 |
+
$ret['result']=WPVIVID_SUCCESS;
|
3763 |
+
return $ret;
|
3764 |
+
}
|
3765 |
+
|
3766 |
+
public function check_schedule_option($data)
|
3767 |
+
{
|
3768 |
+
$ret['result']=WPVIVID_FAILED;
|
3769 |
+
|
3770 |
+
$data['enable']=sanitize_text_field($data['enable']);
|
3771 |
+
$data['save_local_remote']=sanitize_text_field($data['save_local_remote']);
|
3772 |
+
|
3773 |
+
if(!empty($data['enable'])){
|
3774 |
+
if($data['enable'] == '1'){
|
3775 |
+
if(!empty($data['save_local_remote'])){
|
3776 |
+
if($data['save_local_remote'] == 'remote'){
|
3777 |
+
$remote_storage=WPvivid_Setting::get_remote_options();
|
3778 |
+
if($remote_storage == false) {
|
3779 |
+
$ret['error']=__('There is no default remote storage configured. Please set it up first.', 'wpvivid');
|
3780 |
+
return $ret;
|
3781 |
+
}
|
3782 |
+
}
|
3783 |
+
}
|
3784 |
+
}
|
3785 |
+
}
|
3786 |
+
|
3787 |
+
$ret['result']=WPVIVID_SUCCESS;
|
3788 |
+
return $ret;
|
3789 |
+
}
|
3790 |
+
|
3791 |
public function export_setting()
|
3792 |
{
|
3793 |
$this->ajax_check_security('manage_options');
|
3910 |
}
|
3911 |
$archive = new PclZip($path);
|
3912 |
|
3913 |
+
if(!empty($files))
|
3914 |
{
|
3915 |
if(!$archive->add($files,PCLZIP_OPT_REMOVE_ALL_PATH))
|
3916 |
{
|
4270 |
$lock_status='unlock';
|
4271 |
}
|
4272 |
else{
|
4273 |
+
if($value['lock'] == 0){
|
4274 |
$backup_lock='/admin/partials/images/unlocked.png';
|
4275 |
$lock_status='unlock';
|
4276 |
}
|
4299 |
<div style="float:left;padding:0px 10px 10px 0px;">
|
4300 |
<div class="backuptime"><strong>'.__(date('M d, Y H:i',$value['create_time']), 'wpvivid').'</strong></div>
|
4301 |
<div class="common-table">
|
4302 |
+
<span title="To lock the backup, the backup can only be deleted manually" id="wpvivid_lock_'.$key.'">
|
4303 |
+
<img src="'.esc_url(WPVIVID_PLUGIN_URL.$backup_lock).'" name="'.esc_attr($lock_status, 'wpvivid').'" onclick="wpvivid_set_backup_lock(\''.__($key, 'wpvivid').'\', \''.__($lock_status, 'wpvivid').'\');" style="vertical-align:middle; cursor:pointer;"/>
|
4304 |
</span>
|
4305 |
+
| <span>'.__('Type:', 'wpvivid').'</span><span>'.__($value['type'], 'wpvivid').'</span>
|
4306 |
|<span title="Backup log"><a href="#" onclick="wpvivid_initialize_log(\''.__($key, 'wpvivid').'\');"><img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Log.png').'" style="vertical-align:middle;cursor:pointer;"/>'.__('Log', 'wpvivid').'</a></span>
|
4307 |
|<span title="Restore Website from The Backup"><a href="#" onclick="wpvivid_initialize_restore(\''.__($key, 'wpvivid').'\',\''.__(date('M d, Y H:i',$value['create_time']), 'wpvivid').'\');"><img src="'.esc_url(WPVIVID_PLUGIN_URL. '/admin/partials/images/Restore.png').'" style="vertical-align:middle;cursor:pointer;"/>'.__('Restore', 'wpvivid').'</a></span>
|
4308 |
</div>
|
4362 |
<td><input type="checkbox" name="remote_storage" value="'.esc_attr($key, 'wpvivid').'" '.esc_attr($check_status, 'wpvivid').' /></td>
|
4363 |
<td>'.__($storage_type, 'wpvivid').'</td>
|
4364 |
<td class="row-title"><label for="tablecell">'.__($value['name'], 'wpvivid').'</label></td>
|
4365 |
+
<td onclick="wpvivid_delete_remote_storage(\''.__($key, 'wpvivid').'\');"><img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Delete.png').'" style="vertical-align:middle; cursor:pointer;" title="Delete the backup"/>
|
|
|
4366 |
</td>
|
4367 |
</tr>';
|
4368 |
|
4483 |
{
|
4484 |
foreach ($value['remote'] as $remote_key=>$storage_type)
|
4485 |
{
|
|
|
4486 |
if(!array_key_exists('options',$storage_type))
|
4487 |
{
|
4488 |
continue;
|
includes/customclass/class-wpvivid-amazons3-plus.php
CHANGED
@@ -62,14 +62,16 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
62 |
</div>
|
63 |
<div class="remote-storage-amazons3-storage-class">
|
64 |
<label>
|
65 |
-
|
66 |
</label>
|
67 |
</div>
|
68 |
<div class="remote-storage-amazons3-encryption">
|
69 |
<label>
|
70 |
-
|
71 |
</label>
|
72 |
</div>
|
|
|
|
|
73 |
</div>
|
74 |
<?php
|
75 |
}
|
@@ -245,8 +247,12 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
245 |
for($i =sizeof($chunks);$i <$chunk_num;$i ++)
|
246 |
{
|
247 |
$chunk_id = $amazons3 -> uploadPart($this -> bucket,$this->options['s3Path'].$this -> current_file_name,$build_id,$file,$i+1,$this ->upload_chunk_size);
|
248 |
-
if(!$chunk_id)
|
|
|
|
|
|
|
249 |
return array('result' => WPVIVID_FAILED,'error' => 'upload '.$file.' failed.');
|
|
|
250 |
$chunks[] = $chunk_id;
|
251 |
$upload_job['job_data'][basename($file)]['upload_chunks'] = $chunks;
|
252 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,'0','Uploadding '.basename($file).'.',$upload_job['job_data']);
|
@@ -268,8 +274,6 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
268 |
$input = $amazons3 -> inputFile($file);
|
269 |
$result = $amazons3 -> putObject($input,$this ->bucket,$this->options['s3Path'].$this -> current_file_name);
|
270 |
}
|
271 |
-
$upload_job['job_data'][basename($file)]['uploaded']=1;
|
272 |
-
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,'0','Uploading '.basename($file).' completed.',$upload_job['job_data']);
|
273 |
}catch(Exception $e)
|
274 |
{
|
275 |
if(strstr($e -> getMessage(), 'upload ID may be invalid'))
|
@@ -281,11 +285,13 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
|
|
281 |
return array('result' => WPVIVID_FAILED,'error'=>$e -> getMessage());
|
282 |
}
|
283 |
if($result){
|
|
|
|
|
284 |
break;
|
285 |
}
|
286 |
if(!$result && $i == (WPVIVID_REMOTE_CONNECT_RETRY_TIMES - 1))
|
287 |
{
|
288 |
-
return array('result'=>WPVIVID_FAILED,'error'=>'Uploading '.$file.' to
|
289 |
}
|
290 |
sleep(WPVIVID_REMOTE_CONNECT_RETRY_INTERVAL);
|
291 |
}
|
62 |
</div>
|
63 |
<div class="remote-storage-amazons3-storage-class">
|
64 |
<label>
|
65 |
+
<input type="checkbox" option="amazons3" name="classMode"/><?php _e('Storage class: Standard (infrequent access).', 'wpvivid'); ?>
|
66 |
</label>
|
67 |
</div>
|
68 |
<div class="remote-storage-amazons3-encryption">
|
69 |
<label>
|
70 |
+
<input type="checkbox" option="amazons3" name="sse"/><?php _e('Server-side encryption.', 'wpvivid'); ?>
|
71 |
</label>
|
72 |
</div>
|
73 |
+
<div id="wpvivid_storage_account_notice"></div>
|
74 |
+
<div class=""><input class="button-primary storage-account-button" option="add-remote" id="storage_account_button" type="button" name="Example" value="<?php _e( 'Test and Add', 'wpvivid' ); ?>" /></div>
|
75 |
</div>
|
76 |
<?php
|
77 |
}
|
247 |
for($i =sizeof($chunks);$i <$chunk_num;$i ++)
|
248 |
{
|
249 |
$chunk_id = $amazons3 -> uploadPart($this -> bucket,$this->options['s3Path'].$this -> current_file_name,$build_id,$file,$i+1,$this ->upload_chunk_size);
|
250 |
+
if(!$chunk_id){
|
251 |
+
$chunks = array();
|
252 |
+
$upload_job['job_data'][basename($file)]['upload_chunks'] = $chunks;
|
253 |
+
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_DROPBOX,'0','Start multipartupload of '.basename($file).'.',$upload_job['job_data']);
|
254 |
return array('result' => WPVIVID_FAILED,'error' => 'upload '.$file.' failed.');
|
255 |
+
}
|
256 |
$chunks[] = $chunk_id;
|
257 |
$upload_job['job_data'][basename($file)]['upload_chunks'] = $chunks;
|
258 |
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,'0','Uploadding '.basename($file).'.',$upload_job['job_data']);
|
274 |
$input = $amazons3 -> inputFile($file);
|
275 |
$result = $amazons3 -> putObject($input,$this ->bucket,$this->options['s3Path'].$this -> current_file_name);
|
276 |
}
|
|
|
|
|
277 |
}catch(Exception $e)
|
278 |
{
|
279 |
if(strstr($e -> getMessage(), 'upload ID may be invalid'))
|
285 |
return array('result' => WPVIVID_FAILED,'error'=>$e -> getMessage());
|
286 |
}
|
287 |
if($result){
|
288 |
+
$upload_job['job_data'][basename($file)]['uploaded']=1;
|
289 |
+
WPvivid_taskmanager::update_backup_sub_task_progress($task_id,'upload',WPVIVID_REMOTE_AMAZONS3,'0','Uploading '.basename($file).' completed.',$upload_job['job_data']);
|
290 |
break;
|
291 |
}
|
292 |
if(!$result && $i == (WPVIVID_REMOTE_CONNECT_RETRY_TIMES - 1))
|
293 |
{
|
294 |
+
return array('result'=>WPVIVID_FAILED,'error'=>'Uploading '.$file.' to Dropbox server failed. '.$file.' might be deleted or network doesn\'t work properly. Please verify the file and confirm the network connection and try again later.');
|
295 |
}
|
296 |
sleep(WPVIVID_REMOTE_CONNECT_RETRY_INTERVAL);
|
297 |
}
|
includes/customclass/class-wpvivid-ftpclass.php
CHANGED
@@ -70,6 +70,8 @@ class WPvivid_FTPClass extends WPvivid_Remote{
|
|
70 |
<input type="checkbox" option="ftp" name="passive" checked><?php _e('Uncheck this to enable FTP active mode.', 'wpvivid'); ?>
|
71 |
</label>
|
72 |
</div>
|
|
|
|
|
73 |
</div>
|
74 |
<?php
|
75 |
}
|
70 |
<input type="checkbox" option="ftp" name="passive" checked><?php _e('Uncheck this to enable FTP active mode.', 'wpvivid'); ?>
|
71 |
</label>
|
72 |
</div>
|
73 |
+
<div id="wpvivid_storage_account_notice"></div>
|
74 |
+
<div class=""><input class="button-primary storage-account-button" option="add-remote" id="storage_account_button" type="button" name="Example" value="<?php _e( 'Test and Add', 'wpvivid' ); ?>" /></div>
|
75 |
</div>
|
76 |
<?php
|
77 |
}
|
includes/customclass/class-wpvivid-remote.php
CHANGED
@@ -11,21 +11,6 @@ abstract class WPvivid_Remote{
|
|
11 |
public $object;
|
12 |
public $remote;
|
13 |
|
14 |
-
// public function upload_callback_offset($offset,$current_name,$current_size,$last_time,$last_size){
|
15 |
-
// if((time() - $last_time) >3)
|
16 |
-
// {
|
17 |
-
// $v =( $offset - $last_size ) / (time() - $last_time);
|
18 |
-
// $v /= 1000;
|
19 |
-
// $v=round($v,2);
|
20 |
-
//
|
21 |
-
// global $wpvivid_pulgin;
|
22 |
-
// $wpvivid_pulgin->check_cancel_backup( $this->task_id);
|
23 |
-
//
|
24 |
-
// $message='Uploading '.$this->current_upload_file_name.' to '.WPVIVID_REMOTE_FTP.'. Total size: '.$this->formatBytes($this->current_upload_file_size).', Uploaded: '.$this->formatBytes($offset).' speed:'.$v.'kb/s';
|
25 |
-
// WPvivid_taskmanager::update_backup_sub_task_progress($this->task_id,'upload',WPVIVID_REMOTE_SFTP,'0',$message);
|
26 |
-
// }
|
27 |
-
// }
|
28 |
-
|
29 |
abstract public function test_connect();
|
30 |
abstract public function upload($task_id,$files,$callback = ''); // $files = array();
|
31 |
abstract public function download($file,$local_path,$callback = ''); // $file = array('file_name' => ,'size' =>,'md5' =>)
|
@@ -40,13 +25,4 @@ abstract class WPvivid_Remote{
|
|
40 |
$bytes /= (1 << (10 * $pow));
|
41 |
return round($bytes, $precision) . '' . $units[$pow];
|
42 |
}
|
43 |
-
// public function setTaskId($task){
|
44 |
-
// $this -> task_id = $task;
|
45 |
-
// }
|
46 |
-
// public function setCurrentTask($task){
|
47 |
-
// $this -> current_task = $task;
|
48 |
-
// }
|
49 |
-
// public function setLog($log){
|
50 |
-
// $this -> log = $log;
|
51 |
-
// }
|
52 |
}
|
11 |
public $object;
|
12 |
public $remote;
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
abstract public function test_connect();
|
15 |
abstract public function upload($task_id,$files,$callback = ''); // $files = array();
|
16 |
abstract public function download($file,$local_path,$callback = ''); // $file = array('file_name' => ,'size' =>,'md5' =>)
|
25 |
$bytes /= (1 << (10 * $pow));
|
26 |
return round($bytes, $precision) . '' . $units[$pow];
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
includes/customclass/class-wpvivid-sftpclass.php
CHANGED
@@ -71,6 +71,8 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
|
|
71 |
<input type="checkbox" option="sftp" name="default" checked><?php _e('Set as the default remote storage.', 'wpvivid'); ?>
|
72 |
</label>
|
73 |
</div>
|
|
|
|
|
74 |
</div>
|
75 |
<?php
|
76 |
}
|
@@ -343,42 +345,23 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
|
|
343 |
$progress=0;
|
344 |
if(!is_subclass_of($conn,'Net_SSH2'))
|
345 |
{
|
346 |
-
//if($this->current_task!==false)
|
347 |
-
//{
|
348 |
-
// $message=$conn['error'];
|
349 |
-
// WPvivid_taskmanager::update_download_task($this->current_task,$progress,basename($remote_file_name),'error',$message);
|
350 |
-
//}
|
351 |
return $conn;
|
352 |
}
|
353 |
$local_file = fopen($local_path,'ab');
|
354 |
if(!$local_file)
|
355 |
{
|
356 |
-
//if($this->current_task!==false)
|
357 |
-
//{
|
358 |
-
// $message='Unable to create the local file. Please make sure the folder is writable and try again.';
|
359 |
-
// WPvivid_taskmanager::update_download_task($this->current_task,$progress,basename($remote_file_name),'error',$message);
|
360 |
-
//}
|
361 |
return array('result'=>WPVIVID_FAILED,'error'=>'Unable to create the local file. Please make sure the folder is writable and try again.');
|
362 |
}
|
363 |
$stat = fstat($local_file);
|
364 |
$offset = $stat['size'];
|
365 |
$progress= floor(($offset/$file_size)* 100) ;
|
366 |
-
//WPvivid_taskmanager::update_download_task( $this->current_task,$progress,basename($remote_file_name),'running');
|
367 |
|
368 |
$result = $conn->get($remote_file_name,$local_file,$offset,-1,array($this,'download_callback'));
|
369 |
@fclose($local_file);
|
370 |
if($result && md5_file($local_path) == $md5)
|
371 |
{
|
372 |
-
//if($this->current_task!==false)
|
373 |
-
//{
|
374 |
-
// WPvivid_taskmanager::update_download_task( $this->current_task,$progress,basename($remote_file_name),'completed');
|
375 |
-
//}
|
376 |
return array('result'=>WPVIVID_SUCCESS);
|
377 |
}else{
|
378 |
-
//if($this->current_task!==false)
|
379 |
-
//{
|
380 |
-
// WPvivid_taskmanager::update_download_task($this->current_task,$progress,basename($remote_file_name),'error',$this->get_last_error());
|
381 |
-
//}
|
382 |
return array('result'=>WPVIVID_FAILED,'error'=>'Downloading '.$remote_file_name.' failed. '.$remote_file_name.' might be deleted or network doesn\'t work properly. Please verify the file and confirm the network connection and try again later.');
|
383 |
}
|
384 |
}
|
71 |
<input type="checkbox" option="sftp" name="default" checked><?php _e('Set as the default remote storage.', 'wpvivid'); ?>
|
72 |
</label>
|
73 |
</div>
|
74 |
+
<div id="wpvivid_storage_account_notice"></div>
|
75 |
+
<div class=""><input class="button-primary storage-account-button" option="add-remote" id="storage_account_button" type="button" name="Example" value="<?php _e( 'Test and Add', 'wpvivid' ); ?>" /></div>
|
76 |
</div>
|
77 |
<?php
|
78 |
}
|
345 |
$progress=0;
|
346 |
if(!is_subclass_of($conn,'Net_SSH2'))
|
347 |
{
|
|
|
|
|
|
|
|
|
|
|
348 |
return $conn;
|
349 |
}
|
350 |
$local_file = fopen($local_path,'ab');
|
351 |
if(!$local_file)
|
352 |
{
|
|
|
|
|
|
|
|
|
|
|
353 |
return array('result'=>WPVIVID_FAILED,'error'=>'Unable to create the local file. Please make sure the folder is writable and try again.');
|
354 |
}
|
355 |
$stat = fstat($local_file);
|
356 |
$offset = $stat['size'];
|
357 |
$progress= floor(($offset/$file_size)* 100) ;
|
|
|
358 |
|
359 |
$result = $conn->get($remote_file_name,$local_file,$offset,-1,array($this,'download_callback'));
|
360 |
@fclose($local_file);
|
361 |
if($result && md5_file($local_path) == $md5)
|
362 |
{
|
|
|
|
|
|
|
|
|
363 |
return array('result'=>WPVIVID_SUCCESS);
|
364 |
}else{
|
|
|
|
|
|
|
|
|
365 |
return array('result'=>WPVIVID_FAILED,'error'=>'Downloading '.$remote_file_name.' failed. '.$remote_file_name.' might be deleted or network doesn\'t work properly. Please verify the file and confirm the network connection and try again later.');
|
366 |
}
|
367 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: backup, cloud backup, restore, database backup, wordpress backup, backups,
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.0.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 |
|
@@ -15,10 +15,11 @@ WPvivid Backup/Restore is a WordPress backup plugin that provides stable backup
|
|
15 |
The plugin makes WordPress backup and restoration super easy. It creates both manual and automated backups, stores them into remote storage and restores directly from WordPress admin dashboard with a single click.
|
16 |
Backing up to remote storage in the cloud can avoid server-wide risks, WPvivid Backup/Restore currently offers support for Amazon S3, FTP, SFTP. More options will be covered soon.
|
17 |
|
18 |
-
== Why you
|
19 |
-
WordPress is surely a great and secure platform but that does not mean it can protect your site from all threats. You can permanently lose your site
|
20 |
|
21 |
== Why WPvivid Backup/Restore? ==
|
|
|
22 |
= 1. Not only Backup but also Restore =
|
23 |
Not only does the plugin backup, it also restores your site with one click ease.
|
24 |
= 2. Backup to Local as well as Cloud =
|
@@ -67,6 +68,7 @@ We offer responsive and completely free support through 3 channels to ensure you
|
|
67 |
= FAQs: = For regular questions regarding the usage of the plugin, please check out our FAQs section on the page, you can easily find an answer for the most part.
|
68 |
|
69 |
== Installation and Uninstallation ==
|
|
|
70 |
= Install and Activate WPvivid Backup/Restore: =
|
71 |
1.Go to your sites admin dashboard.
|
72 |
2.Navigate to Plugin Menu and search for WPvivid Backup/Restore.
|
@@ -79,7 +81,7 @@ Sometimes this could not fully remove the plugin due to the setting of local fil
|
|
79 |
|
80 |
== Privacy Policy and GDPR Compliance ==
|
81 |
WPvivid Backup/Restore is created and operated with full respect and protection of users personal information, and is in full compliance with General Data Protection Regulation(GDPR). Check out the following content to know the details:
|
82 |
-
= What personal data can WPvivid Backup/Restore access and how the data
|
83 |
WPvivid Backup/Restore currently only has a free version and is available to download from WordPress plugin repository. Thus, all the data related to the updates of the versions as well as the support forum for the plugin on WordPress.org is held by WordPress.org.
|
84 |
In addition, the implementations of all backups and restores of your site happen completely on your website server, there are no data come across any of our servers in the whole process.
|
85 |
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.
|
@@ -108,7 +110,7 @@ To successfully install WPvivid Backup/Restore, make sure the value of upload_ma
|
|
108 |
Currently WPvivid Backup/Restore supports connection to SFTP, FTP and Amazon S3. Pretty much all other popular cloud storage like Google Drive, Google Cloud, Dropbox, Microsoft Azure and more will be covered soon.
|
109 |
= What is the largest website size can the plugin back up? =
|
110 |
Technically, there is no limit to the backup size WPvivid Backup/Restore can run. As long as your hosting server allows for creating a large size of backup, WPvivid Backup/Restore can back it up successfully.
|
111 |
-
= What data
|
112 |
A complete backup includes everything on your website database and directories including database, plugins, themes, files, uploads, and WordPress core files. However, you can also choose to back up only WordPress files or only database.
|
113 |
= Do I need to pay for restore feature? =
|
114 |
Never. Restore feature on WPvivid Backup/Restore is completely free.
|
@@ -133,19 +135,24 @@ Please try to contact your web hosting provider for changing PHP memory limit, o
|
|
133 |
Communication always makes life easier. We have the most approachable and friendly staff out there ready to talk with you and help you out. Do let us know how we can help, and what we can do more. Use the support forum for WPvivid Backup/Restore on WordPress.org or email us at wpvivid.com@gmail.com, you can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
|
134 |
|
135 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
136 |
= 0.9.6 =
|
137 |
- Optimized the code of the plugin.
|
138 |
- A more lightweight Amazon S3 library has been used, so that you do not need to fill in Region field while configuring a S3 storage account.
|
139 |
= 0.9.5 =
|
140 |
- Refined descriptions on the user interface.
|
141 |
- Fixed a few interface errors.
|
142 |
-
- Fixed a bug where
|
143 |
= 0.9.4 =
|
144 |
- Added support for responsive design. Now the plugin is compatible with smartphones, tablets and PC.
|
145 |
- Fixed some UI bugs.
|
146 |
= 0.9.3 =
|
147 |
- Fixed some display errors on the user interface.
|
148 |
-
- Fixed a bug where backups
|
149 |
= 0.9.2 =
|
150 |
Fixed image path display error.
|
151 |
= 0.9.1 =
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.0.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 0.9.7
|
8 |
License: GPLv3 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
10 |
|
15 |
The plugin makes WordPress backup and restoration super easy. It creates both manual and automated backups, stores them into remote storage and restores directly from WordPress admin dashboard with a single click.
|
16 |
Backing up to remote storage in the cloud can avoid server-wide risks, WPvivid Backup/Restore currently offers support for Amazon S3, FTP, SFTP. More options will be covered soon.
|
17 |
|
18 |
+
== Why should you back up your WordPress site? ==
|
19 |
+
WordPress is surely a great and secure platform but that does not mean it can protect your site from all threats. You can permanently lose your site because of a number of unexpected reasons, such as attacks from malicious hackers, business stoppage of your hosting, incorrect settings by yourself and a lot more. Imagine what you can do if a disaster happens to your site some day? Nothing then proves to be easier and more cost-efficient than a backup that you can use to restore everything back to normal.
|
20 |
|
21 |
== Why WPvivid Backup/Restore? ==
|
22 |
+
|
23 |
= 1. Not only Backup but also Restore =
|
24 |
Not only does the plugin backup, it also restores your site with one click ease.
|
25 |
= 2. Backup to Local as well as Cloud =
|
68 |
= FAQs: = For regular questions regarding the usage of the plugin, please check out our FAQs section on the page, you can easily find an answer for the most part.
|
69 |
|
70 |
== Installation and Uninstallation ==
|
71 |
+
|
72 |
= Install and Activate WPvivid Backup/Restore: =
|
73 |
1.Go to your sites admin dashboard.
|
74 |
2.Navigate to Plugin Menu and search for WPvivid Backup/Restore.
|
81 |
|
82 |
== Privacy Policy and GDPR Compliance ==
|
83 |
WPvivid Backup/Restore is created and operated with full respect and protection of users personal information, and is in full compliance with General Data Protection Regulation(GDPR). Check out the following content to know the details:
|
84 |
+
= What personal data can WPvivid Backup/Restore access and how is the data processed? =
|
85 |
WPvivid Backup/Restore currently only has a free version and is available to download from WordPress plugin repository. Thus, all the data related to the updates of the versions as well as the support forum for the plugin on WordPress.org is held by WordPress.org.
|
86 |
In addition, the implementations of all backups and restores of your site happen completely on your website server, there are no data come across any of our servers in the whole process.
|
87 |
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.
|
110 |
Currently WPvivid Backup/Restore supports connection to SFTP, FTP and Amazon S3. Pretty much all other popular cloud storage like Google Drive, Google Cloud, Dropbox, Microsoft Azure and more will be covered soon.
|
111 |
= What is the largest website size can the plugin back up? =
|
112 |
Technically, there is no limit to the backup size WPvivid Backup/Restore can run. As long as your hosting server allows for creating a large size of backup, WPvivid Backup/Restore can back it up successfully.
|
113 |
+
= What data on website is backed up by WPvivid Backup/Restore? =
|
114 |
A complete backup includes everything on your website database and directories including database, plugins, themes, files, uploads, and WordPress core files. However, you can also choose to back up only WordPress files or only database.
|
115 |
= Do I need to pay for restore feature? =
|
116 |
Never. Restore feature on WPvivid Backup/Restore is completely free.
|
135 |
Communication always makes life easier. We have the most approachable and friendly staff out there ready to talk with you and help you out. Do let us know how we can help, and what we can do more. Use the support forum for WPvivid Backup/Restore on WordPress.org or email us at wpvivid.com@gmail.com, you can also reach us with a direct message on [Twitter](https://twitter.com/WPvividcom).
|
136 |
|
137 |
== Changelog ==
|
138 |
+
= 0.9.7 =
|
139 |
+
- Fixed data type errors caused by the last update. The errors would cause the failure of running of scheduled backup tasks. We highly recommend you upgrade.
|
140 |
+
- Fixed a bug where the last backup information was not displayed in the backup schedule list.
|
141 |
+
- Changed a few error messages that appear during the backup process.
|
142 |
+
- Optimized the code of the plugin.
|
143 |
= 0.9.6 =
|
144 |
- Optimized the code of the plugin.
|
145 |
- A more lightweight Amazon S3 library has been used, so that you do not need to fill in Region field while configuring a S3 storage account.
|
146 |
= 0.9.5 =
|
147 |
- Refined descriptions on the user interface.
|
148 |
- Fixed a few interface errors.
|
149 |
+
- Fixed a bug where backups were runnable in some cases during the process of a restoration.
|
150 |
= 0.9.4 =
|
151 |
- Added support for responsive design. Now the plugin is compatible with smartphones, tablets and PC.
|
152 |
- Fixed some UI bugs.
|
153 |
= 0.9.3 =
|
154 |
- Fixed some display errors on the user interface.
|
155 |
+
- Fixed a bug where backups could not be completed in exceptional cases.
|
156 |
= 0.9.2 =
|
157 |
Fixed image path display error.
|
158 |
= 0.9.1 =
|
wpvivid-backuprestore.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @wordpress-plugin
|
8 |
* Plugin Name: WPvivid - Backup/Restore
|
9 |
* Description: Free, simple and easy to use backup plugin for WordPress. Create manual and scheduled backups. Back up to Amazon S3, FTP and SFTP. Restore with one click.
|
10 |
-
* Version: 0.9.
|
11 |
* Author: wpvivid.com
|
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/Restore
|
9 |
* Description: Free, simple and easy to use backup plugin for WordPress. Create manual and scheduled backups. Back up to Amazon S3, FTP and SFTP. Restore with one click.
|
10 |
+
* Version: 0.9.7
|
11 |
* Author: wpvivid.com
|
12 |
* Author URI: https://wpvivid.com
|
13 |
* License: GPL-3.0+
|
21 |
die;
|
22 |
}
|
23 |
|
24 |
+
define( 'WPVIVID_PLUGIN_VERSION', '0.9.7' );
|
25 |
//
|
26 |
define('WPVIVID_RESTORE_INIT','init');
|
27 |
define('WPVIVID_RESTORE_READY','ready');
|