Migration, Backup, Staging – WPvivid - Version 0.9.3

Version Description

Fixed some display errors on the user interface. Fixed a bug where backups cannot be completed in exceptional cases.

Download this release

Release Info

Developer wpvivid
Plugin Icon 128x128 Migration, Backup, Staging – WPvivid
Version 0.9.3
Comparing to
See all releases

Code changes from version 0.9.2 to 0.9.3

admin/class-wpvivid-admin.php CHANGED
@@ -213,9 +213,6 @@ class WPvivid_Admin {
213
  else if(isset($_REQUEST['tab-logs'])){
214
  self::wpvivid_set_page_request('log');
215
  }
216
- else{
217
- self::wpvivid_set_page_request('backup');
218
- }
219
  global $wpvivid_pulgin;
220
  $wpvivid_pulgin->clean_cache();
221
 
213
  else if(isset($_REQUEST['tab-logs'])){
214
  self::wpvivid_set_page_request('log');
215
  }
 
 
 
216
  global $wpvivid_pulgin;
217
  $wpvivid_pulgin->clean_cache();
218
 
admin/js/wpvivid-admin.js CHANGED
@@ -10,6 +10,7 @@ var wpvivid_cur_log_page = 1;
10
  var wpvivid_completed_backup = 1;
11
  var wpvivid_prepare_backup=false;
12
  var wpvivid_restoring=false;
 
13
 
14
  (function ($) {
15
  'use strict';
@@ -184,7 +185,14 @@ var wpvivid_restoring=false;
184
  })(jQuery);
185
 
186
  window.onbeforeunload = function(e) {
187
- if(wpvivid_settings_changed) return '';
 
 
 
 
 
 
 
188
  }
189
 
190
  /**
@@ -234,250 +242,229 @@ function wpvivid_check_runningtask(){
234
  setTimeout(function () {
235
  wpvivid_manage_task();
236
  }, 3000);
237
- var jsonarray = jQuery.parseJSON(data);
238
- if (jsonarray.backup.data.length === 0 && jsonarray.download.data.length === 0) {
239
- if (wpvivid_prepare_backup === false) {
240
- jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
241
- jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
242
- jQuery('#wpvivid_postbox_backup_percent').hide();
243
- }
244
- task_retry_times++;
245
- if (task_retry_times <= 5) {
246
- setTimeout(function () {
247
- m_need_update = true;
248
- wpvivid_manage_task();
249
- }, 3000);
250
- }
251
- }
252
- else {
253
- task_retry_times = 0;
254
- jQuery.each(jsonarray, function (index, value) {
255
- if (index === 'backup') {
256
- if (value.result === "success") {
257
- wpvivid_prepare_backup = false;
258
- jQuery.each(value.data, function (index1, value1) {
259
- if (typeof(value1.size.db_size) !== "undefined" && value1.size.db_size !== "") {
260
- jQuery('#wpvivid_backup_database_size').html(value1.size.db_size);
261
  }
262
  else {
263
  jQuery('#wpvivid_backup_database_size').html("");
264
  }
265
- if (typeof(value1.size.files_size.sum) !== "undefined" && value1.size.files_size.sum !== "") {
266
- jQuery('#wpvivid_backup_file_size').html(value1.size.files_size.sum);
267
  }
268
  else {
269
  jQuery('#wpvivid_backup_file_size').html("");
270
  }
271
- if (value1.status.str === "ready") {
272
- jQuery('#wpvivid_current_doing').html("Ready to backup. Progress: 0%, running time: 0second.");
273
- var percent = "0%";
274
- jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
275
- m_need_update = true;
276
- }
277
- if (value1.status.str === "running") {
278
- running_backup_taskid = index1;
279
- jQuery('#wpvivid_quickbackup_btn').css({
280
- 'pointer-events': 'none',
281
- 'opacity': '0.4'
282
- });
283
- jQuery('#wpvivid_postbox_backup_percent').show();
284
- if (value1.is_canceled === false) {
285
- jQuery('#wpvivid_backup_cancel_btn').css({
286
- 'pointer-events': 'auto',
287
- 'opacity': '1'
288
- });
289
- jQuery('#wpvivid_backup_log_btn').css({
290
- 'pointer-events': 'auto',
291
- 'opacity': '1'
292
- });
293
- if (value1.data.doing !== "") {
294
- var percent = 0;
295
- if (value1.data.type === "backup") {
296
- percent = value1.data.progress / 2;
297
- }
298
- else if (value1.data.type === "upload") {
299
- percent = (100 + value1.data.progress) / 2;
300
- }
301
- percent = percent + "%";
302
- jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
303
- var time = wpvivid_calc_backup_elapsed_time(value1.data.running_time);
304
- if (value1.is_canceled === false) {
305
- jQuery('#wpvivid_current_doing').html(value1.data.descript + " Progress: " + percent + ", running time: " + time + ".");
306
- }
307
- }
308
- }
309
- else {
310
- jQuery('#wpvivid_backup_cancel_btn').css({
311
- 'pointer-events': 'nano',
312
- 'opacity': '0.4'
313
- });
314
- jQuery('#wpvivid_current_doing').html("The backup will be canceled after backing up the current chunk ends.");
315
- }
316
- m_need_update = true;
317
- }
318
- else if (value1.status.str === "wait_resume") {
319
  jQuery('#wpvivid_backup_cancel_btn').css({
320
  'pointer-events': 'auto',
321
  'opacity': '1'
322
  });
323
  jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
324
- var info = "Task " + index1 + " timed out, backup task will retry in " + value1.data.next_resume_time + " seconds, retry times: " + value1.status.resume_count + ".";
325
- jQuery('#wpvivid_quickbackup_btn').css({
326
- 'pointer-events': 'none',
327
- 'opacity': '0.4'
328
- });
329
- jQuery('#wpvivid_postbox_backup_percent').show();
330
- var percent = 0;
331
- if (value1.data.type === "backup") {
332
- percent = value1.data.progress / 2;
333
- }
334
- else if (value1.data.type === "upload") {
335
- percent = (100 + value1.data.progress) / 2;
336
- }
337
- percent = percent + "%";
338
- jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
339
- jQuery('#wpvivid_current_doing').html(info);
340
- if (value1.data.next_resume_time !== "get next resume time failed.") {
341
- wpvivid_resume_backup(index, value1.data.next_resume_time);
342
- }
343
- else {
344
- wpvivid_add_notice('Backup', 'Error', value1.data.next_resume_time);
345
- wpvivid_delete_backup_task(index);
346
  }
347
  }
348
- else if (value1.status.str === "completed") {
349
  jQuery('#wpvivid_backup_cancel_btn').css({
350
- 'pointer-events': 'auto',
351
- 'opacity': '1'
352
  });
353
- jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
354
- var info = "Task " + index1 + " completed.";
355
- wpvivid_add_notice('Backup', 'Success', info);
356
- jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
357
- jQuery('#wpvivid_postbox_backup_percent').hide();
358
- wpvivid_retrieve_backup_list();
359
- wpvivid_retrieve_last_backup_message();
360
- wpvivid_retrieve_log_list();
361
- wpvivid_delete_backup_task(index1);
362
  }
363
- else if (value1.status.str === "error") {
364
- jQuery('#wpvivid_backup_cancel_btn').css({
365
- 'pointer-events': 'auto',
366
- 'opacity': '1'
367
- });
368
- jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
369
- var info = "Backup error: " + value1.status.error + ", task id: " + index1;
370
- wpvivid_add_notice('Backup', 'Error', info);
371
- jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
372
- jQuery('#wpvivid_postbox_backup_percent').hide();
373
- wpvivid_retrieve_last_backup_message();
374
- wpvivid_delete_backup_task(index1);
375
  }
376
- else if (value1.status.str === "no_responds") {
377
- jQuery('#wpvivid_backup_cancel_btn').css({
378
- 'pointer-events': 'auto',
379
- 'opacity': '1'
380
- });
381
- jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
382
- running_backup_taskid = index1;
383
- jQuery('#wpvivid_quickbackup_btn').css({
384
- 'pointer-events': 'none',
385
- 'opacity': '0.4'
386
- });
387
- jQuery('#wpvivid_postbox_backup_percent').show();
388
- if (value1.is_canceled === false) {
389
- if (value1.data.doing !== "") {
390
- var percent = 0;
391
- if (value1.data.type === "backup") {
392
- percent = value1.data.progress / 2;
393
- }
394
- else if (value1.data.type === "upload") {
395
- percent = (100 + value1.data.progress) / 2;
396
- }
397
- percent = percent + "%";
398
- jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
399
- var time = wpvivid_calc_backup_elapsed_time(value1.data.running_time);
400
- if (value1.is_canceled === false) {
401
- jQuery('#wpvivid_current_doing').html("Task , " + value1.data.doing + " is not responding. Progress: " + percent + ", running time: " + time);
402
- }
403
- }
404
- }
405
- else {
406
- jQuery('#wpvivid_backup_cancel_btn').css({
407
- 'pointer-events': 'nano',
408
- 'opacity': '0.4'
409
- });
410
- jQuery('#wpvivid_current_doing').html("The backup will be canceled after backing up the current chunk ends.");
411
- }
412
- m_need_update = true;
413
  }
414
- });
415
- }
416
- }
417
- else if (index === "download") {
418
- var download_array = new Array('backup_type', 'download_type', 'delete_button_id', 'download_button_id', 'progress_id', 'download_text_id', 'split_file_id');
419
- var i = 0;
420
- var file_part = "";
421
- jQuery.each(value.data.type, function (index1, value1) {
422
- download_array = wpvivid_get_download_info(index1, download_array);
423
- var file_name = '';
424
- var part_num = '';
425
- jQuery.each(value1.files, function (index2, value2) {
426
- i++;
427
- if (i < 10) {
428
- part_num = "0" + i;
429
  }
430
  else {
431
- part_num = i;
 
432
  }
433
- file_name = index2;
434
- var progress = '0%';
435
- if (value2.status === 'need_download') {
436
- progress = '0%';
437
- jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
438
- if (m_downloading_file_name === file_name) {
439
- m_need_update = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  }
441
  }
442
- else if (value2.status === 'running') {
443
- if (m_downloading_file_name === file_name) {
444
- wpvivid_lock_download(tmp_current_click_backupid);
445
- }
446
- progress = value2.progress_text + '%';
447
- jQuery("#" + tmp_current_click_backupid + "-text-part-" + i).html("<a>Retriving(remote storage to web server)</a>");
448
- jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  m_need_update = true;
450
  }
451
- else if (value2.status === 'completed') {
452
- if (m_downloading_file_name === file_name) {
453
- wpvivid_unlock_download(tmp_current_click_backupid);
454
- }
455
- progress = '100%';
456
- jQuery("#" + tmp_current_click_backupid + "-text-part-" + i).html("<a onclick=\"wpvivid_download('" + tmp_current_click_backupid + "', '" + index1 + "', '" + file_name + "');\" style=\"cursor: pointer\">Download</a>");
457
- jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
458
  }
459
- else if (value2.status === 'error') {
460
- if (m_downloading_file_name === file_name) {
461
- wpvivid_unlock_download(tmp_current_click_backupid);
462
- }
463
- alert(value2.error);
464
- progress = '0%';
465
- jQuery("#" + tmp_current_click_backupid + "-text-part-" + i).html("<a onclick=\"wpvivid_prepare_download('" + i + "', '" + tmp_current_click_backupid + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a>");
466
- jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
467
  }
468
- else if (value2.stauts === 'timeout') {
469
- if (m_downloading_file_name === file_name) {
470
- wpvivid_unlock_download(tmp_current_click_backupid);
471
- }
472
- alert("Download timeout, please retry.");
473
- progress = '0%';
474
- jQuery("#" + tmp_current_click_backupid + "-text-part-" + i).html("<a onclick=\"wpvivid_prepare_download('" + i + "', '" + tmp_current_click_backupid + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a>");
475
- jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
476
  }
477
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  });
 
 
 
 
 
 
 
479
  }
480
- });
 
 
 
 
 
 
 
 
 
 
 
481
  }
482
  }, function (XMLHttpRequest, textStatus, errorThrown) {
483
  setTimeout(function () {
@@ -559,7 +546,6 @@ function wpvivid_start_backup(){
559
  'backup_files': backup_type,
560
  'ismerge': '1',
561
  'local': local,
562
- 'max_backup_count': 10,
563
  'remote': remote,
564
  'remote_options': json,
565
  'lock':lock
@@ -577,43 +563,44 @@ function wpvivid_start_backup(){
577
  wpvivid_completed_backup = 1;
578
  wpvivid_prepare_backup = true;
579
  wpvivid_post_request(ajax_data, function(data){
580
- var jsonarray = jQuery.parseJSON(data);
581
- if (jsonarray.result === "failed") {
582
- wpvivid_add_notice('Backup', 'Error', jsonarray.error);
583
- jQuery('#wpvivid_quickbackup_btn').css({'pointer-events':'auto', 'opacity':'1'});
584
- jQuery('#wpvivid_postbox_backup_percent').hide();
585
- }
586
- else if(jsonarray.result === "success") {
587
- m_backup_task_id = jsonarray.task_id;
588
- if(jsonarray.check.alert_db === false && jsonarray.check.alter_files === false && jsonarray.check.alter_fcgi === false){
589
- wpvivid_retrieve_backup_list();
590
- wpvivid_backup_now(jsonarray.task_id);
591
  }
592
- else{
593
- var descript = "";
594
- if(jsonarray.check.alert_db === true || jsonarray.check.alter_files === true){
595
- 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" +
596
- "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" +
597
- "Click OK button and continue to back up.";
598
- var ret = confirm(descript);
599
- if(ret === true){
600
- wpvivid_retrieve_backup_list();
601
- wpvivid_backup_now(m_backup_task_id);
602
- }
603
- else{
604
- jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
605
- jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
606
- jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
607
- jQuery('#wpvivid_postbox_backup_percent').hide();
 
 
 
 
 
 
 
608
  }
609
  }
610
  }
611
  }
 
 
 
612
  }, function(XMLHttpRequest, textStatus, errorThrown) {
613
- jQuery('#wpvivid_quickbackup_btn').css({'pointer-events':'auto', 'opacity':'1'});
614
- jQuery('#wpvivid_postbox_backup_percent').hide();
615
  var error_message = wpvivid_output_ajaxerror('preparing the backup', textStatus, errorThrown);
616
- wpvivid_add_notice('Backup', 'Error', error_message);
617
  });
618
  }
619
  else{
@@ -629,6 +616,32 @@ function wpvivid_start_backup(){
629
  }
630
  }
631
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  /**
633
  * Delete the selected backup from the list
634
  *
@@ -664,11 +677,19 @@ function wpvivid_delete_selected_backup(backup_id){
664
  'force': force_del
665
  };
666
  wpvivid_post_request(ajax_data, function(data){
667
- var jsonarray = jQuery.parseJSON(data);
668
- if (jsonarray.result === "failed") {
669
- alert(jsonarray.error);
 
 
 
 
 
 
 
 
 
670
  }
671
- wpvivid_retrieve_backup_list();
672
  }, function(XMLHttpRequest, textStatus, errorThrown) {
673
  var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
674
  alert(error_message);
@@ -700,11 +721,19 @@ function wpvivid_delete_backups_inbatches(){
700
  'backup_id': delete_backup_array
701
  };
702
  wpvivid_post_request(ajax_data, function (data) {
703
- var jsonarray = jQuery.parseJSON(data);
704
- if (jsonarray.result === "failed") {
705
- alert(jsonarray.error);
 
 
 
 
 
 
 
 
 
706
  }
707
- wpvivid_retrieve_backup_list();
708
  }, function (XMLHttpRequest, textStatus, errorThrown) {
709
  var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
710
  alert(error_message);
@@ -738,33 +767,41 @@ function wpvivid_retrieve_last_backup_message(){
738
  'action': 'wpvivid_get_last_backup'
739
  };
740
  wpvivid_post_request(ajax_data, function(data){
741
- var jsonarray = jQuery.parseJSON(data);
742
- if(jsonarray.result === "success"){
743
- if(jsonarray.data.status.str === "completed"){
744
- var backup_status = "Succeed";
745
- var last_backup_msg = "Last backup: " + jsonarray.data.status.start_time + " " + backup_status + " <a onclick=\"wpvivid_retrieve_last_backup_log();\" style=\"cursor:pointer;\"> Log</a>";
746
- jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
747
- }
748
- else if(jsonarray.data.status.str === "error"){
749
- var backup_status = "Failed";
750
- var last_backup_msg = "Last backup: " + jsonarray.data.status.start_time + " " + backup_status + " <a onclick=\"wpvivid_retrieve_last_backup_log();\" style=\"cursor:pointer;\"> Log</a>";
751
- jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
752
- }
753
- else if(jsonarray.data.status.str === "cancel"){
754
- var backup_status = "Failed";
755
- var last_backup_msg = "Last backup: " + jsonarray.data.status.start_time + " " + backup_status + " <a onclick=\"wpvivid_retrieve_last_backup_log();\" style=\"cursor:pointer;\"> Log</a>";
756
- jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
 
 
 
 
 
 
 
757
  }
758
- else{
759
  jQuery('#wpvivid_last_backup_msg_log').hide();
760
- var last_backup_msg = "Last backup: The last backup message not found.";
761
  jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
762
  }
763
  }
764
- else if(jsonarray.result === "failed"){
765
- jQuery('#wpvivid_last_backup_msg_log').hide();
766
- var last_backup_msg = jsonarray.data;
767
- jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
 
768
  }
769
  }, function(XMLHttpRequest, textStatus, errorThrown) {
770
  var error_message = wpvivid_output_ajaxerror('retrieving the last backup log', textStatus, errorThrown);
@@ -872,13 +909,21 @@ function wpvivid_add_remote_storage(action, storage_type){
872
  }
873
  wpvivid_post_request(ajax_data, function(data){
874
  if(action === 'wpvivid_test_remote_connection') {
875
- var jsonarray = jQuery.parseJSON(data);
876
- if(jsonarray.result === "succeed"){
877
- wpvivid_add_remote_storage('wpvivid_add_remote', storage_type);
 
 
 
 
 
 
878
  }
879
- else if(jsonarray.result === "failed"){
880
- alert(jsonarray.error);
881
- jQuery('#storage_account_button').css({'pointer-events':'auto', 'opacity':'1'});
 
 
882
  }
883
  }
884
  else if(action === 'wpvivid_add_remote') {
@@ -936,83 +981,91 @@ function wpvivid_retrieve_storage_list() {
936
  function wpvivid_handle_remote_storage_data(data){
937
  jQuery('#wpvivid_remote_storage_list').html("");
938
  var i = 0;
939
- var jsonarray = jQuery.parseJSON(data);
940
- if (jsonarray.result === "success") {
941
- jQuery.each(jsonarray.data, function (index, value) {
942
- var check_status = "";
943
- var default_storage = "";
944
- i++;
945
- if(jsonarray.data.remote_selected.length !== 0) {
946
- jQuery.each(jsonarray.data.remote_selected, function (index1, value1) {
947
- default_storage = value1;
948
- wpvivid_default_remote_storage = value1;
949
- if (index === default_storage) {
950
- check_status = "checked";
951
- if (value.type === "ftp") {
952
- jQuery('#wpvivid_out_of_date_remote_path').html(value.options.path);
953
- jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp.png");
954
- jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
955
- jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
956
- jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp.png");
957
- jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
958
- jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
959
- }
960
- else if (value.type === "sftp") {
961
- jQuery('#wpvivid_out_of_date_remote_path').html(value.options.path);
962
- jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp.png");
963
- jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
964
- jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
965
- jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
966
- jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp.png");
967
- jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
968
- }
969
- else if (value.type === "amazonS3") {
970
- jQuery('#wpvivid_out_of_date_remote_path').html(value.options.s3Path);
971
- jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3.png");
972
- jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
973
- jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
974
- jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
975
- jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
976
- jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3.png");
 
 
977
  }
978
- }
979
- });
980
- }
981
- else{
982
- wpvivid_default_remote_storage = '';
983
- jQuery('#wpvivid_out_of_date_remote_path').html("There is no path for remote storage, please set it up first.");
984
- jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
985
- jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
986
- jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
987
- jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
988
- jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
989
- jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
990
- }
991
- if(index !== "remote_selected") {
992
- var storage_type = '';
993
- if (value.type === "ftp") {
994
- storage_type = "FTP";
995
  }
996
- else if (value.type === "sftp") {
997
- storage_type = "SFTP";
 
 
 
 
 
 
 
998
  }
999
- else if (value.type === "amazonS3") {
1000
- storage_type = "Amazon S3";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1001
  }
1002
- var $remote_storage_tr = jQuery("<tr>" +
1003
- "<td>" + i + "</td>" +
1004
- "<td><input type=\"checkbox\" name=\"remote_storage\" value=\"" + index + "\" " + check_status + " /></td>" +
1005
- "<td>" + storage_type + "</td>" +
1006
- "<td class=\"row-title\"><label for=\"tablecell\">" + value.options.name + "</label></td>" +
1007
- "<td onclick=\"wpvivid_delete_remote_storage('" + index + "');\">" +
1008
- "<img src=\"" + wpvivid_plugurl + "/images/Delete.png\" style=\"vertical-align:middle; cursor:pointer;\" title=\"Delete the backup\"/>" +
1009
- "</td>" +
1010
- "</tr>");
1011
- var $remote_storage_table = jQuery('#wpvivid_remote_storage_list');
1012
- $remote_storage_table.append($remote_storage_tr);
1013
- }
1014
- });
1015
- wpvivid_interface_flow_control();
1016
  }
1017
  }
1018
 
@@ -1049,77 +1102,85 @@ function wpvivid_retrieve_backup_list(){
1049
  'action': 'wpvivid_get_backup_list'
1050
  };
1051
  wpvivid_post_request(ajax_data, function(data){
1052
- jQuery('#wpvivid_backuplist').html("");
1053
- var jsonarray = jQuery.parseJSON(data);
1054
- var amazon_s3_url = "/images/storage-amazon-s3(gray).png";
1055
- var ftp_url = "/images/storage-ftp(gray).png";
1056
- var sftp_url = "/images/storage-sftp(gray).png";
1057
- var backup_lock_img = "/images/unlocked.png";
1058
- var backup_lock_status = "unlock";
1059
- if(jsonarray.result === "success") {
1060
- jQuery.each(jsonarray.data, function (index, value1) {
1061
- amazon_s3_url = "/images/storage-amazon-s3(gray).png";
1062
- ftp_url = "/images/storage-ftp(gray).png";
1063
- sftp_url = "/images/storage-sftp(gray).png";
1064
- if (typeof(value1.lock) == "undefined"){
1065
- backup_lock_img = "/images/unlocked.png";
1066
- backup_lock_status = "unlock";
1067
- }
1068
- else{
1069
- if(value1.lock === 0){
1070
  backup_lock_img = "/images/unlocked.png";
1071
  backup_lock_status = "unlock";
1072
  }
1073
- else{
1074
- backup_lock_img = "/images/locked.png";
1075
- backup_lock_status = "lock";
1076
- }
1077
- }
1078
- jQuery.each(value1.remote, function (index2, value2){
1079
- if(value2.type === "amazonS3"){
1080
- amazon_s3_url = "/images/storage-amazon-s3.png";
1081
- }
1082
- if(value2.type === "ftp"){
1083
- ftp_url = "/images/storage-ftp.png";
1084
- }
1085
- if(value2.type === "sftp"){
1086
- sftp_url = "/images/storage-sftp.png";
1087
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
  });
1089
- var $backuptr = jQuery("<tr>" +
1090
- "<td><input name=\"\" type=\"checkbox\" id=\""+index+"\" value=\""+index+"\" onclick=\"wpvivid_click_check_backup('"+index+"');\" /></td>" +
1091
- "<td style=\"min-width:300px;\">" +
1092
- "<div style=\"float:left;padding:10px 10px 10px 0px;min-width:300px;\">" +
1093
- "<span><strong>"+value1.create_time+"</strong></span></br>" +
1094
- "<span title=\"Lock the backup, it won\'t be deleted automatically\">" +
1095
- "<img src=\""+wpvivid_plugurl+backup_lock_img+"\" name=\""+backup_lock_status+"\" onclick=\"wpvivid_set_backup_lock('"+index+"','"+backup_lock_status+"');\" style=\"vertical-align:middle; cursor:pointer;\"/>" +
1096
- "</span> | <span>Type: </span><span>"+value1.type+"</span></br>" +
1097
- "<span><span><a href=\"#\" onclick=\"wpvivid_initialize_log('"+index+"');\"><img src=\""+wpvivid_plugurl+"/images/Log.png\" name=\""+backup_lock_status+"\" style=\"vertical-align:middle;cursor:pointer;\"/>Log</a></span>|<a href=\"#\" onclick=\"wpvivid_initialize_restore('"+index+"', '"+value1.create_time+"');\"><img src=\""+wpvivid_plugurl+"/images/Restore.png\" style=\"vertical-align:middle;cursor:pointer;\"/>Restore</a></span>" +
1098
- "</td>" +
1099
- "<td style=\"min-width:300px;\">" +
1100
- "<div style=\"float:left;padding:10px 10px 10px 0px;\">" +
1101
- "<img src=\""+wpvivid_plugurl+amazon_s3_url+"\" style=\"vertical-align:middle;\" title=\"Amazon S3\"/>" +
1102
- "<img src=\""+wpvivid_plugurl+ftp_url+"\" style=\"vertical-align:middle;\" title=\"FTP\"/>" +
1103
- "<img src=\""+wpvivid_plugurl+sftp_url+"\" style=\"vertical-align:middle;\" title=\"SFTP\"/>" +
1104
- "</div>" +
1105
- "</td>" +
1106
- "<td>" +
1107
- "<div id=\"wpvivid_file_part_"+index+"\" style=\"float:left;padding:10px 10px 10px 0px; min-width:290px;\">" +
1108
- "<div style=\"cursor:pointer;\" onclick=\"wpvivid_initialize_download('"+index+"');\">" +
1109
- "<img id=\"wpvivid_download_btn_"+index+"\" src=\""+wpvivid_plugurl+"/images/download.png\" style=\"vertical-align:middle;\" />Download" +
1110
- "<div class=\"spinner\" id=\"wpvivid_download_loading_"+index+"\" style=\"float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;\"></div>" +
1111
- "</div>" +
1112
- "</div>" +
1113
- "</td>" +
1114
- "<td>" +
1115
- "<div onclick=\"wpvivid_delete_selected_backup('"+index+"');\">" +
1116
- "<img src=\""+wpvivid_plugurl+"/images/Delete.png\" style=\"vertical-align:middle; cursor:pointer;\" title=\"Delete the backup\"/>" +
1117
- "</div>" +
1118
- "</td>" +
1119
- "</tr>");
1120
- var $backuptable = jQuery('#wpvivid_backuplist');
1121
- $backuptable.append($backuptr);
1122
- });
1123
  }
1124
  },function(XMLHttpRequest, textStatus, errorThrown) {
1125
  setTimeout(function () {
@@ -1287,16 +1348,24 @@ function wpvivid_set_general_settings(){
1287
  'opacity': '0.4'
1288
  });
1289
  wpvivid_post_request(ajax_data, function (data) {
1290
- jQuery('#wpvivid_setting_general_save').css({
1291
- 'pointer-events': 'auto',
1292
- 'opacity': '1'
1293
- });
1294
- var jsonarray = jQuery.parseJSON(data);
1295
- if (jsonarray.result === "success") {
1296
- location.reload();
 
 
 
 
 
1297
  }
1298
- else {
1299
- alert(jsonarray.error);
 
 
 
1300
  }
1301
  }, function (XMLHttpRequest, textStatus, errorThrown) {
1302
  jQuery('#wpvivid_setting_general_save').css({
@@ -1320,13 +1389,21 @@ function wpvivid_set_general_settings(){
1320
  };
1321
  jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'none', 'opacity': '0.4'});
1322
  wpvivid_post_request(ajax_data, function (data) {
1323
- jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
1324
- var jsonarray = jQuery.parseJSON(data);
1325
- if (jsonarray.result === "success") {
1326
- location.reload();
 
 
 
 
 
1327
  }
1328
- else {
1329
- alert(jsonarray.error);
 
 
 
1330
  }
1331
  }, function (XMLHttpRequest, textStatus, errorThrown) {
1332
  jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
@@ -1366,12 +1443,20 @@ function wpvivid_email_test(){
1366
  'send_to': mail
1367
  };
1368
  wpvivid_post_request(ajax_data, function(data){
1369
- var jsonarray = jQuery.parseJSON(data);
1370
- if(jsonarray.result === "success"){
1371
- jQuery('#wpvivid_send_email_res').html("Test successed.");
 
 
 
 
 
1372
  }
1373
- else{
1374
- jQuery('#wpvivid_send_email_res').html("Test failed, " + jsonarray.error);
 
 
 
1375
  }
1376
  }, function(XMLHttpRequest, textStatus, errorThrown) {
1377
  var error_message = wpvivid_output_ajaxerror('sending test mail', textStatus, errorThrown);
@@ -1383,7 +1468,7 @@ function wpvivid_email_test(){
1383
  * This function will export settings to local folder
1384
  */
1385
  function wpvivid_export_settings() {
1386
- wpvivid_settings_changed = false;
1387
  location.href =ajaxurl+'?action=wpvivid_export_setting&setting=1&history=1';
1388
  }
1389
 
@@ -1407,12 +1492,20 @@ function wpvivid_import_settings(){
1407
  'data': fileString
1408
  };
1409
  wpvivid_post_request(ajax_data, function(data){
1410
- var jsonarray = jQuery.parseJSON(data);
1411
- if(jsonarray.result === "success") {
1412
- location.reload();
 
 
 
 
 
1413
  }
1414
- else{
1415
- alert("Error: " + jsonarray.error);
 
 
 
1416
  }
1417
  }, function(XMLHttpRequest, textStatus, errorThrown) {
1418
  var error_message = wpvivid_output_ajaxerror('importing the previously-exported settings', textStatus, errorThrown);
@@ -1432,29 +1525,44 @@ function wpvivid_retrieve_last_backup_log(){
1432
  'action': 'wpvivid_get_last_backup'
1433
  };
1434
  wpvivid_post_request(ajax_data, function(data){
1435
- var jsonarray = jQuery.parseJSON(data);
1436
- if(jsonarray.result !== "failed")
1437
- {
1438
- if (jsonarray.data.length !== 0) {
1439
- ajax_data={
1440
- 'action': 'wpvivid_read_last_backup_log',
1441
- 'log_file_name': jsonarray.data.log_file_name
1442
- };
1443
- wpvivid_post_request(ajax_data, function(data) {
1444
- var jsonarray = jQuery.parseJSON(data);
1445
- if(jsonarray.result === "success") {
1446
- wpvivid_show_log(data);
1447
- }
1448
- else{
 
 
 
 
 
 
 
 
 
 
 
 
1449
  var div = "Reading the log failed. Please try again.";
1450
  jQuery('#wpvivid_display_log_content').html(div);
1451
- }
1452
- }, function(XMLHttpRequest, textStatus, errorThrown) {
1453
- var div = "Reading the log failed. Please try again.";
1454
- jQuery('#wpvivid_display_log_content').html(div);
1455
- });
1456
  }
1457
  }
 
 
 
 
 
 
1458
  }, function(XMLHttpRequest, textStatus, errorThrown) {
1459
  var div = "Reading the log failed. Please try again.";
1460
  jQuery('#wpvivid_display_log_content').html(div);
@@ -1572,7 +1680,11 @@ function wpvivid_interface_flow_control(){
1572
  wpvivid_settings_changed = true;
1573
  });
1574
 
1575
- jQuery("#wpvivid_storage_account_block input").on("change", function(){
 
 
 
 
1576
  wpvivid_settings_changed = true;
1577
  });
1578
  }
@@ -1740,106 +1852,110 @@ function wpvivid_initialize_download(backup_id){
1740
  'backup_id':backup_id
1741
  };
1742
  wpvivid_post_request(ajax_data, function(data){
1743
- jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
1744
- var jsonarray = jQuery.parseJSON(data);
1745
- if(jsonarray.result === "success"){
1746
- jQuery('#wpvivid_file_part_'+backup_id).html("");
1747
- var download_array = new Array('backup_type', 'download_type', 'delete_button_id', 'download_button_id', 'progress_id', 'download_text_id', 'split_file_id');
1748
- var i = 0;
1749
- var file_part="";
1750
- var file_not_found = false;
1751
- jQuery.each(jsonarray.data.type, function (index, value){
1752
- download_array = wpvivid_get_download_info(index, download_array);
1753
- var file_name = '';
1754
- var part_num = '';
1755
- jQuery.each(value.files, function(index1, value1){
1756
- i++;
1757
- if(i < 10){
1758
- part_num = "0"+i;
1759
- }
1760
- else{
1761
- part_num = i;
1762
- }
1763
- file_name = index1;
1764
- if(value1.status === 'need_download'){
1765
- file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1766
- "<span>Part"+part_num+"</span></br>" +
1767
- "<span id=\""+backup_id+"-text-part-"+i+"\"><a onclick=\"wpvivid_prepare_download('"+i+"', '"+backup_id+"', '"+file_name+"');\" style=\"cursor: pointer\">Prepare to Download</a></span></br>" +
1768
- "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\""+backup_id+"-progress-part-"+i+"\" style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1769
- "<span>size:</span><span>"+value1.size+"</span>" +
1770
- "</div>";
1771
- jQuery('#wpvivid_file_part_'+backup_id).append(file_part);
1772
- }
1773
- else if(value1.status === 'running'){
1774
- if(m_downloading_file_name === file_name) {
1775
- wpvivid_lock_download(tmp_current_click_backupid);
1776
  }
1777
- file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1778
- "<span>Part"+part_num+"</span></br>" +
1779
- "<span id=\""+backup_id+"-text-part-"+i+"\"><a >Retriving(remote storage to web server)</a></span></br>" +
1780
- "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\""+backup_id+"-progress-part-"+i+"\" style=\"background-color:#0085ba; float:left;width:50%;height:5px;\"></div></div>" +
1781
- "<span>size:</span><span>"+value1.size+"</span>" +
1782
- "</div>";
1783
- jQuery('#wpvivid_file_part_'+backup_id).append(file_part);
1784
- }
1785
- else if(value1.status === 'completed') {
1786
- if(m_downloading_file_name === file_name) {
1787
- wpvivid_unlock_download(tmp_current_click_backupid);
1788
  }
1789
- file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1790
- "<span>Part"+part_num+"</span></br>" +
1791
- "<span id=\""+backup_id+"-text-part-"+i+"\"><a onclick=\"wpvivid_download('"+backup_id+"', '"+index+"', '"+file_name+"');\" style=\"cursor: pointer\">Download</a></span></br>" +
1792
- "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\""+backup_id+"-progress-part-"+i+"\" style=\"background-color:#0085ba; float:left;width:100%;height:5px;\"></div></div>" +
1793
- "<span>size:</span><span>"+value1.size+"</span>" +
1794
- "</div>";
1795
- jQuery('#wpvivid_file_part_'+backup_id).append(file_part);
1796
- }
1797
- else if(value1.status === 'error') {
1798
- if(m_downloading_file_name === file_name) {
1799
- wpvivid_unlock_download(tmp_current_click_backupid);
1800
  }
1801
- alert(value1.error);
1802
- file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1803
- "<span>Part"+part_num+"</span></br>" +
1804
- "<span id=\""+backup_id+"-text-part-"+i+"\"><a onclick=\"wpvivid_prepare_download('"+i+"', '"+backup_id+"', '"+file_name+"');\" style=\"cursor: pointer\">Prepare to Download</a></span></br>" +
1805
- "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\""+backup_id+"-progress-part-"+i+"\" style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1806
- "<span>size:</span><span>"+value1.size+"</span>" +
1807
- "</div>";
1808
- jQuery('#wpvivid_file_part_'+backup_id).append(file_part);
1809
- }
1810
- else if(value1.status === 'timeout'){
1811
- if(m_downloading_file_name === file_name) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1812
  wpvivid_unlock_download(tmp_current_click_backupid);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1813
  }
1814
- file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1815
- "<span>Part"+part_num+"</span></br>" +
1816
- "<span id=\""+backup_id+"-text-part-"+i+"\"><a onclick=\"wpvivid_prepare_download('"+i+"', '"+backup_id+"', '"+file_name+"');\" style=\"cursor: pointer\">Prepare to Download</a></span></br>" +
1817
- "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\""+backup_id+"-progress-part-"+i+"\" style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1818
- "<span>size:</span><span>"+value1.size+"</span>" +
1819
- "</div>";
1820
- jQuery('#wpvivid_file_part_'+backup_id).append(file_part);
1821
- }
1822
- else if(value1.status === 'file_not_found'){
1823
- wpvivid_unlock_download(tmp_current_click_backupid);
1824
- wpvivid_reset_backup_list();
1825
- file_not_found = true;
1826
- alert("Download failed, file not found. The file might has been moved, renamed or deleted. Please verify the file exists and try again.");
1827
- return false;
1828
  }
1829
  });
1830
- if(file_not_found === false) {
1831
- if (i % 2 !== 0) {
1832
- part_num++;
1833
- file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px; color:#cccccc;\">" +
1834
- "<span>Part" + part_num + "</span></br>" +
1835
- "<span>Download</span></br>" +
1836
- "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1837
- "<span>size:</span><span>0</span>" +
1838
- "</div>";
1839
- jQuery('#wpvivid_file_part_' + backup_id).append(file_part);
1840
- }
1841
- }
1842
- });
1843
  }
1844
  },function(XMLHttpRequest, textStatus, errorThrown){
1845
  jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
@@ -2009,9 +2125,6 @@ function wpvivid_prepare_download(part_num, backup_id, file_name){
2009
  wpvivid_lock_download(backup_id);
2010
  m_downloading_file_name = file_name;
2011
  wpvivid_post_request(ajax_data, function(data){
2012
- var jsonarray = jQuery.parseJSON(data);
2013
- if(jsonarray.result === "success"){
2014
- }
2015
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2016
  wpvivid_unlock_download(backup_id);
2017
  jQuery('#delete_btn_part'+part_num).css({'pointer-events': 'auto', 'opacity': '1'});
@@ -2031,7 +2144,7 @@ function wpvivid_prepare_download(part_num, backup_id, file_name){
2031
  * @param file_name - File name
2032
  */
2033
  function wpvivid_download(backup_id, backup_type, file_name){
2034
- wpvivid_settings_changed = false;
2035
  location.href =ajaxurl+'?action=wpvivid_download_backup&backup_id='+backup_id+'&download_type='+backup_type+'&file_name='+file_name;
2036
  }
2037
 
@@ -2342,32 +2455,40 @@ function wpvivid_retrieve_log_list(){
2342
  'action': 'wpvivid_get_log_list'
2343
  };
2344
  wpvivid_post_request(ajax_data, function(data){
2345
- jQuery('#wpvivid_loglist').html("");
2346
- var jsonarray = jQuery.parseJSON(data);
2347
- if(jsonarray.result === "success"){
2348
- var log_count = 0;
2349
- jQuery.each(jsonarray.data.log_list.file, function(index, value){
2350
- var log_time = value.time;
2351
- if(log_time === ""){
2352
- log_time = "N/A";
2353
- }
2354
- var log_des = value.des;
2355
- if(log_des === ""){
2356
- log_des = "N/A";
2357
- }
2358
- var log_tr = "<tr>" +
2359
- "<td class=\"row-title\"><label for=\"tablecell\">"+log_time+"</label></td>" +
2360
- "<td>"+log_des+"</td>" +
2361
- "<td>"+value.file_name+"</td>" +
2362
- "<td><a onclick='wpvivid_view_log(\""+log_count+"\");' style=\"cursor:pointer;\" ><img src=\""+wpvivid_plugurl+"/images/Log.png\" style=\"vertical-align:middle;\">Log</a></td>" +
2363
- "<td id=\""+log_count+"\" style='display: none'>"+value.path+"</td>"
 
2364
  "</tr>";
2365
- var log_table = jQuery('#wpvivid_loglist');
2366
- log_table.append(log_tr);
2367
- log_count++;
2368
- });
2369
- wpvivid_log_count = log_count;
2370
- wpvivid_display_log_page();
 
 
 
 
 
 
 
2371
  }
2372
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2373
  setTimeout(function () {
@@ -2397,21 +2518,29 @@ function wpvivid_view_log(num){
2397
  'path': log_path
2398
  };
2399
  wpvivid_post_request(ajax_data, function (data) {
2400
- jQuery('#wpvivid_read_log_content').html("");
2401
- var jsonarray = jQuery.parseJSON(data);
2402
- if (jsonarray.result === "success") {
2403
- var log_data = jsonarray.data;
2404
- while (log_data.indexOf('\n') >= 0) {
2405
- var iLength = log_data.indexOf('\n');
2406
- var log = log_data.substring(0, iLength);
2407
- log_data = log_data.substring(iLength + 1);
2408
- var insert_log = "<div style=\"clear:both;\">" + log + "</div>";
2409
- jQuery('#wpvivid_read_log_content').append(insert_log);
 
 
 
 
 
 
2410
  }
2411
  }
2412
- else if (jsonarray.result === "failed") {
2413
- var div = "Reading the log failed. Please try again.";
2414
- jQuery('#wpvivid_read_log_content').html(div);
 
 
2415
  }
2416
  }, function (XMLHttpRequest, textStatus, errorThrown) {
2417
  var div = "Reading the log failed. Please try again.";
@@ -2447,10 +2576,19 @@ function wpvivid_set_default_remote_storage(){
2447
  'remote_storage': remote_storage
2448
  };
2449
  wpvivid_post_request(ajax_data, function(data){
2450
- var jsonarray = jQuery.parseJSON(data);
2451
- if(jsonarray.result === "success") {
2452
- location.replace(location.href);
2453
- wpvivid_retrieve_default_remote_storage();
 
 
 
 
 
 
 
 
 
2454
  }
2455
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2456
  var error_message = wpvivid_output_ajaxerror('setting up the default remote storage', textStatus, errorThrown);
@@ -2563,22 +2701,30 @@ function wpvivid_init_restore_data(){
2563
  'backup_id':m_restore_backup_id
2564
  };
2565
  wpvivid_post_request(ajax_data, function(data){
2566
- var jsonarray = jQuery.parseJSON(data);
2567
- if(jsonarray.has_exist_restore === 0){
2568
- jQuery('#wpvivid_restore_btn').css({'pointer-events': 'auto', 'opacity': '1'});
2569
- jQuery('#wpvivid_clean_restore').css({'pointer-events': 'none', 'opacity': '0.4'});
2570
- jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
2571
- jQuery('#wpvivid_restore_btn').show();
2572
- }
2573
- else {
2574
- if(jsonarray.has_exist_restore === 1){
2575
- jQuery('#wpvivid_restore_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
2576
- jQuery('#wpvivid_clean_restore').css({'pointer-events': 'auto', 'opacity': '1'});
2577
  jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
2578
- jQuery('#wpvivid_clean_restore').show();
2579
- wpvivid_display_restore_msg("Has old restore task, please delete first.");
 
 
 
 
 
 
 
 
2580
  }
2581
  }
 
 
 
 
 
 
2582
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2583
  var error_message = wpvivid_output_ajaxerror('initializing restore information', textStatus, errorThrown);
2584
  wpvivid_display_restore_msg(error_message);
@@ -2615,31 +2761,39 @@ function wpvivid_prepare_restore(){
2615
  jQuery('#wpvivid_clean_restore').hide();
2616
  jQuery('#wpvivid_rollback_btn').hide();
2617
  wpvivid_post_request(ajax_data, function(data) {
2618
- var jsonarray = jQuery.parseJSON(data);
2619
- if(jsonarray.result === "success"){
2620
- wpvivid_display_restore_msg("Prepare to start restoring.");
2621
- wpvivid_restore_lock();
2622
- wpvivid_monitor_restore_task();
2623
- wpvivid_restore();
2624
- }
2625
- else if(jsonarray.result === "need_download"){
2626
- var download_array = new Array();
2627
- var download_num = 0;
2628
- var start_download_num=0;
2629
- wpvivid_display_restore_msg("Backup is not found on web server. Prepare to download it from remote storage.");
2630
- jQuery.each(jsonarray.files, function (index, value) {
2631
- if (value.status === "need_download") {
2632
- download_array[download_num] = new Array('file_name', 'file_size');
2633
- download_array[download_num]['file_name']=index;
2634
- download_array[download_num]['file_size']=value.size;
2635
- download_array[download_num]['md5']=value.md5;
2636
- download_num++;
2637
- }
2638
- });
2639
- wpvivid_download_restore_file(download_array, download_num, start_download_num);
 
 
 
 
 
2640
  }
2641
- else if(jsonarray.result === "file_not_found"){
2642
- wpvivid_display_restore_msg("Backup doesn't exist in both web server and remote storage. Restore failed.");
 
 
 
2643
  }
2644
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2645
  var error_message = wpvivid_output_ajaxerror('preparing to restore', textStatus, errorThrown);
@@ -2689,8 +2843,7 @@ function wpvivid_monitor_restore_task(){
2689
 
2690
  wpvivid_post_request(ajax_data, function(data)
2691
  {
2692
- try
2693
- {
2694
  var jsonarray = jQuery.parseJSON(data);
2695
 
2696
  if(typeof jsonarray ==='object')
@@ -2764,8 +2917,7 @@ function wpvivid_monitor_restore_task(){
2764
  }, 1000);
2765
  }
2766
  }
2767
- catch (err)
2768
- {
2769
  setTimeout(function()
2770
  {
2771
  wpvivid_monitor_restore_task();
@@ -2820,9 +2972,17 @@ function wpvivid_delete_incompleted_restore(){
2820
  jQuery('#wpvivid_clean_restore').show();
2821
  jQuery('#wpvivid_rollback_btn').hide();
2822
  wpvivid_post_request(ajax_data, function(data) {
2823
- var jsonarray = jQuery.parseJSON(data);
2824
- if(jsonarray.result === "success"){
2825
- wpvivid_init_restore_data();
 
 
 
 
 
 
 
 
2826
  }
2827
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2828
  var error_message = wpvivid_output_ajaxerror('deleting the last incomplete restore task', textStatus, errorThrown);
@@ -2844,14 +3004,22 @@ function wpvivid_rollback(){
2844
  'action': 'wpvivid_rollback'
2845
  };
2846
  wpvivid_post_request(ajax_data, function(data) {
2847
- var jsonarray = jQuery.parseJSON(data);
2848
- if(jsonarray.result === "success"){
2849
- wpvivid_display_restore_msg("Rollback completed.");
2850
- jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'auto', 'opacity': '1'});
 
 
 
 
 
 
2851
  }
2852
- else if(jsonarray.result === "failed") {
2853
- wpvivid_display_restore_msg(jsonarray.error);
2854
- jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'auto', 'opacity': '1'});
 
 
2855
  }
2856
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2857
  var error_message = wpvivid_output_ajaxerror('starting rollbacking', textStatus, errorThrown);
@@ -2868,8 +3036,7 @@ function wpvivid_monitor_rollback_task(){
2868
  'wpvivid_restore' : '1',
2869
  };
2870
  wpvivid_post_request(ajax_data, function(data){
2871
- try
2872
- {
2873
  var jsonarray = jQuery.parseJSON(data);
2874
 
2875
  if(typeof jsonarray ==='object')
@@ -2930,8 +3097,7 @@ function wpvivid_monitor_rollback_task(){
2930
  }, 1000);
2931
  }
2932
  }
2933
- catch (err)
2934
- {
2935
  setTimeout(function()
2936
  {
2937
  wpvivid_monitor_rollback_task();
@@ -2983,9 +3149,17 @@ function wpvivid_delete_out_of_date_backups(){
2983
  jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'none', 'opacity': '0.4'});
2984
  wpvivid_post_request(ajax_data, function(data){
2985
  jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
2986
- var jsonarray = jQuery.parseJSON(data);
2987
- if(jsonarray.result === "success"){
2988
- alert("Out of date backups have been removed.");
 
 
 
 
 
 
 
 
2989
  }
2990
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2991
  var error_message = wpvivid_output_ajaxerror('deleting out of date backups', textStatus, errorThrown);
@@ -3008,12 +3182,20 @@ function wpvivid_calculate_diskspaceused(){
3008
  wpvivid_post_request(ajax_data, function(data){
3009
  jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
3010
  jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
3011
- var jsonarray = jQuery.parseJSON(data);
3012
- if(jsonarray.result === "success"){
3013
- jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
3014
- jQuery('#wpvivid_junk_log_path').html(jsonarray.data.log_path);
3015
- jQuery('#wpvivid_junk_file_path').html(jsonarray.data.junk_path);
3016
- jQuery('#wpvivid_restore_temp_file_path').html(jsonarray.data.old_files_path);
 
 
 
 
 
 
 
 
3017
  }
3018
  }, function(XMLHttpRequest, textStatus, errorThrown) {
3019
  var error_message = wpvivid_output_ajaxerror('calculating server disk space in use by WPvivid', textStatus, errorThrown);
@@ -3076,14 +3258,22 @@ function wpvivid_clean_junk_files(){
3076
  jQuery('input[name="junk-files"][value="junk-files"]').prop('checked', false);
3077
  jQuery('input[name="junk-files"][value="junk-temporary-files"]').prop('checked', false);
3078
  alert("The selected junk flies have been deleted.");
3079
- var jsonarray = jQuery.parseJSON(data);
3080
- if (jsonarray.result === "success") {
3081
- jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
3082
- jQuery('#wpvivid_junk_log_path').html(jsonarray.data.log_path);
3083
- jQuery('#wpvivid_junk_file_path').html(jsonarray.data.junk_path);
3084
- jQuery('#wpvivid_restore_temp_file_path').html(jsonarray.data.old_files_path);
 
 
 
 
 
 
 
 
 
3085
  }
3086
- wpvivid_retrieve_log_list();
3087
  }, function (XMLHttpRequest, textStatus, errorThrown) {
3088
  var error_message = wpvivid_output_ajaxerror('cleaning out junk files', textStatus, errorThrown);
3089
  alert(error_message);
@@ -3098,7 +3288,7 @@ function wpvivid_clean_junk_files(){
3098
  * Download the relevant website info and error logs to your PC for debugging purposes.
3099
  */
3100
  function wpvivid_download_website_info(){
3101
- wpvivid_settings_changed = false;
3102
  location.href =ajaxurl+'?action=wpvivid_create_debug_package';
3103
  }
3104
 
@@ -3115,4 +3305,10 @@ function wpvivid_output_ajaxerror(action, textStatus, errorThrown){
3115
  var error_msg = "wpvivid_request: "+ textStatus + "(" + errorThrown + "): an error occurred while " + action + ". " +
3116
  "This error could be caused by an unstable internet connection. Please try again later.";
3117
  return error_msg;
 
 
 
 
 
 
3118
  }
10
  var wpvivid_completed_backup = 1;
11
  var wpvivid_prepare_backup=false;
12
  var wpvivid_restoring=false;
13
+ var wpvivid_location_href=false;
14
 
15
  (function ($) {
16
  'use strict';
185
  })(jQuery);
186
 
187
  window.onbeforeunload = function(e) {
188
+ if (wpvivid_settings_changed) {
189
+ if (wpvivid_location_href){
190
+ wpvivid_location_href = false;
191
+ }
192
+ else {
193
+ return 'You are leaving the page without saving your changes, any unsaved changes on the page will be lost, are you sure you want to continue?';
194
+ }
195
+ }
196
  }
197
 
198
  /**
242
  setTimeout(function () {
243
  wpvivid_manage_task();
244
  }, 3000);
245
+ try {
246
+ var jsonarray = jQuery.parseJSON(data);
247
+ var b_has_data = false;
248
+ if (jsonarray.backup.data.length !== 0) {
249
+ b_has_data = true;
250
+ task_retry_times = 0;
251
+ if (jsonarray.backup.result === 'success') {
252
+ wpvivid_prepare_backup = false;
253
+ jQuery.each(jsonarray.backup.data, function (index, value) {
254
+ if (value.size != false) {
255
+ if (typeof(value.size.db_size) !== "undefined" && value.size.db_size !== "") {
256
+ jQuery('#wpvivid_backup_database_size').html(value.size.db_size);
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
258
  else {
259
  jQuery('#wpvivid_backup_database_size').html("");
260
  }
261
+ if (typeof(value.size.files_size.sum) !== "undefined" && value.size.files_size.sum !== "") {
262
+ jQuery('#wpvivid_backup_file_size').html(value.size.files_size.sum);
263
  }
264
  else {
265
  jQuery('#wpvivid_backup_file_size').html("");
266
  }
267
+ }
268
+ if (value.status.str === "ready") {
269
+ jQuery('#wpvivid_current_doing').html("Ready to backup. Progress: 0%, running time: 0second.");
270
+ var percent = "0%";
271
+ jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
272
+ m_need_update = true;
273
+ }
274
+ else if (value.status.str === "running") {
275
+ running_backup_taskid = index;
276
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
277
+ jQuery('#wpvivid_postbox_backup_percent').show();
278
+ if (value.is_canceled === false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  jQuery('#wpvivid_backup_cancel_btn').css({
280
  'pointer-events': 'auto',
281
  'opacity': '1'
282
  });
283
  jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
284
+ if (value.data.doing !== "") {
285
+ var percent = 0;
286
+ if (value.data.type === "backup") {
287
+ percent = value.data.progress / 2;
288
+ }
289
+ else if (value.data.type === "upload") {
290
+ percent = (100 + value.data.progress) / 2;
291
+ }
292
+ percent = percent + "%";
293
+ jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
294
+ var time = wpvivid_calc_backup_elapsed_time(value.data.running_time);
295
+ if (value.is_canceled === false) {
296
+ jQuery('#wpvivid_current_doing').html(value.data.descript + " Progress: " + percent + ", running time: " + time + ".");
297
+ }
 
 
 
 
 
 
 
 
298
  }
299
  }
300
+ else {
301
  jQuery('#wpvivid_backup_cancel_btn').css({
302
+ 'pointer-events': 'nano',
303
+ 'opacity': '0.4'
304
  });
305
+ jQuery('#wpvivid_current_doing').html("The backup will be canceled after backing up the current chunk ends.");
 
 
 
 
 
 
 
 
306
  }
307
+ m_need_update = true;
308
+ }
309
+ else if (value.status.str === "wait_resume") {
310
+ jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
311
+ jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
312
+ var info = "Task " + index + " timed out, backup task will retry in " + value.data.next_resume_time + " seconds, retry times: " + value.status.resume_count + ".";
313
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
314
+ jQuery('#wpvivid_postbox_backup_percent').show();
315
+ var percent = 0;
316
+ if (value.data.type === "backup") {
317
+ percent = value.data.progress / 2;
 
318
  }
319
+ else if (value.data.type === "upload") {
320
+ percent = (100 + value.data.progress) / 2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  }
322
+ percent = percent + "%";
323
+ jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
324
+ jQuery('#wpvivid_current_doing').html(info);
325
+ if (value.data.next_resume_time !== "get next resume time failed.") {
326
+ wpvivid_resume_backup(index, value.data.next_resume_time);
 
 
 
 
 
 
 
 
 
 
327
  }
328
  else {
329
+ wpvivid_add_notice('Backup', 'Error', value.data.next_resume_time);
330
+ wpvivid_delete_backup_task(index);
331
  }
332
+ }
333
+ else if (value.status.str === "no_responds") {
334
+ jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
335
+ jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
336
+ running_backup_taskid = index;
337
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
338
+ jQuery('#wpvivid_postbox_backup_percent').show();
339
+ if (value.is_canceled === false) {
340
+ if (value.data.doing !== "") {
341
+ var percent = 0;
342
+ if (value.data.type === "backup") {
343
+ percent = value.data.progress / 2;
344
+ }
345
+ else if (value.data.type === "upload") {
346
+ percent = (100 + value.data.progress) / 2;
347
+ }
348
+ percent = percent + "%";
349
+ jQuery('#wpvivid_action_progress_bar_percent').css("width", percent);
350
+ var time = wpvivid_calc_backup_elapsed_time(value.data.running_time);
351
+ if (value.is_canceled === false) {
352
+ jQuery('#wpvivid_current_doing').html("Task , " + value.data.doing + " is not responding. Progress: " + percent + ", running time: " + time);
353
+ }
354
  }
355
  }
356
+ else {
357
+ jQuery('#wpvivid_backup_cancel_btn').css({
358
+ 'pointer-events': 'nano',
359
+ 'opacity': '0.4'
360
+ });
361
+ jQuery('#wpvivid_current_doing').html("The backup will be canceled after backing up the current chunk ends.");
362
+ }
363
+ m_need_update = true;
364
+ }
365
+ else if (value.status.str === "completed") {
366
+ jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
367
+ jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
368
+ var info = "Task " + index + " completed.";
369
+ wpvivid_add_notice('Backup', 'Success', info);
370
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
371
+ jQuery('#wpvivid_postbox_backup_percent').hide();
372
+ wpvivid_retrieve_backup_list();
373
+ wpvivid_retrieve_last_backup_message();
374
+ wpvivid_retrieve_log_list();
375
+ wpvivid_delete_backup_task(index);
376
+ }
377
+ else if (value.status.str === "error") {
378
+ jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
379
+ jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
380
+ var info = "Backup error: " + value.status.error + ", task id: " + index;
381
+ wpvivid_add_notice('Backup', 'Error', info);
382
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
383
+ jQuery('#wpvivid_postbox_backup_percent').hide();
384
+ wpvivid_retrieve_last_backup_message();
385
+ wpvivid_delete_backup_task(index);
386
+ }
387
+ });
388
+ }
389
+ }
390
+ if (jsonarray.download.data.length !== 0) {
391
+ b_has_data = true;
392
+ task_retry_times = 0;
393
+ var download_array = new Array('backup_type', 'download_type', 'delete_button_id', 'download_button_id', 'progress_id', 'download_text_id', 'split_file_id');
394
+ var i = 0;
395
+ var file_part = "";
396
+ jQuery.each(jsonarray.download.data.type, function (index, value) {
397
+ download_array = wpvivid_get_download_info(index, download_array);
398
+ var file_name = '';
399
+ var part_num = '';
400
+ jQuery.each(value.files, function (index1, value1) {
401
+ i++;
402
+ part_num = wpvivid_prefix_integer(i);
403
+ file_name = index1;
404
+ var progress = '0%';
405
+ if (value1.status === 'need_download') {
406
+ progress = '0%';
407
+ jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
408
+ if (m_downloading_file_name === file_name) {
409
  m_need_update = true;
410
  }
411
+ }
412
+ else if (value1.status === 'running') {
413
+ if (m_downloading_file_name === file_name) {
414
+ wpvivid_lock_download(tmp_current_click_backupid);
 
 
 
415
  }
416
+ progress = value1.progress_text + '%';
417
+ jQuery("#" + tmp_current_click_backupid + "-text-part-" + i).html("<a>Retriving(remote storage to web server)</a>");
418
+ jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
419
+ m_need_update = true;
420
+ }
421
+ else if (value1.status === 'completed') {
422
+ if (m_downloading_file_name === file_name) {
423
+ wpvivid_unlock_download(tmp_current_click_backupid);
424
  }
425
+ progress = '100%';
426
+ 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>");
427
+ jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
428
+ }
429
+ else if (value1.status === 'error') {
430
+ if (m_downloading_file_name === file_name) {
431
+ wpvivid_unlock_download(tmp_current_click_backupid);
 
432
  }
433
+ alert(value1.error);
434
+ progress = '0%';
435
+ jQuery("#" + tmp_current_click_backupid + "-text-part-" + i).html("<a onclick=\"wpvivid_prepare_download('" + i + "', '" + tmp_current_click_backupid + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a>");
436
+ jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
437
+ }
438
+ else if (value1.stauts === 'timeout') {
439
+ if (m_downloading_file_name === file_name) {
440
+ wpvivid_unlock_download(tmp_current_click_backupid);
441
+ }
442
+ alert("Download timeout, please retry.");
443
+ progress = '0%';
444
+ jQuery("#" + tmp_current_click_backupid + "-text-part-" + i).html("<a onclick=\"wpvivid_prepare_download('" + i + "', '" + tmp_current_click_backupid + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a>");
445
+ jQuery("#" + tmp_current_click_backupid + "-progress-part-" + i).css('width', progress);
446
+ }
447
  });
448
+ });
449
+ }
450
+ if (!b_has_data) {
451
+ if (wpvivid_prepare_backup === false) {
452
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
453
+ jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
454
+ jQuery('#wpvivid_postbox_backup_percent').hide();
455
  }
456
+ task_retry_times++;
457
+ if (task_retry_times <= 5) {
458
+ m_need_update = true;
459
+ }
460
+ }
461
+ }
462
+ catch(err){
463
+ setTimeout(function()
464
+ {
465
+ m_need_update = true;
466
+ wpvivid_manage_task();
467
+ }, 1000);
468
  }
469
  }, function (XMLHttpRequest, textStatus, errorThrown) {
470
  setTimeout(function () {
546
  'backup_files': backup_type,
547
  'ismerge': '1',
548
  'local': local,
 
549
  'remote': remote,
550
  'remote_options': json,
551
  'lock':lock
563
  wpvivid_completed_backup = 1;
564
  wpvivid_prepare_backup = true;
565
  wpvivid_post_request(ajax_data, function(data){
566
+ try {
567
+ var jsonarray = jQuery.parseJSON(data);
568
+ if (jsonarray.result === "failed") {
569
+ wpvivid_delete_ready_task(jsonarray.error);
 
 
 
 
 
 
 
570
  }
571
+ else if(jsonarray.result === "success") {
572
+ m_backup_task_id = jsonarray.task_id;
573
+ if(jsonarray.check.alert_db === false && jsonarray.check.alter_files === false && jsonarray.check.alter_fcgi === false){
574
+ wpvivid_retrieve_backup_list();
575
+ wpvivid_backup_now(jsonarray.task_id);
576
+ }
577
+ else{
578
+ var descript = "";
579
+ if(jsonarray.check.alert_db === true || jsonarray.check.alter_files === true){
580
+ 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" +
581
+ "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" +
582
+ "Click OK button and continue to back up.";
583
+ var ret = confirm(descript);
584
+ if(ret === true){
585
+ wpvivid_retrieve_backup_list();
586
+ wpvivid_backup_now(m_backup_task_id);
587
+ }
588
+ else{
589
+ jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'});
590
+ jQuery('#wpvivid_backup_log_btn').css({'pointer-events': 'auto', 'opacity': '1'});
591
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
592
+ jQuery('#wpvivid_postbox_backup_percent').hide();
593
+ }
594
  }
595
  }
596
  }
597
  }
598
+ catch(err){
599
+ wpvivid_delete_ready_task(err);
600
+ }
601
  }, function(XMLHttpRequest, textStatus, errorThrown) {
 
 
602
  var error_message = wpvivid_output_ajaxerror('preparing the backup', textStatus, errorThrown);
603
+ wpvivid_delete_ready_task(error_message);
604
  });
605
  }
606
  else{
616
  }
617
  }
618
 
619
+ function wpvivid_delete_ready_task(error){
620
+ var ajax_data={
621
+ 'action': 'wpvivid_delete_ready_task'
622
+ };
623
+ wpvivid_post_request(ajax_data, function (data) {
624
+ try {
625
+ var jsonarray = jQuery.parseJSON(data);
626
+ if (jsonarray.result === "success") {
627
+ wpvivid_add_notice('Backup', 'Error', error);
628
+ jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'});
629
+ jQuery('#wpvivid_postbox_backup_percent').hide();
630
+ }
631
+ }
632
+ catch(err){
633
+ setTimeout(function()
634
+ {
635
+ wpvivid_delete_ready_task(error);
636
+ }, 1000);
637
+ }
638
+ }, function (XMLHttpRequest, textStatus, errorThrown) {
639
+ setTimeout(function () {
640
+ wpvivid_delete_ready_task(error);
641
+ }, 3000);
642
+ });
643
+ }
644
+
645
  /**
646
  * Delete the selected backup from the list
647
  *
677
  'force': force_del
678
  };
679
  wpvivid_post_request(ajax_data, function(data){
680
+ try {
681
+ var jsonarray = jQuery.parseJSON(data);
682
+ if (jsonarray.result === "failed") {
683
+ alert(jsonarray.error);
684
+ }
685
+ wpvivid_retrieve_backup_list();
686
+ }
687
+ catch(err){
688
+ setTimeout(function()
689
+ {
690
+ wpvivid_delete_selected_backup(backup_id);
691
+ }, 1000);
692
  }
 
693
  }, function(XMLHttpRequest, textStatus, errorThrown) {
694
  var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
695
  alert(error_message);
721
  'backup_id': delete_backup_array
722
  };
723
  wpvivid_post_request(ajax_data, function (data) {
724
+ try {
725
+ var jsonarray = jQuery.parseJSON(data);
726
+ if (jsonarray.result === "failed") {
727
+ alert(jsonarray.error);
728
+ }
729
+ wpvivid_retrieve_backup_list();
730
+ }
731
+ catch(err){
732
+ setTimeout(function()
733
+ {
734
+ wpvivid_delete_backups_inbatches();
735
+ }, 1000);
736
  }
 
737
  }, function (XMLHttpRequest, textStatus, errorThrown) {
738
  var error_message = wpvivid_output_ajaxerror('deleting the backup', textStatus, errorThrown);
739
  alert(error_message);
767
  'action': 'wpvivid_get_last_backup'
768
  };
769
  wpvivid_post_request(ajax_data, function(data){
770
+ try {
771
+ var jsonarray = jQuery.parseJSON(data);
772
+ if (jsonarray.result === "success") {
773
+ if (jsonarray.data.status.str === "completed") {
774
+ var backup_status = "Succeed";
775
+ var last_backup_msg = "Last backup: " + jsonarray.data.status.start_time + " " + backup_status + " <a onclick=\"wpvivid_retrieve_last_backup_log();\" style=\"cursor:pointer;\"> Log</a>";
776
+ jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
777
+ }
778
+ else if (jsonarray.data.status.str === "error") {
779
+ var backup_status = "Failed";
780
+ var last_backup_msg = "Last backup: " + jsonarray.data.status.start_time + " " + backup_status + " <a onclick=\"wpvivid_retrieve_last_backup_log();\" style=\"cursor:pointer;\"> Log</a>";
781
+ jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
782
+ }
783
+ else if (jsonarray.data.status.str === "cancel") {
784
+ var backup_status = "Failed";
785
+ var last_backup_msg = "Last backup: " + jsonarray.data.status.start_time + " " + backup_status + " <a onclick=\"wpvivid_retrieve_last_backup_log();\" style=\"cursor:pointer;\"> Log</a>";
786
+ jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
787
+ }
788
+ else {
789
+ jQuery('#wpvivid_last_backup_msg_log').hide();
790
+ var last_backup_msg = "Last backup: The last backup message not found.";
791
+ jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
792
+ }
793
  }
794
+ else if (jsonarray.result === "failed") {
795
  jQuery('#wpvivid_last_backup_msg_log').hide();
796
+ var last_backup_msg = jsonarray.data;
797
  jQuery('#wpvivid_last_backup_msg').html(last_backup_msg);
798
  }
799
  }
800
+ catch(err){
801
+ setTimeout(function()
802
+ {
803
+ wpvivid_retrieve_last_backup_message();
804
+ }, 1000);
805
  }
806
  }, function(XMLHttpRequest, textStatus, errorThrown) {
807
  var error_message = wpvivid_output_ajaxerror('retrieving the last backup log', textStatus, errorThrown);
909
  }
910
  wpvivid_post_request(ajax_data, function(data){
911
  if(action === 'wpvivid_test_remote_connection') {
912
+ try {
913
+ var jsonarray = jQuery.parseJSON(data);
914
+ if (jsonarray.result === "succeed") {
915
+ wpvivid_add_remote_storage('wpvivid_add_remote', storage_type);
916
+ }
917
+ else if (jsonarray.result === "failed") {
918
+ alert(jsonarray.error);
919
+ jQuery('#storage_account_button').css({'pointer-events': 'auto', 'opacity': '1'});
920
+ }
921
  }
922
+ catch(err){
923
+ setTimeout(function()
924
+ {
925
+ wpvivid_add_remote_storage(action, storage_type);
926
+ }, 1000);
927
  }
928
  }
929
  else if(action === 'wpvivid_add_remote') {
981
  function wpvivid_handle_remote_storage_data(data){
982
  jQuery('#wpvivid_remote_storage_list').html("");
983
  var i = 0;
984
+ try {
985
+ var jsonarray = jQuery.parseJSON(data);
986
+ if (jsonarray.result === "success") {
987
+ jQuery.each(jsonarray.data, function (index, value) {
988
+ var check_status = "";
989
+ var default_storage = "";
990
+ i++;
991
+ if (jsonarray.data.remote_selected.length !== 0) {
992
+ jQuery.each(jsonarray.data.remote_selected, function (index1, value1) {
993
+ default_storage = value1;
994
+ wpvivid_default_remote_storage = value1;
995
+ if (index === default_storage) {
996
+ check_status = "checked";
997
+ if (value.type === "ftp") {
998
+ jQuery('#wpvivid_out_of_date_remote_path').html(value.options.path);
999
+ jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp.png");
1000
+ jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
1001
+ jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
1002
+ jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp.png");
1003
+ jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
1004
+ jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
1005
+ }
1006
+ else if (value.type === "sftp") {
1007
+ jQuery('#wpvivid_out_of_date_remote_path').html(value.options.path);
1008
+ jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp.png");
1009
+ jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
1010
+ jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
1011
+ jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
1012
+ jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp.png");
1013
+ jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
1014
+ }
1015
+ else if (value.type === "amazonS3") {
1016
+ jQuery('#wpvivid_out_of_date_remote_path').html(value.options.s3Path);
1017
+ jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3.png");
1018
+ jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
1019
+ jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
1020
+ jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
1021
+ jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
1022
+ jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3.png");
1023
+ }
1024
  }
1025
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1026
  }
1027
+ else {
1028
+ wpvivid_default_remote_storage = '';
1029
+ jQuery('#wpvivid_out_of_date_remote_path').html("There is no path for remote storage, please set it up first.");
1030
+ jQuery('#wpvivid_upload_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
1031
+ jQuery('#wpvivid_upload_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
1032
+ jQuery('#wpvivid_upload_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
1033
+ jQuery('#wpvivid_schedule_storage_type_ftp').attr("src", wpvivid_plugurl + "/images/storage-ftp(gray).png");
1034
+ jQuery('#wpvivid_schedule_storage_type_sftp').attr('src', wpvivid_plugurl + "/images/storage-sftp(gray).png");
1035
+ jQuery('#wpvivid_schedule_storage_type_amazon_s3').attr("src", wpvivid_plugurl + "/images/storage-amazon-s3(gray).png");
1036
  }
1037
+ if (index !== "remote_selected") {
1038
+ var storage_type = '';
1039
+ if (value.type === "ftp") {
1040
+ storage_type = "FTP";
1041
+ }
1042
+ else if (value.type === "sftp") {
1043
+ storage_type = "SFTP";
1044
+ }
1045
+ else if (value.type === "amazonS3") {
1046
+ storage_type = "Amazon S3";
1047
+ }
1048
+ var $remote_storage_tr = jQuery("<tr>" +
1049
+ "<td>" + i + "</td>" +
1050
+ "<td><input type=\"checkbox\" name=\"remote_storage\" value=\"" + index + "\" " + check_status + " /></td>" +
1051
+ "<td>" + storage_type + "</td>" +
1052
+ "<td class=\"row-title\"><label for=\"tablecell\">" + value.options.name + "</label></td>" +
1053
+ "<td onclick=\"wpvivid_delete_remote_storage('" + index + "');\">" +
1054
+ "<img src=\"" + wpvivid_plugurl + "/images/Delete.png\" style=\"vertical-align:middle; cursor:pointer;\" title=\"Delete the backup\"/>" +
1055
+ "</td>" +
1056
+ "</tr>");
1057
+ var $remote_storage_table = jQuery('#wpvivid_remote_storage_list');
1058
+ $remote_storage_table.append($remote_storage_tr);
1059
  }
1060
+ });
1061
+ wpvivid_interface_flow_control();
1062
+ }
1063
+ }
1064
+ catch(err){
1065
+ setTimeout(function()
1066
+ {
1067
+ wpvivid_handle_remote_storage_data(data);
1068
+ }, 1000);
 
 
 
 
 
1069
  }
1070
  }
1071
 
1102
  'action': 'wpvivid_get_backup_list'
1103
  };
1104
  wpvivid_post_request(ajax_data, function(data){
1105
+ try {
1106
+ var jsonarray = jQuery.parseJSON(data);
1107
+ jQuery('#wpvivid_backuplist').html("");
1108
+ var amazon_s3_url = "/images/storage-amazon-s3(gray).png";
1109
+ var ftp_url = "/images/storage-ftp(gray).png";
1110
+ var sftp_url = "/images/storage-sftp(gray).png";
1111
+ var backup_lock_img = "/images/unlocked.png";
1112
+ var backup_lock_status = "unlock";
1113
+ if (jsonarray.result === "success") {
1114
+ jQuery.each(jsonarray.data, function (index, value1) {
1115
+ amazon_s3_url = "/images/storage-amazon-s3(gray).png";
1116
+ ftp_url = "/images/storage-ftp(gray).png";
1117
+ sftp_url = "/images/storage-sftp(gray).png";
1118
+ if (typeof(value1.lock) == "undefined") {
 
 
 
 
1119
  backup_lock_img = "/images/unlocked.png";
1120
  backup_lock_status = "unlock";
1121
  }
1122
+ else {
1123
+ if (value1.lock === 0) {
1124
+ backup_lock_img = "/images/unlocked.png";
1125
+ backup_lock_status = "unlock";
1126
+ }
1127
+ else {
1128
+ backup_lock_img = "/images/locked.png";
1129
+ backup_lock_status = "lock";
1130
+ }
 
 
 
 
 
1131
  }
1132
+ jQuery.each(value1.remote, function (index2, value2) {
1133
+ if (value2.type === "amazonS3") {
1134
+ amazon_s3_url = "/images/storage-amazon-s3.png";
1135
+ }
1136
+ if (value2.type === "ftp") {
1137
+ ftp_url = "/images/storage-ftp.png";
1138
+ }
1139
+ if (value2.type === "sftp") {
1140
+ sftp_url = "/images/storage-sftp.png";
1141
+ }
1142
+ });
1143
+ var $backuptr = jQuery("<tr>" +
1144
+ "<td><input name=\"\" type=\"checkbox\" id=\"" + index + "\" value=\"" + index + "\" onclick=\"wpvivid_click_check_backup('" + index + "');\" /></td>" +
1145
+ "<td style=\"min-width:300px;\">" +
1146
+ "<div style=\"float:left;padding:10px 10px 10px 0px;min-width:300px;\">" +
1147
+ "<span><strong>" + value1.create_time + "</strong></span></br>" +
1148
+ "<span title=\"Lock the backup, it won\'t be deleted automatically\">" +
1149
+ "<img src=\"" + wpvivid_plugurl + backup_lock_img + "\" name=\"" + backup_lock_status + "\" onclick=\"wpvivid_set_backup_lock('" + index + "','" + backup_lock_status + "');\" style=\"vertical-align:middle; cursor:pointer;\"/>" +
1150
+ "</span> | <span>Type: </span><span>" + value1.type + "</span></br>" +
1151
+ "<span><span><a href=\"#\" onclick=\"wpvivid_initialize_log('" + index + "');\"><img src=\"" + wpvivid_plugurl + "/images/Log.png\" name=\"" + backup_lock_status + "\" style=\"vertical-align:middle;cursor:pointer;\"/>Log</a></span>|<a href=\"#\" onclick=\"wpvivid_initialize_restore('" + index + "', '" + value1.create_time + "');\"><img src=\"" + wpvivid_plugurl + "/images/Restore.png\" style=\"vertical-align:middle;cursor:pointer;\"/>Restore</a></span>" +
1152
+ "</td>" +
1153
+ "<td style=\"min-width:300px;\">" +
1154
+ "<div style=\"float:left;padding:10px 10px 10px 0px;\">" +
1155
+ "<img src=\"" + wpvivid_plugurl + amazon_s3_url + "\" style=\"vertical-align:middle;\" title=\"Amazon S3\"/>" +
1156
+ "<img src=\"" + wpvivid_plugurl + ftp_url + "\" style=\"vertical-align:middle;\" title=\"FTP\"/>" +
1157
+ "<img src=\"" + wpvivid_plugurl + sftp_url + "\" style=\"vertical-align:middle;\" title=\"SFTP\"/>" +
1158
+ "</div>" +
1159
+ "</td>" +
1160
+ "<td>" +
1161
+ "<div id=\"wpvivid_file_part_" + index + "\" style=\"float:left;padding:10px 10px 10px 0px; min-width:290px;\">" +
1162
+ "<div style=\"cursor:pointer;\" onclick=\"wpvivid_initialize_download('" + index + "');\">" +
1163
+ "<img id=\"wpvivid_download_btn_" + index + "\" src=\"" + wpvivid_plugurl + "/images/download.png\" style=\"vertical-align:middle;\" />Download" +
1164
+ "<div class=\"spinner\" id=\"wpvivid_download_loading_" + index + "\" style=\"float:right;width:auto;height:auto;padding:10px 180px 10px 0;background-position:0 0;\"></div>" +
1165
+ "</div>" +
1166
+ "</div>" +
1167
+ "</td>" +
1168
+ "<td>" +
1169
+ "<div onclick=\"wpvivid_delete_selected_backup('" + index + "');\">" +
1170
+ "<img src=\"" + wpvivid_plugurl + "/images/Delete.png\" style=\"vertical-align:middle; cursor:pointer;\" title=\"Delete the backup\"/>" +
1171
+ "</div>" +
1172
+ "</td>" +
1173
+ "</tr>");
1174
+ var $backuptable = jQuery('#wpvivid_backuplist');
1175
+ $backuptable.append($backuptr);
1176
  });
1177
+ }
1178
+ }
1179
+ catch(err){
1180
+ setTimeout(function()
1181
+ {
1182
+ wpvivid_retrieve_backup_list();
1183
+ }, 1000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1184
  }
1185
  },function(XMLHttpRequest, textStatus, errorThrown) {
1186
  setTimeout(function () {
1348
  'opacity': '0.4'
1349
  });
1350
  wpvivid_post_request(ajax_data, function (data) {
1351
+ try {
1352
+ var jsonarray = jQuery.parseJSON(data);
1353
+ jQuery('#wpvivid_setting_general_save').css({
1354
+ 'pointer-events': 'auto',
1355
+ 'opacity': '1'
1356
+ });
1357
+ if (jsonarray.result === "success") {
1358
+ location.reload();
1359
+ }
1360
+ else {
1361
+ alert(jsonarray.error);
1362
+ }
1363
  }
1364
+ catch(err){
1365
+ setTimeout(function()
1366
+ {
1367
+ wpvivid_set_general_settings();
1368
+ }, 1000);
1369
  }
1370
  }, function (XMLHttpRequest, textStatus, errorThrown) {
1371
  jQuery('#wpvivid_setting_general_save').css({
1389
  };
1390
  jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'none', 'opacity': '0.4'});
1391
  wpvivid_post_request(ajax_data, function (data) {
1392
+ try {
1393
+ var jsonarray = jQuery.parseJSON(data);
1394
+ jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
1395
+ if (jsonarray.result === "success") {
1396
+ location.reload();
1397
+ }
1398
+ else {
1399
+ alert(jsonarray.error);
1400
+ }
1401
  }
1402
+ catch(err){
1403
+ setTimeout(function()
1404
+ {
1405
+ wpvivid_set_general_settings();
1406
+ }, 1000);
1407
  }
1408
  }, function (XMLHttpRequest, textStatus, errorThrown) {
1409
  jQuery('#wpvivid_setting_general_save').css({'pointer-events': 'auto', 'opacity': '1'});
1443
  'send_to': mail
1444
  };
1445
  wpvivid_post_request(ajax_data, function(data){
1446
+ try {
1447
+ var jsonarray = jQuery.parseJSON(data);
1448
+ if (jsonarray.result === "success") {
1449
+ jQuery('#wpvivid_send_email_res').html("Test successed.");
1450
+ }
1451
+ else {
1452
+ jQuery('#wpvivid_send_email_res').html("Test failed, " + jsonarray.error);
1453
+ }
1454
  }
1455
+ catch(err){
1456
+ setTimeout(function()
1457
+ {
1458
+ wpvivid_email_test();
1459
+ }, 1000);
1460
  }
1461
  }, function(XMLHttpRequest, textStatus, errorThrown) {
1462
  var error_message = wpvivid_output_ajaxerror('sending test mail', textStatus, errorThrown);
1468
  * This function will export settings to local folder
1469
  */
1470
  function wpvivid_export_settings() {
1471
+ wpvivid_location_href=true;
1472
  location.href =ajaxurl+'?action=wpvivid_export_setting&setting=1&history=1';
1473
  }
1474
 
1492
  'data': fileString
1493
  };
1494
  wpvivid_post_request(ajax_data, function(data){
1495
+ try {
1496
+ var jsonarray = jQuery.parseJSON(data);
1497
+ if (jsonarray.result === "success") {
1498
+ location.reload();
1499
+ }
1500
+ else {
1501
+ alert("Error: " + jsonarray.error);
1502
+ }
1503
  }
1504
+ catch(err){
1505
+ setTimeout(function()
1506
+ {
1507
+ wpvivid_import_settings();
1508
+ }, 1000);
1509
  }
1510
  }, function(XMLHttpRequest, textStatus, errorThrown) {
1511
  var error_message = wpvivid_output_ajaxerror('importing the previously-exported settings', textStatus, errorThrown);
1525
  'action': 'wpvivid_get_last_backup'
1526
  };
1527
  wpvivid_post_request(ajax_data, function(data){
1528
+ try {
1529
+ var jsonarray = jQuery.parseJSON(data);
1530
+ if (jsonarray.result !== "failed") {
1531
+ if (jsonarray.data.length !== 0) {
1532
+ ajax_data = {
1533
+ 'action': 'wpvivid_read_last_backup_log',
1534
+ 'log_file_name': jsonarray.data.log_file_name
1535
+ };
1536
+ wpvivid_post_request(ajax_data, function (data) {
1537
+ try {
1538
+ var jsonarray = jQuery.parseJSON(data);
1539
+ if (jsonarray.result === "success") {
1540
+ wpvivid_show_log(data);
1541
+ }
1542
+ else {
1543
+ var div = "Reading the log failed. Please try again.";
1544
+ jQuery('#wpvivid_display_log_content').html(div);
1545
+ }
1546
+ }
1547
+ catch(err){
1548
+ setTimeout(function()
1549
+ {
1550
+ wpvivid_retrieve_last_backup_log();
1551
+ }, 1000);
1552
+ }
1553
+ }, function (XMLHttpRequest, textStatus, errorThrown) {
1554
  var div = "Reading the log failed. Please try again.";
1555
  jQuery('#wpvivid_display_log_content').html(div);
1556
+ });
1557
+ }
 
 
 
1558
  }
1559
  }
1560
+ catch(err){
1561
+ setTimeout(function()
1562
+ {
1563
+ wpvivid_retrieve_last_backup_log();
1564
+ }, 1000);
1565
+ }
1566
  }, function(XMLHttpRequest, textStatus, errorThrown) {
1567
  var div = "Reading the log failed. Please try again.";
1568
  jQuery('#wpvivid_display_log_content').html(div);
1680
  wpvivid_settings_changed = true;
1681
  });
1682
 
1683
+ jQuery("#wpvivid_storage_account_block input:not([type=checkbox])").on("keyup", function(){
1684
+ wpvivid_settings_changed = true;
1685
+ });
1686
+
1687
+ jQuery('#wpvivid_storage_account_block input[type=checkbox]').on("change", function(){
1688
  wpvivid_settings_changed = true;
1689
  });
1690
  }
1852
  'backup_id':backup_id
1853
  };
1854
  wpvivid_post_request(ajax_data, function(data){
1855
+ try {
1856
+ var jsonarray = jQuery.parseJSON(data);
1857
+ jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
1858
+ if (jsonarray.result === "success") {
1859
+ jQuery('#wpvivid_file_part_' + backup_id).html("");
1860
+ var download_array = new Array('backup_type', 'download_type', 'delete_button_id', 'download_button_id', 'progress_id', 'download_text_id', 'split_file_id');
1861
+ var i = 0;
1862
+ var file_part = "";
1863
+ var file_not_found = false;
1864
+ jQuery.each(jsonarray.data.type, function (index, value) {
1865
+ download_array = wpvivid_get_download_info(index, download_array);
1866
+ var file_name = '';
1867
+ var part_num = '';
1868
+ jQuery.each(value.files, function (index1, value1) {
1869
+ i++;
1870
+ part_num = wpvivid_prefix_integer(i);
1871
+ file_name = index1;
1872
+ if (value1.status === 'need_download') {
1873
+ file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1874
+ "<span>Part" + part_num + "</span></br>" +
1875
+ "<span id=\"" + backup_id + "-text-part-" + i + "\"><a onclick=\"wpvivid_prepare_download('" + i + "', '" + backup_id + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a></span></br>" +
1876
+ "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\"" + backup_id + "-progress-part-" + i + "\" style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1877
+ "<span>size:</span><span>" + value1.size + "</span>" +
1878
+ "</div>";
1879
+ jQuery('#wpvivid_file_part_' + backup_id).append(file_part);
 
 
 
 
 
 
 
 
1880
  }
1881
+ else if (value1.status === 'running') {
1882
+ if (m_downloading_file_name === file_name) {
1883
+ wpvivid_lock_download(tmp_current_click_backupid);
1884
+ }
1885
+ file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1886
+ "<span>Part" + part_num + "</span></br>" +
1887
+ "<span id=\"" + backup_id + "-text-part-" + i + "\"><a >Retriving(remote storage to web server)</a></span></br>" +
1888
+ "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\"" + backup_id + "-progress-part-" + i + "\" style=\"background-color:#0085ba; float:left;width:50%;height:5px;\"></div></div>" +
1889
+ "<span>size:</span><span>" + value1.size + "</span>" +
1890
+ "</div>";
1891
+ jQuery('#wpvivid_file_part_' + backup_id).append(file_part);
1892
  }
1893
+ else if (value1.status === 'completed') {
1894
+ if (m_downloading_file_name === file_name) {
1895
+ wpvivid_unlock_download(tmp_current_click_backupid);
1896
+ }
1897
+ file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1898
+ "<span>Part" + part_num + "</span></br>" +
1899
+ "<span id=\"" + backup_id + "-text-part-" + i + "\"><a onclick=\"wpvivid_download('" + backup_id + "', '" + index + "', '" + file_name + "');\" style=\"cursor: pointer\">Download</a></span></br>" +
1900
+ "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\"" + backup_id + "-progress-part-" + i + "\" style=\"background-color:#0085ba; float:left;width:100%;height:5px;\"></div></div>" +
1901
+ "<span>size:</span><span>" + value1.size + "</span>" +
1902
+ "</div>";
1903
+ jQuery('#wpvivid_file_part_' + backup_id).append(file_part);
1904
  }
1905
+ else if (value1.status === 'error') {
1906
+ if (m_downloading_file_name === file_name) {
1907
+ wpvivid_unlock_download(tmp_current_click_backupid);
1908
+ }
1909
+ alert(value1.error);
1910
+ file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1911
+ "<span>Part" + part_num + "</span></br>" +
1912
+ "<span id=\"" + backup_id + "-text-part-" + i + "\"><a onclick=\"wpvivid_prepare_download('" + i + "', '" + backup_id + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a></span></br>" +
1913
+ "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\"" + backup_id + "-progress-part-" + i + "\" style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1914
+ "<span>size:</span><span>" + value1.size + "</span>" +
1915
+ "</div>";
1916
+ jQuery('#wpvivid_file_part_' + backup_id).append(file_part);
1917
+ }
1918
+ else if (value1.status === 'timeout') {
1919
+ if (m_downloading_file_name === file_name) {
1920
+ wpvivid_unlock_download(tmp_current_click_backupid);
1921
+ }
1922
+ file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px;\">" +
1923
+ "<span>Part" + part_num + "</span></br>" +
1924
+ "<span id=\"" + backup_id + "-text-part-" + i + "\"><a onclick=\"wpvivid_prepare_download('" + i + "', '" + backup_id + "', '" + file_name + "');\" style=\"cursor: pointer\">Prepare to Download</a></span></br>" +
1925
+ "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div id=\"" + backup_id + "-progress-part-" + i + "\" style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1926
+ "<span>size:</span><span>" + value1.size + "</span>" +
1927
+ "</div>";
1928
+ jQuery('#wpvivid_file_part_' + backup_id).append(file_part);
1929
+ }
1930
+ else if (value1.status === 'file_not_found') {
1931
  wpvivid_unlock_download(tmp_current_click_backupid);
1932
+ wpvivid_reset_backup_list();
1933
+ file_not_found = true;
1934
+ alert("Download failed, file not found. The file might has been moved, renamed or deleted. Please verify the file exists and try again.");
1935
+ return false;
1936
+ }
1937
+ });
1938
+ if (file_not_found === false) {
1939
+ if (i % 2 !== 0) {
1940
+ i++;
1941
+ part_num = wpvivid_prefix_integer(i);
1942
+ file_part = "<div style=\"float:left;margin:10px 10px 10px 0px;text-align:center; width:290px; color:#cccccc;\">" +
1943
+ "<span>Part" + part_num + "</span></br>" +
1944
+ "<span>Download</span></br>" +
1945
+ "<div style=\"width:100%;height:5px; background-color:#dcdcdc;\"><div style=\"background-color:#0085ba; float:left;width:0%;height:5px;\"></div></div>" +
1946
+ "<span>size:</span><span>0</span>" +
1947
+ "</div>";
1948
+ jQuery('#wpvivid_file_part_' + backup_id).append(file_part);
1949
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1950
  }
1951
  });
1952
+ }
1953
+ }
1954
+ catch(err){
1955
+ setTimeout(function()
1956
+ {
1957
+ wpvivid_initialize_download(backup_id);
1958
+ }, 1000);
 
 
 
 
 
 
1959
  }
1960
  },function(XMLHttpRequest, textStatus, errorThrown){
1961
  jQuery('#wpvivid_download_loading_'+backup_id).removeClass('is-active');
2125
  wpvivid_lock_download(backup_id);
2126
  m_downloading_file_name = file_name;
2127
  wpvivid_post_request(ajax_data, function(data){
 
 
 
2128
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2129
  wpvivid_unlock_download(backup_id);
2130
  jQuery('#delete_btn_part'+part_num).css({'pointer-events': 'auto', 'opacity': '1'});
2144
  * @param file_name - File name
2145
  */
2146
  function wpvivid_download(backup_id, backup_type, file_name){
2147
+ wpvivid_location_href=true;
2148
  location.href =ajaxurl+'?action=wpvivid_download_backup&backup_id='+backup_id+'&download_type='+backup_type+'&file_name='+file_name;
2149
  }
2150
 
2455
  'action': 'wpvivid_get_log_list'
2456
  };
2457
  wpvivid_post_request(ajax_data, function(data){
2458
+ try {
2459
+ var jsonarray = jQuery.parseJSON(data);
2460
+ jQuery('#wpvivid_loglist').html("");
2461
+ if (jsonarray.result === "success") {
2462
+ var log_count = 0;
2463
+ jQuery.each(jsonarray.data.log_list.file, function (index, value) {
2464
+ var log_time = value.time;
2465
+ if (log_time === "") {
2466
+ log_time = "N/A";
2467
+ }
2468
+ var log_des = value.des;
2469
+ if (log_des === "") {
2470
+ log_des = "N/A";
2471
+ }
2472
+ var log_tr = "<tr>" +
2473
+ "<td class=\"row-title\"><label for=\"tablecell\">" + log_time + "</label></td>" +
2474
+ "<td>" + log_des + "</td>" +
2475
+ "<td>" + value.file_name + "</td>" +
2476
+ "<td><a onclick='wpvivid_view_log(\"" + log_count + "\");' style=\"cursor:pointer;\" ><img src=\"" + wpvivid_plugurl + "/images/Log.png\" style=\"vertical-align:middle;\">Log</a></td>" +
2477
+ "<td id=\"" + log_count + "\" style='display: none'>" + value.path + "</td>"
2478
  "</tr>";
2479
+ var log_table = jQuery('#wpvivid_loglist');
2480
+ log_table.append(log_tr);
2481
+ log_count++;
2482
+ });
2483
+ wpvivid_log_count = log_count;
2484
+ wpvivid_display_log_page();
2485
+ }
2486
+ }
2487
+ catch(err){
2488
+ setTimeout(function()
2489
+ {
2490
+ wpvivid_retrieve_log_list();
2491
+ }, 1000);
2492
  }
2493
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2494
  setTimeout(function () {
2518
  'path': log_path
2519
  };
2520
  wpvivid_post_request(ajax_data, function (data) {
2521
+ try {
2522
+ var jsonarray = jQuery.parseJSON(data);
2523
+ jQuery('#wpvivid_read_log_content').html("");
2524
+ if (jsonarray.result === "success") {
2525
+ var log_data = jsonarray.data;
2526
+ while (log_data.indexOf('\n') >= 0) {
2527
+ var iLength = log_data.indexOf('\n');
2528
+ var log = log_data.substring(0, iLength);
2529
+ log_data = log_data.substring(iLength + 1);
2530
+ var insert_log = "<div style=\"clear:both;\">" + log + "</div>";
2531
+ jQuery('#wpvivid_read_log_content').append(insert_log);
2532
+ }
2533
+ }
2534
+ else if (jsonarray.result === "failed") {
2535
+ var div = "Reading the log failed. Please try again.";
2536
+ jQuery('#wpvivid_read_log_content').html(div);
2537
  }
2538
  }
2539
+ catch(err){
2540
+ setTimeout(function()
2541
+ {
2542
+ wpvivid_view_log(num);
2543
+ }, 1000);
2544
  }
2545
  }, function (XMLHttpRequest, textStatus, errorThrown) {
2546
  var div = "Reading the log failed. Please try again.";
2576
  'remote_storage': remote_storage
2577
  };
2578
  wpvivid_post_request(ajax_data, function(data){
2579
+ try {
2580
+ var jsonarray = jQuery.parseJSON(data);
2581
+ if (jsonarray.result === "success") {
2582
+ wpvivid_location_href = true;
2583
+ location.replace(location.href);
2584
+ wpvivid_retrieve_default_remote_storage();
2585
+ }
2586
+ }
2587
+ catch(err){
2588
+ setTimeout(function()
2589
+ {
2590
+ wpvivid_set_default_remote_storage();
2591
+ }, 1000);
2592
  }
2593
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2594
  var error_message = wpvivid_output_ajaxerror('setting up the default remote storage', textStatus, errorThrown);
2701
  'backup_id':m_restore_backup_id
2702
  };
2703
  wpvivid_post_request(ajax_data, function(data){
2704
+ try {
2705
+ var jsonarray = jQuery.parseJSON(data);
2706
+ if (jsonarray.has_exist_restore === 0) {
2707
+ jQuery('#wpvivid_restore_btn').css({'pointer-events': 'auto', 'opacity': '1'});
2708
+ jQuery('#wpvivid_clean_restore').css({'pointer-events': 'none', 'opacity': '0.4'});
 
 
 
 
 
 
2709
  jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
2710
+ jQuery('#wpvivid_restore_btn').show();
2711
+ }
2712
+ else {
2713
+ if (jsonarray.has_exist_restore === 1) {
2714
+ jQuery('#wpvivid_restore_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
2715
+ jQuery('#wpvivid_clean_restore').css({'pointer-events': 'auto', 'opacity': '1'});
2716
+ jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'none', 'opacity': '0.4'});
2717
+ jQuery('#wpvivid_clean_restore').show();
2718
+ wpvivid_display_restore_msg("Has old restore task, please delete first.");
2719
+ }
2720
  }
2721
  }
2722
+ catch(err){
2723
+ setTimeout(function()
2724
+ {
2725
+ wpvivid_init_restore_data();
2726
+ }, 1000);
2727
+ }
2728
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2729
  var error_message = wpvivid_output_ajaxerror('initializing restore information', textStatus, errorThrown);
2730
  wpvivid_display_restore_msg(error_message);
2761
  jQuery('#wpvivid_clean_restore').hide();
2762
  jQuery('#wpvivid_rollback_btn').hide();
2763
  wpvivid_post_request(ajax_data, function(data) {
2764
+ try {
2765
+ var jsonarray = jQuery.parseJSON(data);
2766
+ if (jsonarray.result === "success") {
2767
+ wpvivid_display_restore_msg("Prepare to start restoring.");
2768
+ wpvivid_restore_lock();
2769
+ wpvivid_monitor_restore_task();
2770
+ wpvivid_restore();
2771
+ }
2772
+ else if (jsonarray.result === "need_download") {
2773
+ var download_array = new Array();
2774
+ var download_num = 0;
2775
+ var start_download_num = 0;
2776
+ wpvivid_display_restore_msg("Backup is not found on web server. Prepare to download it from remote storage.");
2777
+ jQuery.each(jsonarray.files, function (index, value) {
2778
+ if (value.status === "need_download") {
2779
+ download_array[download_num] = new Array('file_name', 'file_size');
2780
+ download_array[download_num]['file_name'] = index;
2781
+ download_array[download_num]['file_size'] = value.size;
2782
+ download_array[download_num]['md5'] = value.md5;
2783
+ download_num++;
2784
+ }
2785
+ });
2786
+ wpvivid_download_restore_file(download_array, download_num, start_download_num);
2787
+ }
2788
+ else if (jsonarray.result === "file_not_found") {
2789
+ wpvivid_display_restore_msg("Backup doesn't exist in both web server and remote storage. Restore failed.");
2790
+ }
2791
  }
2792
+ catch(err){
2793
+ setTimeout(function()
2794
+ {
2795
+ wpvivid_prepare_restore();
2796
+ }, 1000);
2797
  }
2798
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2799
  var error_message = wpvivid_output_ajaxerror('preparing to restore', textStatus, errorThrown);
2843
 
2844
  wpvivid_post_request(ajax_data, function(data)
2845
  {
2846
+ try {
 
2847
  var jsonarray = jQuery.parseJSON(data);
2848
 
2849
  if(typeof jsonarray ==='object')
2917
  }, 1000);
2918
  }
2919
  }
2920
+ catch(err){
 
2921
  setTimeout(function()
2922
  {
2923
  wpvivid_monitor_restore_task();
2972
  jQuery('#wpvivid_clean_restore').show();
2973
  jQuery('#wpvivid_rollback_btn').hide();
2974
  wpvivid_post_request(ajax_data, function(data) {
2975
+ try {
2976
+ var jsonarray = jQuery.parseJSON(data);
2977
+ if (jsonarray.result === "success") {
2978
+ wpvivid_init_restore_data();
2979
+ }
2980
+ }
2981
+ catch(err){
2982
+ setTimeout(function()
2983
+ {
2984
+ wpvivid_delete_incompleted_restore();
2985
+ }, 1000);
2986
  }
2987
  }, function(XMLHttpRequest, textStatus, errorThrown) {
2988
  var error_message = wpvivid_output_ajaxerror('deleting the last incomplete restore task', textStatus, errorThrown);
3004
  'action': 'wpvivid_rollback'
3005
  };
3006
  wpvivid_post_request(ajax_data, function(data) {
3007
+ try {
3008
+ var jsonarray = jQuery.parseJSON(data);
3009
+ if (jsonarray.result === "success") {
3010
+ wpvivid_display_restore_msg("Rollback completed.");
3011
+ jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'auto', 'opacity': '1'});
3012
+ }
3013
+ else if (jsonarray.result === "failed") {
3014
+ wpvivid_display_restore_msg(jsonarray.error);
3015
+ jQuery('#wpvivid_rollback_btn').css({'pointer-events': 'auto', 'opacity': '1'});
3016
+ }
3017
  }
3018
+ catch(err){
3019
+ setTimeout(function()
3020
+ {
3021
+ wpvivid_rollback();
3022
+ }, 1000);
3023
  }
3024
  }, function(XMLHttpRequest, textStatus, errorThrown) {
3025
  var error_message = wpvivid_output_ajaxerror('starting rollbacking', textStatus, errorThrown);
3036
  'wpvivid_restore' : '1',
3037
  };
3038
  wpvivid_post_request(ajax_data, function(data){
3039
+ try {
 
3040
  var jsonarray = jQuery.parseJSON(data);
3041
 
3042
  if(typeof jsonarray ==='object')
3097
  }, 1000);
3098
  }
3099
  }
3100
+ catch(err){
 
3101
  setTimeout(function()
3102
  {
3103
  wpvivid_monitor_rollback_task();
3149
  jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'none', 'opacity': '0.4'});
3150
  wpvivid_post_request(ajax_data, function(data){
3151
  jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
3152
+ try {
3153
+ var jsonarray = jQuery.parseJSON(data);
3154
+ if (jsonarray.result === "success") {
3155
+ alert("Out of date backups have been removed.");
3156
+ }
3157
+ }
3158
+ catch(err){
3159
+ setTimeout(function()
3160
+ {
3161
+ wpvivid_delete_out_of_date_backups();
3162
+ }, 1000);
3163
  }
3164
  }, function(XMLHttpRequest, textStatus, errorThrown) {
3165
  var error_message = wpvivid_output_ajaxerror('deleting out of date backups', textStatus, errorThrown);
3182
  wpvivid_post_request(ajax_data, function(data){
3183
  jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
3184
  jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
3185
+ try {
3186
+ var jsonarray = jQuery.parseJSON(data);
3187
+ if (jsonarray.result === "success") {
3188
+ jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
3189
+ jQuery('#wpvivid_junk_log_path').html(jsonarray.data.log_path);
3190
+ jQuery('#wpvivid_junk_file_path').html(jsonarray.data.junk_path);
3191
+ jQuery('#wpvivid_restore_temp_file_path').html(jsonarray.data.old_files_path);
3192
+ }
3193
+ }
3194
+ catch(err){
3195
+ setTimeout(function()
3196
+ {
3197
+ wpvivid_calculate_diskspaceused();
3198
+ }, 1000);
3199
  }
3200
  }, function(XMLHttpRequest, textStatus, errorThrown) {
3201
  var error_message = wpvivid_output_ajaxerror('calculating server disk space in use by WPvivid', textStatus, errorThrown);
3258
  jQuery('input[name="junk-files"][value="junk-files"]').prop('checked', false);
3259
  jQuery('input[name="junk-files"][value="junk-temporary-files"]').prop('checked', false);
3260
  alert("The selected junk flies have been deleted.");
3261
+ try {
3262
+ var jsonarray = jQuery.parseJSON(data);
3263
+ if (jsonarray.result === "success") {
3264
+ jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
3265
+ jQuery('#wpvivid_junk_log_path').html(jsonarray.data.log_path);
3266
+ jQuery('#wpvivid_junk_file_path').html(jsonarray.data.junk_path);
3267
+ jQuery('#wpvivid_restore_temp_file_path').html(jsonarray.data.old_files_path);
3268
+ }
3269
+ wpvivid_retrieve_log_list();
3270
+ }
3271
+ catch(err){
3272
+ setTimeout(function()
3273
+ {
3274
+ wpvivid_clean_junk_files();
3275
+ }, 1000);
3276
  }
 
3277
  }, function (XMLHttpRequest, textStatus, errorThrown) {
3278
  var error_message = wpvivid_output_ajaxerror('cleaning out junk files', textStatus, errorThrown);
3279
  alert(error_message);
3288
  * Download the relevant website info and error logs to your PC for debugging purposes.
3289
  */
3290
  function wpvivid_download_website_info(){
3291
+ wpvivid_location_href=true;
3292
  location.href =ajaxurl+'?action=wpvivid_create_debug_package';
3293
  }
3294
 
3305
  var error_msg = "wpvivid_request: "+ textStatus + "(" + errorThrown + "): an error occurred while " + action + ". " +
3306
  "This error could be caused by an unstable internet connection. Please try again later.";
3307
  return error_msg;
3308
+ }
3309
+
3310
+ function wpvivid_prefix_integer(num) {
3311
+ var num_length = num.toString().length;
3312
+ if(num_length < 2) num_length = 2;
3313
+ return (Array(num_length).join('0') + num).slice(-num_length);
3314
  }
admin/partials/wpvivid-admin-display.php CHANGED
@@ -32,7 +32,7 @@ foreach ($remoteslist['remote_selected'] as $value) {
32
  $default_remote_storage=$value;
33
  }
34
  $backup_task=$wpvivid_pulgin->_list_tasks(false);
35
-
36
  ?>
37
 
38
  <div class="wrap">
@@ -516,17 +516,37 @@ $backup_task=$wpvivid_pulgin->_list_tasks(false);
516
  $schedule_remote_storage_display = '';
517
  if($schedule['recurrence'] === "wpvivid_12hours"){
518
  $schedule_hour = 'checked';
 
 
 
 
519
  }
520
  else if($schedule['recurrence'] === "wpvivid_daily"){
 
521
  $schedule_daily = 'checked';
 
 
 
522
  }
523
  else if($schedule['recurrence'] === "wpvivid_weekly"){
 
 
524
  $schedule_weekly = 'checked';
 
 
525
  }
526
  else if($schedule['recurrence'] === "wpvivid_fortnightly"){
 
 
 
527
  $schedule_fortnightly = 'checked';
 
528
  }
529
  else if($schedule['recurrence'] === "wpvivid_monthly"){
 
 
 
 
530
  $schedule_monthly = 'checked';
531
  }
532
  else{
@@ -1028,9 +1048,7 @@ $backup_task=$wpvivid_pulgin->_list_tasks(false);
1028
  <div id="postbox-container-1" class="postbox-container">
1029
  <div class="meta-box-sortables">
1030
  <div class="postbox">
1031
- <h2><span><?php _e(
1032
- 'Current Version: 0.9.2', 'wpvivid'
1033
- ); ?></span></h2>
1034
  </div>
1035
  </div>
1036
  </div>
32
  $default_remote_storage=$value;
33
  }
34
  $backup_task=$wpvivid_pulgin->_list_tasks(false);
35
+ $wpvivid_version=WPVIVID_PLUGIN_VERSION;
36
  ?>
37
 
38
  <div class="wrap">
516
  $schedule_remote_storage_display = '';
517
  if($schedule['recurrence'] === "wpvivid_12hours"){
518
  $schedule_hour = 'checked';
519
+ $schedule_daily = '';
520
+ $schedule_weekly = '';
521
+ $schedule_fortnightly = '';
522
+ $schedule_monthly = '';
523
  }
524
  else if($schedule['recurrence'] === "wpvivid_daily"){
525
+ $schedule_hour = '';
526
  $schedule_daily = 'checked';
527
+ $schedule_weekly = '';
528
+ $schedule_fortnightly = '';
529
+ $schedule_monthly = '';
530
  }
531
  else if($schedule['recurrence'] === "wpvivid_weekly"){
532
+ $schedule_hour = '';
533
+ $schedule_daily = '';
534
  $schedule_weekly = 'checked';
535
+ $schedule_fortnightly = '';
536
+ $schedule_monthly = '';
537
  }
538
  else if($schedule['recurrence'] === "wpvivid_fortnightly"){
539
+ $schedule_hour = '';
540
+ $schedule_daily = '';
541
+ $schedule_weekly = '';
542
  $schedule_fortnightly = 'checked';
543
+ $schedule_monthly = '';
544
  }
545
  else if($schedule['recurrence'] === "wpvivid_monthly"){
546
+ $schedule_hour = '';
547
+ $schedule_daily = '';
548
+ $schedule_weekly = '';
549
+ $schedule_fortnightly = '';
550
  $schedule_monthly = 'checked';
551
  }
552
  else{
1048
  <div id="postbox-container-1" class="postbox-container">
1049
  <div class="meta-box-sortables">
1050
  <div class="postbox">
1051
+ <h2><span>Current Version: <?php _e($wpvivid_version, 'wpvivid'); ?></span></h2>
 
 
1052
  </div>
1053
  </div>
1054
  </div>
includes/class-wpvivid-taskmanager.php CHANGED
@@ -115,9 +115,18 @@ class WPvivid_taskmanager
115
  if(array_key_exists ($task_id,$tasks))
116
  {
117
  $task = $tasks[$task_id];
118
- $ret['db_size']=$task['data']['backup']['db_size'];
119
- $ret['files_size']=$task['data']['backup']['files_size'];
120
- return $ret;
 
 
 
 
 
 
 
 
 
121
  }
122
  else
123
  {
115
  if(array_key_exists ($task_id,$tasks))
116
  {
117
  $task = $tasks[$task_id];
118
+
119
+ if(array_key_exists('db_size',$task['data']['backup']))
120
+ {
121
+ $ret['db_size']=$task['data']['backup']['db_size'];
122
+ $ret['files_size']=$task['data']['backup']['files_size'];
123
+ return $ret;
124
+ }
125
+ else
126
+ {
127
+ return false;
128
+ }
129
+
130
  }
131
  else
132
  {
includes/class-wpvivid.php CHANGED
@@ -47,7 +47,7 @@ class WPvivid {
47
  {
48
  $this->version = WPVIVID_PLUGIN_VERSION;
49
  } else {
50
- $this->version = '0.9.2';
51
  }
52
  $this->plugin_name = 'WPvivid';
53
 
@@ -156,6 +156,7 @@ class WPvivid {
156
  add_action('wp_ajax_wpvivid_test_remote_connection',array( $this,'test_remote_connection'));
157
  //Start backup
158
  add_action('wp_ajax_wpvivid_prepare_backup',array( $this,'prepare_backup'));
 
159
  add_action('wp_ajax_wpvivid_backup_now',array( $this,'backup_now'));
160
  //Cancel backup
161
  add_action('wp_ajax_wpvivid_backup_cancel',array( $this,'backup_cancel'));
@@ -266,7 +267,7 @@ class WPvivid {
266
  public function prepare_backup()
267
  {
268
  $this->ajax_check_security();
269
- if (!isset($_POST['backup_files']) || !isset($_POST['local'])||!isset($_POST['remote']) || !isset($_POST['ismerge'])||!isset($_POST['max_backup_count'])||!isset($_POST['lock']))
270
  {
271
  $ret['result']='failed';
272
  $ret['error']=__('Error occurred while parsing the request data. Please try to run backup again.', 'wpvivid');
@@ -274,7 +275,7 @@ class WPvivid {
274
  die();
275
  }
276
 
277
- if(!is_string($_POST['backup_files'])||!is_string($_POST['local'])||!is_string($_POST['remote'])||!is_string($_POST['ismerge'])||!is_string($_POST['max_backup_count'])||!is_string($_POST['lock']))
278
  {
279
  die();
280
  }
@@ -295,6 +296,23 @@ class WPvivid {
295
 
296
  die();
297
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  /**
299
  * Start a backup task init by prepare_backup.
300
  *
@@ -489,6 +507,13 @@ class WPvivid {
489
  $file=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_options['dir'].DIRECTORY_SEPARATOR.$file_name.'_cancel';
490
  touch($file);
491
  }
 
 
 
 
 
 
 
492
  $json['result']='success';
493
  echo json_encode($json);
494
  }
@@ -1215,7 +1240,7 @@ class WPvivid {
1215
  $last = strtolower(substr($memory_limit, -1));
1216
 
1217
  if($last == 'g')
1218
- $memory_limit_int = $memory_limit_int**1024*1024*1024;
1219
  if($last == 'm')
1220
  $memory_limit_int = $memory_limit_int*1024*1024;
1221
  if($last == 'k')
@@ -1563,13 +1588,15 @@ class WPvivid {
1563
  *
1564
  * @var string $task_id
1565
  *
 
 
1566
  * @return boolean
1567
  *
1568
  * @since 0.9.1
1569
  */
1570
- private function add_monitor_event($task_id)
1571
  {
1572
- $resume_time=time()+120;
1573
 
1574
  $timestamp = wp_next_scheduled(WPVIVID_TASK_MONITOR_EVENT,array($task_id));
1575
 
@@ -2993,9 +3020,36 @@ class WPvivid {
2993
  }
2994
 
2995
  public function _list_tasks($backup_id){
2996
- $tasks=WPvivid_taskmanager::get_backup_tasks_info('backup');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2997
  $ret['backup']['result']='success';
2998
- $ret['backup']['data']=$tasks;
2999
  $ret['download']['data']=array();
3000
  if($backup_id !== false) {
3001
  $ret['download'] = self::update_download_page($backup_id);
47
  {
48
  $this->version = WPVIVID_PLUGIN_VERSION;
49
  } else {
50
+ $this->version = '0.9.3';
51
  }
52
  $this->plugin_name = 'WPvivid';
53
 
156
  add_action('wp_ajax_wpvivid_test_remote_connection',array( $this,'test_remote_connection'));
157
  //Start backup
158
  add_action('wp_ajax_wpvivid_prepare_backup',array( $this,'prepare_backup'));
159
+ add_action('wp_ajax_wpvivid_delete_ready_task',array($this,'delete_ready_task'));
160
  add_action('wp_ajax_wpvivid_backup_now',array( $this,'backup_now'));
161
  //Cancel backup
162
  add_action('wp_ajax_wpvivid_backup_cancel',array( $this,'backup_cancel'));
267
  public function prepare_backup()
268
  {
269
  $this->ajax_check_security();
270
+ if (!isset($_POST['backup_files']) || !isset($_POST['local'])||!isset($_POST['remote']) || !isset($_POST['ismerge'])||!isset($_POST['lock']))
271
  {
272
  $ret['result']='failed';
273
  $ret['error']=__('Error occurred while parsing the request data. Please try to run backup again.', 'wpvivid');
275
  die();
276
  }
277
 
278
+ if(!is_string($_POST['backup_files'])||!is_string($_POST['local'])||!is_string($_POST['remote'])||!is_string($_POST['ismerge'])||!is_string($_POST['lock']))
279
  {
280
  die();
281
  }
296
 
297
  die();
298
  }
299
+ /**
300
+ * Delete tasks had [ready] status.
301
+ *
302
+ *When prepare backup go wrong,may retain some task we don't need.Delete them.
303
+ *
304
+ * @since 0.9.3
305
+ */
306
+ public function delete_ready_task()
307
+ {
308
+ $this->ajax_check_security();
309
+
310
+ WPvivid_taskmanager::delete_ready_task();
311
+
312
+ $ret['result']='success';
313
+ echo json_encode($ret);
314
+ die();
315
+ }
316
  /**
317
  * Start a backup task init by prepare_backup.
318
  *
507
  $file=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_options['dir'].DIRECTORY_SEPARATOR.$file_name.'_cancel';
508
  touch($file);
509
  }
510
+
511
+ $timestamp = wp_next_scheduled(WPVIVID_TASK_MONITOR_EVENT,array($task_id));
512
+
513
+ if($timestamp===false)
514
+ {
515
+ $this->add_monitor_event($task_id,10);
516
+ }
517
  $json['result']='success';
518
  echo json_encode($json);
519
  }
1240
  $last = strtolower(substr($memory_limit, -1));
1241
 
1242
  if($last == 'g')
1243
+ $memory_limit_int = $memory_limit_int*1024*1024*1024;
1244
  if($last == 'm')
1245
  $memory_limit_int = $memory_limit_int*1024*1024;
1246
  if($last == 'k')
1588
  *
1589
  * @var string $task_id
1590
  *
1591
+ * @var int $next_time
1592
+ *
1593
  * @return boolean
1594
  *
1595
  * @since 0.9.1
1596
  */
1597
+ private function add_monitor_event($task_id,$next_time=120)
1598
  {
1599
+ $resume_time=time()+$next_time;
1600
 
1601
  $timestamp = wp_next_scheduled(WPVIVID_TASK_MONITOR_EVENT,array($task_id));
1602
 
3020
  }
3021
 
3022
  public function _list_tasks($backup_id){
3023
+
3024
+ $tasks=WPvivid_Setting::get_tasks();
3025
+ $ret=array();
3026
+ $list_tasks=array();
3027
+ foreach ($tasks as $task)
3028
+ {
3029
+ if($task['action']=='backup')
3030
+ {
3031
+ $list_tasks[$task['id']]['status']=WPvivid_taskmanager::get_backup_tasks_status($task['id']);
3032
+ $list_tasks[$task['id']]['is_canceled']=WPvivid_taskmanager::is_task_canceled($task['id']);
3033
+ $list_tasks[$task['id']]['size']=WPvivid_taskmanager::get_backup_size($task['id']);
3034
+ $list_tasks[$task['id']]['data']=WPvivid_taskmanager::get_backup_tasks_progress($task['id']);
3035
+
3036
+ if($list_tasks[$task['id']]['status']['str']=='running'||$list_tasks[$task['id']]['status']['str']=='no_responds')
3037
+ {
3038
+ if($list_tasks[$task['id']]['data']['running_time']>180)
3039
+ {
3040
+ $timestamp = wp_next_scheduled(WPVIVID_TASK_MONITOR_EVENT,array($task['id']));
3041
+
3042
+ if($timestamp===false)
3043
+ {
3044
+ $this->add_monitor_event($task['id'],20);
3045
+ }
3046
+ }
3047
+ }
3048
+ }
3049
+ }
3050
+
3051
  $ret['backup']['result']='success';
3052
+ $ret['backup']['data']=$list_tasks;
3053
  $ret['download']['data']=array();
3054
  if($backup_id !== false) {
3055
  $ret['download'] = self::update_download_page($backup_id);
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
- === WPvivid Backup/Restore for WordPress ===
2
  Contributors: wpvivid
3
  Tags: backup, cloud backup, restore, database backup, wordpress backup, backups, custom backups, s3, FTP, SFTP
4
  Requires at least: 4.5
5
  Tested up to: 5.0.2
6
  Requires PHP: 5.3
7
- Stable tag: 0.9.2
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
11
- 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.
12
 
13
  == Description ==
14
  WPvivid Backup/Restore is a WordPress backup plugin that provides stable backup and restore functionality yet simple interface and configuration to help everyone back up with minimal effort and cost.
@@ -19,22 +19,22 @@ Backing up to remote storage in the cloud can avoid server-wide risks, WPvivid B
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 due to 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
- 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
25
- You��ll have the option of backing up to your hosting server and cloud storage.
26
- 3.Flexible Backup Types
27
- WPvivid provides you with flexible backup types including backing up the entire site, only files, only database. Save you storage space and time.
28
- 4.Faster Backup with Higher Rate of Backup Success
29
  When backing up your site, the plugin splits a large backup into several smaller-sized files which are easier and faster to handle.
30
- 5.Minimal UI and Configuration
31
- WPvivid Backup/Restore requires very little configuration to implement its features and has a minimal user interface where all its functionalities are well-organized, to make sure everyone can find and perform functions with no effort.
32
- 6.More Web Hosts Tested
33
- WPvivid Backup/Restore has been well tested to work perfectly with a large number of web hosting, which includes pretty much all the most used hosting service providers like Hostgator, Bluehost, GoDaddy, Namecheap and more.
34
- 7.Multiple Support Channels
35
- Free and responsive expert support is available to all users via multiple channels: the support forum for WPvivid Backup/Restore on WordPress.org, the email, and FAQs.
36
 
37
- == Features Spotlight ==
38
  * One click backup and restore
39
  * Create manual and scheduled backups
40
  * Back up to cloud, Amazon S3, FTP, SFTP
@@ -61,27 +61,28 @@ Free and responsive expert support is available to all users via multiple channe
61
  We offer responsive and completely free support through 3 channels to ensure your issues get received and resolved in the first time:
62
  = Forum Support: = The support forum for WPvivid Backup/Restore on WordPress.org is an optimal place to post your issues and get faster answers.
63
  = Email Support: = For the information that you would like to only let us know, then the email support would be a great way to go. Just drop us a mail at wpvivid.com@gmail.com and we will back to you soon.
64
- = FAQs: = For regular questions and usage of the plugin, please check out our FAQs section on the page, you can easily find an answer for the most part.
65
 
66
  == Installation and Uninstallation ==
67
  Install and Activate WPvivid Backup/Restore:
68
- 1.Go to your site��s admin dashboard.
69
  2.Navigate to Plugin Menu and search for WPvivid Backup/Restore.
70
- 3.Click Install Now then Activate Plugin.
 
71
  Uninstall WPvivid Backup/Restore:
72
  1.Click Deactivate from the Plugin Menu.
73
  2.Click Delete.
74
- Sometimes this could not fully remove the plugin due to the setting of local file permissions or WordPress configuration on your host. When this occurs, you��ll need to manually remove the installation files from /wp-content/plugins/ folder.
75
 
76
  == Privacy Policy and GDPR Compliance ==
77
- WPvivid Backup/Restore is created and operated with full respect and protection of users personal information, and is in full compliance with EU��s General Data Protection Regulation(GDPR). Check out the following content to know the details:
78
  = What personal data can WPvivid Backup/Restore access and how the data is processed? =
79
- 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 the support forum for the plugin on WordPress.org is held by WordPress.org.
80
- In addition, the implementations of all backups and restores of your site happen completely on your website server, there��s no data come across any of our servers in the whole process.
81
- The only personal data currently we can access is the contact data when you contact us by email, which may include your name, email address and other contact details. This data will only be used for the purposes of handling and resolving your enquiry.
82
  = How does WPvivid Backup/Restore help users create a GDPR compliant backup? =
83
- In order to help users create a GDPR compliant backup, WPvivid Backup/Restore 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 don��t need to sign a Data Processing Agreement (DPA) with us.
84
- However, if you upload your backups to cloud storage with WPvivid Backup/Restore , the personal data is transferred to that storage provider. You\'ll need to sign a Data Processing Agreement with that provider.
85
 
86
  == License ==
87
  WPvivid Backup/Restore is licensed under GPL version 3 or later.
@@ -89,7 +90,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
89
 
90
  == Frequently Asked Questions ==
91
  = What can WPvivid Backup/Restore do? =
92
- WPvivid Backup/Restore enables you to perform manual and scheduled backups of your WordPress site, send them to cloud storage and restores them directly from the site\'s admin dashboard.
93
  = Where to download? =
94
  The plugin is available to download directly from the plugin repository on WordPress.org.
95
  = What is required to install WPvivid Backup/Restore? =
@@ -107,12 +108,12 @@ Once a new version is released, an updating message will be sent to you on WordP
107
  = How much server resources does WPvivid Backup/Restore consume? =
108
  WPvivid Backup/Restore is a lightweight plugin that does not use much disk space on your server, this should be said with the exception of the space used to store backups when you choose to backup to your hosting server. WPvivid Backup/Restore only consumes little CPU when perform tasks.
109
  = Do I need to pay for support? Where can I get a support? =
110
- Never. We provide free and responsive support for WPvivid Backup/Restore through multiple channels, including the support forum for WPvivid Backup/Restore on WordPress.org, our elaborate FAQs as well as email support. Typically, our support team will reply you within 24 hours during the normal business days. It will be extremely helpful if you can also attach the detailed error description, any relevant plugins, as well as the error logs which are available to download on the plugin\'s Website Info page.
111
  = Does WPvivid Backup/Restore delete all its settings when it is uninstalled? =
112
- Yes. Deleting WPvivid Backup/Restore will also delete it\'s settings on your site. However, in case you may need to use the settings again, use Export/Import settings features on the plugin\'s Setting page to keep it on your computer.
113
- = Does WPvivid Backup/Restore delete all it\'s backups when it is uninstalled? =
114
  No. When WPvivid Backup/Restore is uninstalled, the backups in local will not be deleted as well, neither do the logs.
115
- = What does the error \"Error: Backup error: Allowed memory size of xxxxxxxxxx bytes exhausted (tried to allocate xxxxxxxxxx bytes), task id: wpvivid-xxxxxxxxxxxxx.\" mean? =
116
  This error often occurs while creating a backup for a website with an oversized database. In this case, the size of database is larger than the value of memory limit in php.ini file. As a result, there will be no sufficient memory to compress the database.
117
  To avoid that, please try using the solutions below to modify memory limit in php.ini file, and make sure the value is larger than the database size:
118
  1. Increase PHP memory limit.
@@ -120,10 +121,13 @@ Please try to contact your web hosting provider for changing PHP memory limit, o
120
  2. Upgrade your web hosting plan.
121
 
122
  == Contact us ==
123
- 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.
124
 
125
  == Changelog ==
126
  = 0.9.1 =
127
  Initial release of WPvivid Backup/Restore plugin. Now you see it.
128
  = 0.9.2 =
129
- Fix display image path error.
 
 
 
1
+ === WPvivid Backup/Restore for WordPress ===
2
  Contributors: wpvivid
3
  Tags: backup, cloud backup, restore, database backup, wordpress backup, backups, custom backups, s3, FTP, SFTP
4
  Requires at least: 4.5
5
  Tested up to: 5.0.2
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.3
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
11
+ Free, simple and easy to use backup/restore plugin for WordPress. Create manual and scheduled backups. Back up to Amazon S3, FTP and SFTP. Restore with one click.
12
 
13
  == Description ==
14
  WPvivid Backup/Restore is a WordPress backup plugin that provides stable backup and restore functionality yet simple interface and configuration to help everyone back up with minimal effort and cost.
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 due to 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
+ = 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 =
25
+ You will have the option of backing up to your hosting server and cloud storage.
26
+ = 3. Flexible Backup Types =
27
+ WPvivid Backup/Restore provides you with flexible backup types including backing up the entire site, only files, only database. Save you storage space and time.
28
+ = 4. Faster Backup with Higher Rate of Backup Success =
29
  When backing up your site, the plugin splits a large backup into several smaller-sized files which are easier and faster to handle.
30
+ = 5. Simple UI and Configuration =
31
+ WPvivid Backup/Restore requires very little configuration to implement its features and has a simple user interface where all its functionalities are well organized, to make sure everyone can find and perform functions with no effort.
32
+ = 6. More Web Hosts Tested =
33
+ WPvivid Backup/Restore has been well tested to work perfectly with a large number of web hosting, which include pretty much all the most used hosting service providers like Hostgator, Bluehost, GoDaddy, Namecheap and more.
34
+ = 7.Multiple Support Channels =
35
+ Free and responsive expert support is available to all users via multiple channels: the support forum for WPvivid Backup/Restore on WordPress.org, support email, and FAQs.
36
 
37
+ == Feature Spotlight ==
38
  * One click backup and restore
39
  * Create manual and scheduled backups
40
  * Back up to cloud, Amazon S3, FTP, SFTP
61
  We offer responsive and completely free support through 3 channels to ensure your issues get received and resolved in the first time:
62
  = Forum Support: = The support forum for WPvivid Backup/Restore on WordPress.org is an optimal place to post your issues and get faster answers.
63
  = Email Support: = For the information that you would like to only let us know, then the email support would be a great way to go. Just drop us a mail at wpvivid.com@gmail.com and we will back to you soon.
64
+ = 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.
65
 
66
  == Installation and Uninstallation ==
67
  Install and Activate WPvivid Backup/Restore:
68
+ 1.Go to your sites admin dashboard.
69
  2.Navigate to Plugin Menu and search for WPvivid Backup/Restore.
70
+ 3.Click Install Now then click Activate Plugin.
71
+
72
  Uninstall WPvivid Backup/Restore:
73
  1.Click Deactivate from the Plugin Menu.
74
  2.Click Delete.
75
+ Sometimes this could not fully remove the plugin due to the setting of local file permissions or WordPress configuration on your host. When this occurs, you will need to manually remove the installation files from /wp-content/plugins/ folder.
76
 
77
  == Privacy Policy and GDPR Compliance ==
78
+ 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:
79
  = What personal data can WPvivid Backup/Restore access and how the data is processed? =
80
+ 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.
81
+ 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.
82
+ 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.
83
  = How does WPvivid Backup/Restore help users create a GDPR compliant backup? =
84
+ In order to help users create a GDPR compliant backup, WPvivid Backup/Restore 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.
85
+ However, if you upload your backups to cloud storage with WPvivid Backup/Restore , the personal data is transferred to that storage provider. You'll need to sign a Data Processing Agreement with that provider.
86
 
87
  == License ==
88
  WPvivid Backup/Restore is licensed under GPL version 3 or later.
90
 
91
  == Frequently Asked Questions ==
92
  = What can WPvivid Backup/Restore do? =
93
+ WPvivid Backup/Restore enables you to perform manual and scheduled backups of your WordPress site, send them to cloud storage and restores them directly from the site's admin dashboard.
94
  = Where to download? =
95
  The plugin is available to download directly from the plugin repository on WordPress.org.
96
  = What is required to install WPvivid Backup/Restore? =
108
  = How much server resources does WPvivid Backup/Restore consume? =
109
  WPvivid Backup/Restore is a lightweight plugin that does not use much disk space on your server, this should be said with the exception of the space used to store backups when you choose to backup to your hosting server. WPvivid Backup/Restore only consumes little CPU when perform tasks.
110
  = Do I need to pay for support? Where can I get a support? =
111
+ Never. We provide free and responsive support for WPvivid Backup/Restore through multiple channels, including the support forum for WPvivid Backup/Restore on WordPress.org, our elaborate FAQs as well as email support. Typically, our support team will reply you within 24 hours during the normal business days. It will be extremely helpful if you can also attach the detailed error description, any relevant plugins, as well as the error logs which are available to download on the plugin's Website Info page.
112
  = Does WPvivid Backup/Restore delete all its settings when it is uninstalled? =
113
+ Yes. Deleting WPvivid Backup/Restore will also delete its settings on your site. However, in case you may need to use the settings again, use Export/Import settings features on the plugin's Setting page to keep it on your computer.
114
+ = Does WPvivid Backup/Restore delete all its backups when it is uninstalled? =
115
  No. When WPvivid Backup/Restore is uninstalled, the backups in local will not be deleted as well, neither do the logs.
116
+ = What does the error "Error: Backup error: Allowed memory size of xxxxxxxxxx bytes exhausted (tried to allocate xxxxxxxxxx bytes), task id: wpvivid-xxxxxxxxxxxxx." mean? =
117
  This error often occurs while creating a backup for a website with an oversized database. In this case, the size of database is larger than the value of memory limit in php.ini file. As a result, there will be no sufficient memory to compress the database.
118
  To avoid that, please try using the solutions below to modify memory limit in php.ini file, and make sure the value is larger than the database size:
119
  1. Increase PHP memory limit.
121
  2. Upgrade your web hosting plan.
122
 
123
  == Contact us ==
124
+ 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.
125
 
126
  == Changelog ==
127
  = 0.9.1 =
128
  Initial release of WPvivid Backup/Restore plugin. Now you see it.
129
  = 0.9.2 =
130
+ Fixed image path display error.
131
+ = 0.9.3 =
132
+ Fixed some display errors on the user interface.
133
+ Fixed a bug where backups cannot be completed in exceptional cases.
wpvivid-backuprestore.php CHANGED
@@ -6,8 +6,8 @@
6
  *
7
  * @wordpress-plugin
8
  * Plugin Name: WPvivid - Backup/Restore
9
- * Description: WPvivid is a backup plugin for Wordpress that provides stable backup and restore functionality yet simple interface and configuration to help everyone back up with minimal effort and cost.
10
- * Version: 0.9.2
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.2' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');
6
  *
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.3
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.3' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');