Backup and Restore WordPress – WPBackItUp Backup Plugin - Version 1.10.2

Version Description

  • Update: Display backup file set name instead of date
  • Fix: Backup plugins error when no files on last folder
  • Fix: Extend activation request timeout
  • Fix: Correct issue with restore version checking
  • Fix: Correct issue with restore current user capabilities
  • Fix: Correct sorting and display of available backups
  • Fix: Correct issues with files named using german character set
  • Fix: Correct issues with file downloads
Download this release

Release Info

Developer cssimmon
Plugin Icon 128x128 Backup and Restore WordPress – WPBackItUp Backup Plugin
Version 1.10.2
Comparing to
See all releases

Code changes from version 1.10.1 to 1.10.2

js/wpbackitup_admin.js CHANGED
@@ -25,7 +25,9 @@
25
 
26
  //UPLOADS
27
  try {
28
- plupload_init(wpbackitup_plupload_config);
 
 
29
  } catch (err) {
30
  console.log(err);
31
  }
@@ -531,217 +533,6 @@
531
  window.intervalDefine = setInterval(wpbackitup_get_restore_status, 5000);
532
  }
533
 
534
- /*Upload form button*/
535
- //$("#upload-form").submit(function(e) {
536
- //
537
- // e.preventDefault();
538
- //
539
- // //CHECK ERRORS ON USER SIDE, IF TRUE, END OPERATIONS.
540
- // if (wpbackitup_upload_errors()){
541
- // return false;
542
- // }
543
- //
544
- // var formData = new FormData();
545
- // formData.append('action', wpbackitup_get_action_name('upload'));
546
- // formData.append('_wpnonce', $('#_wpnonce').val());
547
- // formData.append('_wp_http_referer',$("[name='_wp_http_referer']").val());
548
- // formData.append('upload_ids',$('#upload_ids').val());
549
- //
550
- // jQuery.ajax({
551
- // url: ajaxurl,
552
- // type: 'POST',
553
- // cache: false,
554
- // contentType: false,
555
- // processData: false,
556
- // dataType: "json",
557
- //
558
- // //MODIFIED - From ajaxData to formData
559
- // data: formData,
560
- //
561
- // beforeSend: function(jqXHR, settings){
562
- // //console.log("Haven't entered server side yet.");
563
- // /* display processing icon */
564
- // $('.upload-icon').css('visibility', 'visible');
565
- //
566
- // /* hide default message, backup status and backup errors */
567
- // $('.default-status, .restore-status, .restore-errors').hide();
568
- // $("ul.restore-status").children().children().hide();
569
- // $(".restore-errors").children().children().hide();
570
- // $(".restore-success").children().children().hide();
571
- //
572
- // /* show restore status messages */
573
- // $('.upload-status').toggle();
574
- //
575
- // $("#wpbackitup-zip").attr("disabled", "disabled"); //Disable upload
576
- // $("#upload-button").attr("disabled", "disabled"); //Disable upload
577
- //
578
- // },
579
- // dataFilter: function(data, type){
580
- // //Check the response before sending to success
581
- // //Possible that is isnt json so just forward it to success in a json object
582
- // try {
583
- // $("#php").html(data);
584
- // var response = $.parseJSON(data);
585
- // console.log("JSON string echoed back from server side:" + response);
586
- // return data;
587
- // } catch (e) {
588
- // console.log("NON JSON string echoed back from server side:" + type + ':' + data);
589
- // var rtnData = new Object();
590
- // rtnData.success = "";
591
- // rtnData.error = data;
592
- // return JSON.stringify(rtnData)
593
- // }
594
- //
595
- //
596
- // },
597
- // success: function(data, textStatus, jqXHR){
598
- // console.log("Back from server-side:" + data);
599
- // //Checking errors that may have been caught on the server side that
600
- // // normally wouldn't display in the error Ajax function.
601
- //
602
- // if (data.msg == 'success')
603
- // {
604
- // status_message=data.file + ' file was uploaded successfully...';
605
- // wpbackitup_processRow_restore(data);
606
- // $('.upload-status').addClass("isa_success");
607
- // }else{
608
- // status_message='Error:  ' + data.error;
609
- // $('.upload-status').addClass("isa_error");
610
- // }
611
- //
612
- // $('.upload-icon').fadeOut(1000);
613
- // $('.upload-status').show();
614
- // $('.upload-status').html(status_message);
615
- //
616
- // },
617
- // error: function(jqXHR, textStatus, errorThrown){
618
- // console.log("A JS error has occurred." + textStatus +':' +errorThrown);
619
- // },
620
- // complete: function(jqXHR, textStatus){
621
- // console.log("Ajax is finished.");
622
- // }
623
- // });
624
- //
625
- // return false;
626
- //});
627
- //
628
- //function wpbackitup_upload_errors()
629
- //{
630
- // var selected_files = $('#upload_ids').val();
631
- // if (selected_files == '')
632
- // {
633
- // alert('No file(s) selected. Please choose a backup file.');
634
- // return true;
635
- // }
636
- //
637
- // //if ($('#upload_files').val() != '')
638
- // //{
639
- // // var ext = $('#upload_files').val().split('.').pop().toLowerCase();
640
- // // if($.inArray(ext, ['zip']) == -1)
641
- // // {
642
- // // alert('Invalid file type. Please choose a ZIP file to upload.');
643
- // // return true;
644
- // // }
645
- // //}
646
- // return false;
647
- //}
648
- //
649
- ///*Upload form button*/
650
- //$("#upload-form_OLD").submit(function() {
651
- //
652
- // //e.preventDefault();
653
- //
654
- // //CHECK ERRORS ON USER SIDE, IF TRUE, END OPERATIONS.
655
- // if (wpbackitup_upload_errors()){
656
- // return false;
657
- // }
658
- //
659
- // var formData = new FormData();
660
- // jQuery.each($('#wpbackitup-zip')[0].files, function(i, file) {
661
- // formData.append('uploadFile-'+i, file);
662
- // });
663
- // formData.append('action', wpbackitup_get_action_name('upload'));
664
- // formData.append('_wpnonce', $('#_wpnonce').val());
665
- // formData.append('_wp_http_referer',$("[name='_wp_http_referer']").val());
666
- //
667
- // jQuery.ajax({
668
- // url: ajaxurl,
669
- // type: 'POST',
670
- // cache: false,
671
- // contentType: false,
672
- // processData: false,
673
- // dataType: "json",
674
- //
675
- // //MODIFIED - From ajaxData to formData
676
- // data: formData,
677
- //
678
- // beforeSend: function(jqXHR, settings){
679
- // //console.log("Haven't entered server side yet.");
680
- // /* display processing icon */
681
- // $('.upload-icon').css('visibility', 'visible');
682
- //
683
- // /* hide default message, backup status and backup errors */
684
- // $('.default-status, .restore-status, .restore-errors').hide();
685
- // $("ul.restore-status").children().children().hide();
686
- // $(".restore-errors").children().children().hide();
687
- // $(".restore-success").children().children().hide();
688
- //
689
- // /* show restore status messages */
690
- // $('.upload-status').toggle();
691
- //
692
- // $("#wpbackitup-zip").attr("disabled", "disabled"); //Disable upload
693
- // $("#upload-button").attr("disabled", "disabled"); //Disable upload
694
- //
695
- // },
696
- // dataFilter: function(data, type){
697
- // //Check the response before sending to success
698
- // //Possible that is isnt json so just forward it to success in a json object
699
- // try {
700
- // $("#php").html(data);
701
- // var response = $.parseJSON(data);
702
- // console.log("JSON string echoed back from server side:" + response);
703
- // return data;
704
- // } catch (e) {
705
- // console.log("NON JSON string echoed back from server side:" + type + ':' + data);
706
- // var rtnData = new Object();
707
- // rtnData.success = "";
708
- // rtnData.error = data;
709
- // return JSON.stringify(rtnData)
710
- // }
711
- //
712
- //
713
- // },
714
- // success: function(data, textStatus, jqXHR){
715
- // console.log("Back from server-side:" + data);
716
- // //Checking errors that may have been caught on the server side that
717
- // // normally wouldn't display in the error Ajax function.
718
- //
719
- // if (data.msg == 'success')
720
- // {
721
- // status_message=data.file + ' file was uploaded successfully...';
722
- // wpbackitup_processRow_restore(data);
723
- // $('.upload-status').addClass("isa_success");
724
- // }else{
725
- // status_message='Error:  ' + data.error;
726
- // $('.upload-status').addClass("isa_error");
727
- // }
728
- //
729
- // $('.upload-icon').fadeOut(1000);
730
- // $('.upload-status').show();
731
- // $('.upload-status').html(status_message);
732
- //
733
- // },
734
- // error: function(jqXHR, textStatus, errorThrown){
735
- // console.log("A JS error has occurred." + textStatus +':' +errorThrown);
736
- // },
737
- // complete: function(jqXHR, textStatus){
738
- // console.log("Ajax is finished.");
739
- // }
740
- // });
741
- //
742
- // return false;
743
- //});
744
-
745
  // DELETE file action
746
  $('#datatable').on('click', 'a.deleteRow', function(e) {
747
 
@@ -1011,72 +802,6 @@
1011
  $('html, body').animate({ scrollTop: 0 }, 'slow');
1012
  }
1013
 
1014
-
1015
-
1016
-
1017
- // Uploading files
1018
- //jQuery(document).ready(function($){
1019
- // var custom_uploader;
1020
- // $('#upload_backup_button').click(function(e) {
1021
- //
1022
- // e.preventDefault();
1023
- //
1024
- // //If the uploader object has already been created, reopen the dialog
1025
- // if (custom_uploader) {
1026
- // custom_uploader.open();
1027
- // return;
1028
- // }
1029
- //
1030
- // //Extend the wp.media object (wp-includes/js/media-views.js)
1031
- // custom_uploader = wp.media.frames.file_frame = wp.media({
1032
- // //id:'wpbackitup-library',
1033
- // library: {
1034
- // type: "application/zip"
1035
- // },
1036
- // title: 'Select Backup Files',
1037
- // button: {
1038
- // text: 'Select Backup Files'
1039
- // },
1040
- // //searchable:false,
1041
- // //editing:false,
1042
- // //frame: 'post',
1043
- // multiple: true
1044
- // });
1045
- //
1046
- // //When a file is selected, grab the URL and set it as the text field's value
1047
- // custom_uploader.on('select', function() {
1048
- //
1049
- // //attachment = custom_uploader.state().get('selection').first().toJSON();
1050
- // //$('#upload_backup').val(attachment.filename);
1051
- //
1052
- // var attachments_string='';
1053
- // var selected_file_ids=[];
1054
- // var selection = custom_uploader.state().get('selection');
1055
- // selection.map( function( attachment ) {
1056
- // attachment = attachment.toJSON();
1057
- //
1058
- // //Probably need to add this to a hidden form field
1059
- // selected_file_ids.push(attachment.id);
1060
- // attachments_string+=attachment.filename +",";
1061
- // // Do something with attachment.id and/or attachment.url here
1062
- // });
1063
- //
1064
- // var ids_json = JSON.stringify(selected_file_ids);
1065
- // $('#upload_ids').val(ids_json);
1066
- // $('#upload_files').val(attachments_string);
1067
- // $('#upload_backup').val(attachments_string);
1068
- //
1069
- // });
1070
- //
1071
- //
1072
- // //Open the uploader dialog
1073
- // custom_uploader.open();
1074
- //
1075
- // });
1076
- //
1077
- //
1078
- //});
1079
-
1080
  //**TEST METHODS**//
1081
 
1082
  //wpbackitup_show_restore();
25
 
26
  //UPLOADS
27
  try {
28
+ if(typeof wpbackitup_plupload_config !== 'undefined') {
29
+ plupload_init(wpbackitup_plupload_config);
30
+ }
31
  } catch (err) {
32
  console.log(err);
33
  }
533
  window.intervalDefine = setInterval(wpbackitup_get_restore_status, 5000);
534
  }
535
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  // DELETE file action
537
  $('#datatable').on('click', 'a.deleteRow', function(e) {
538
 
802
  $('html, body').animate({ scrollTop: 0 }, 'slow');
803
  }
804
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805
  //**TEST METHODS**//
806
 
807
  //wpbackitup_show_restore();
lib/includes/class-backup.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
 
2
  /**
3
- * WP Backitup Backup Class
4
- *
5
- * @package WP Backitup
6
- *
7
- * @author cssimmon
8
  *
9
  */
10
 
@@ -443,17 +444,19 @@ class WPBackItUp_Backup {
443
  if (! $this->strposa(basename($folder), $ignore)){
444
  array_push($uploads_file_list,$folder);
445
  $file_list = $file_system->get_recursive_file_list($folder. '/*' );
446
- $uploads_file_list = array_merge($uploads_file_list,$file_list);
 
 
447
  }
448
  }
449
 
450
  //Need to grab the files in the root also
451
  $files_only = array_filter(glob($uploads_root_path. '/*'), 'is_file');
452
- if (count($files_only)>0){
453
  $uploads_file_list = array_merge($uploads_file_list,$files_only);
454
  }
455
 
456
- $this->logger->log_info( __METHOD__, 'Themes File Count: ' .count($uploads_file_list));
457
 
458
  return $uploads_file_list;
459
  }
@@ -481,13 +484,15 @@ class WPBackItUp_Backup {
481
  if (!$this->strposa(basename($folder), $ignore)){
482
  array_push($other_file_list,$folder);
483
  $file_list = $file_system->get_recursive_file_list($folder. '/*' );
484
- $other_file_list = array_merge($other_file_list,$file_list);
 
 
485
  }
486
  }
487
 
488
  //Need to grab the files in the root also
489
  $files_only = array_filter(glob($wpcontent_path. '/*'), 'is_file');
490
- if (count($files_only)>0){
491
 
492
  //Get rid of the debug.log file - dont want to restore it
493
  $debug_log_index = $this->search_array('debug.log', $files_only);
@@ -495,7 +500,9 @@ class WPBackItUp_Backup {
495
  unset($files_only[$debug_log_index]);
496
  }
497
 
498
- $other_file_list = array_merge($other_file_list,$files_only);
 
 
499
  }
500
 
501
  $this->logger->log_info( __METHOD__, 'Other File Count: ' .count($other_file_list));
@@ -507,6 +514,14 @@ class WPBackItUp_Backup {
507
  //BackUp
508
  public function backup_file_list($source_root,$target_root,$suffix,$file_list,$batch_size,$ignore=''){
509
  $this->logger->log_info(__METHOD__,'Begin - Item Count: '. count($file_list));
 
 
 
 
 
 
 
 
510
 
511
  $zip_file_path = $this->backup_project_path . $this->backup_name .'-'.$suffix .'.tmp';
512
  $zip = new WPBackItUp_Zip($this->logger,$zip_file_path);
@@ -530,6 +545,7 @@ class WPBackItUp_Backup {
530
 
531
  //replace the source path with the target
532
  $target_item_path = str_replace(rtrim($source_root, '/'),rtrim($target_root,'/'),$item);
 
533
  if ( $zip->add_file($item,$target_item_path)) {
534
  array_shift($file_list);
535
  $this->logger->log_info( __METHOD__, 'File Added:' . $target_item_path );
@@ -650,7 +666,7 @@ class WPBackItUp_Backup {
650
 
651
  //get a list of all the zips
652
  $backup_files_path = array_filter(glob($this->backup_project_path. '*.zip'), 'is_file');
653
- if (count($backup_files_path)>0){
654
  //get rid of the path.
655
  $backup_files = str_replace($this->backup_project_path,'',$backup_files_path);
656
  $manifest_file=$this->backup_project_path . 'backupmanifest.txt';
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
+
3
  /**
4
+ * WP BackItUp - Backup Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
 
444
  if (! $this->strposa(basename($folder), $ignore)){
445
  array_push($uploads_file_list,$folder);
446
  $file_list = $file_system->get_recursive_file_list($folder. '/*' );
447
+ if (is_array($file_list)) {
448
+ $uploads_file_list = array_merge($uploads_file_list,$file_list);
449
+ }
450
  }
451
  }
452
 
453
  //Need to grab the files in the root also
454
  $files_only = array_filter(glob($uploads_root_path. '/*'), 'is_file');
455
+ if (is_array($files_only) && count($files_only)>0){
456
  $uploads_file_list = array_merge($uploads_file_list,$files_only);
457
  }
458
 
459
+ $this->logger->log_info( __METHOD__, 'Uploads File Count: ' .count($uploads_file_list));
460
 
461
  return $uploads_file_list;
462
  }
484
  if (!$this->strposa(basename($folder), $ignore)){
485
  array_push($other_file_list,$folder);
486
  $file_list = $file_system->get_recursive_file_list($folder. '/*' );
487
+ if (is_array($file_list)) {
488
+ $other_file_list = array_merge($other_file_list,$file_list);
489
+ }
490
  }
491
  }
492
 
493
  //Need to grab the files in the root also
494
  $files_only = array_filter(glob($wpcontent_path. '/*'), 'is_file');
495
+ if (is_array($files_only) && count($files_only)>0){
496
 
497
  //Get rid of the debug.log file - dont want to restore it
498
  $debug_log_index = $this->search_array('debug.log', $files_only);
500
  unset($files_only[$debug_log_index]);
501
  }
502
 
503
+ if (is_array($files_only)) {
504
+ $other_file_list = array_merge($other_file_list,$files_only);
505
+ }
506
  }
507
 
508
  $this->logger->log_info( __METHOD__, 'Other File Count: ' .count($other_file_list));
514
  //BackUp
515
  public function backup_file_list($source_root,$target_root,$suffix,$file_list,$batch_size,$ignore=''){
516
  $this->logger->log_info(__METHOD__,'Begin - Item Count: '. count($file_list));
517
+ $this->logger->log_info(__METHOD__,'Items in Backup List: ');
518
+ $this->logger->log($file_list);
519
+
520
+ if (! is_array($file_list)) {
521
+ $this->logger->log_error(__METHOD__,'Array expected in file list:');
522
+ $this->logger->log($file_list);
523
+ return 'error';
524
+ }
525
 
526
  $zip_file_path = $this->backup_project_path . $this->backup_name .'-'.$suffix .'.tmp';
527
  $zip = new WPBackItUp_Zip($this->logger,$zip_file_path);
545
 
546
  //replace the source path with the target
547
  $target_item_path = str_replace(rtrim($source_root, '/'),rtrim($target_root,'/'),$item);
548
+
549
  if ( $zip->add_file($item,$target_item_path)) {
550
  array_shift($file_list);
551
  $this->logger->log_info( __METHOD__, 'File Added:' . $target_item_path );
666
 
667
  //get a list of all the zips
668
  $backup_files_path = array_filter(glob($this->backup_project_path. '*.zip'), 'is_file');
669
+ if (is_array($backup_files_path) && count($backup_files_path)>0){
670
  //get rid of the path.
671
  $backup_files = str_replace($this->backup_project_path,'',$backup_files_path);
672
  $manifest_file=$this->backup_project_path . 'backupmanifest.txt';
lib/includes/class-filesystem.php CHANGED
@@ -1,13 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
- * WP Backitup Utility Class
5
- *
6
- * @package WP Backitup
7
- *
8
- * @author cssimmon
9
  *
10
  */
 
11
  /*** Includes ***/
12
  // include backup class
13
  if( !class_exists( 'WPBackItUp_RecursiveFilter_Iterator' ) ) {
@@ -535,20 +536,32 @@ class WPBackItUp_FileSystem {
535
 
536
 
537
  public function get_recursive_file_list($pattern) {
538
- $this->logger->log_info( __METHOD__, 'Begin: ' .$pattern );
539
 
540
  return $this->glob_recursive($pattern);
541
  }
542
 
543
- private function glob_recursive($pattern, $flags = 0)
544
- {
 
545
  //The order here is important because the folders must be in the list before the files.
546
- $files = glob($pattern, $flags);
 
 
 
547
  foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR) as $dir)
548
  {
549
- $files = array_merge($files, $this->glob_recursive($dir.'/'.basename($pattern), $flags));
 
 
 
 
 
550
  }
551
 
552
  return $files;
553
  }
554
- }
 
 
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
+ * WP BackItUp - File System Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
+
12
  /*** Includes ***/
13
  // include backup class
14
  if( !class_exists( 'WPBackItUp_RecursiveFilter_Iterator' ) ) {
536
 
537
 
538
  public function get_recursive_file_list($pattern) {
539
+ //$this->logger->log_info( __METHOD__, 'Begin: ' .$pattern );
540
 
541
  return $this->glob_recursive($pattern);
542
  }
543
 
544
+ private function glob_recursive($pattern, $flags = 0) {
545
+ //$this->logger->log_info( __METHOD__, 'Begin' );
546
+
547
  //The order here is important because the folders must be in the list before the files.
548
+ $files = glob($pattern, $flags); //everything in the root
549
+ //$this->logger->log_info( __METHOD__, 'Files Count:' . count($files));
550
+
551
+ //Get the folders and append all the files in the folder
552
  foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR) as $dir)
553
  {
554
+ //Get the contents of the folder
555
+ $current_folder = $this->glob_recursive($dir.'/'.basename($pattern), $flags);
556
+
557
+ if (is_array($current_folder)){
558
+ $files = array_merge($files,$current_folder );
559
+ }
560
  }
561
 
562
  return $files;
563
  }
564
+
565
+
566
+ }
567
+
lib/includes/class-job.php CHANGED
@@ -1,6 +1,19 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
-
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  class WPBackItUp_Job {
6
 
@@ -269,27 +282,25 @@ class WPBackItUp_Job {
269
  public function update_job_meta($meta_name,$meta_value){
270
  $this->logger->log_info(__METHOD__,'Begin - Update job meta:' .$this->job_id .'-'. $meta_name);
271
 
 
 
 
 
 
272
  return update_post_meta( $this->job_id, $meta_name, $meta_value );
273
  }
274
 
275
- // public function update_task_file_list($task_name,$file_list){
276
- // $this->logger->log_info(__METHOD__,'Begin - Update file list:' .$this->job_id .'-'. $task_name);
277
- //
278
- // return update_post_meta( $this->job_id, $task_name, wp_slash($file_list) );
279
- // }
280
-
281
- // public function get_task_file_list($task_name){
282
- // $this->logger->log_info(__METHOD__,'Begin - Update file list:' .$this->job_id .'-'. $task_name);
283
- //
284
- // $file_list = get_post_meta($this->job_id,$task_name,true);
285
- //
286
- // return $file_list;
287
- // }
288
-
289
  public function get_job_meta($meta_name){
290
  $this->logger->log_info(__METHOD__,'Begin - Update file list:' .$this->job_id .'-'. $meta_name);
291
 
292
- return get_post_meta($this->job_id,$meta_name,true);
 
 
 
 
 
 
 
293
 
294
  }
295
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
+ /**
4
+ * WP BackItUp - Job Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
+ *
10
+ */
11
+
12
+
13
+ //Includes
14
+ if( !class_exists( 'WPBackItUp_Utility' ) ) {
15
+ include_once 'class-utility.php';
16
+ }
17
 
18
  class WPBackItUp_Job {
19
 
282
  public function update_job_meta($meta_name,$meta_value){
283
  $this->logger->log_info(__METHOD__,'Begin - Update job meta:' .$this->job_id .'-'. $meta_name);
284
 
285
+ //Encode the array values
286
+ if (is_array($meta_value)){
287
+ array_walk_recursive($meta_value, 'WPBackItUp_Utility::encode_items');
288
+ }
289
+
290
  return update_post_meta( $this->job_id, $meta_name, $meta_value );
291
  }
292
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  public function get_job_meta($meta_name){
294
  $this->logger->log_info(__METHOD__,'Begin - Update file list:' .$this->job_id .'-'. $meta_name);
295
 
296
+ $job_meta = get_post_meta($this->job_id,$meta_name,true);
297
+
298
+ //Encode the array values
299
+ if (is_array($job_meta)){
300
+ array_walk_recursive($job_meta, 'WPBackItUp_Utility::decode_items');
301
+ }
302
+
303
+ return $job_meta;
304
 
305
  }
306
 
lib/includes/class-logger.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (logger)');
2
 
3
  /**
4
- * WP Backitup Logging Class
5
- *
6
- * @package WP Backitup
7
- *
8
- * @author cssimmon
9
- *
10
  */
11
 
12
  class WPBackItUp_Logger {
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (logger)');
2
 
3
  /**
4
+ * WP BackItUp - Logger System Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
+ *
10
  */
11
 
12
  class WPBackItUp_Logger {
lib/includes/class-recursiveFilter_Iterator.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
- * WP Backitup Recurse Iterator
5
- *
6
- * @package WP Backitup
7
- *
8
- * @author cssimmon
9
  *
10
  */
11
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
+ * WP BackItUp - Recursive iterator Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
 
lib/includes/class-restore.php CHANGED
@@ -1,12 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
 
2
  /**
3
- * WP Backitup Backup Class
4
- *
5
- * @package WP Backitup
6
  *
7
- * @author cssimmon
 
 
8
  *
9
  */
 
10
  class WPBackItUp_Restore {
11
 
12
  private $logger;
@@ -112,7 +114,7 @@ class WPBackItUp_Restore {
112
  function unzip_archive_file($backup_set_list){
113
  $this->logger->log_info(__METHOD__,'Begin');
114
 
115
- if (count($backup_set_list)<=0) return false;
116
 
117
  $backup_file_path = $backup_set_list[0];
118
  $this->logger->log_info(__METHOD__,'Begin - Unzip Backup File:' .$backup_file_path);
@@ -206,7 +208,7 @@ class WPBackItUp_Restore {
206
  //Get file values
207
  $this->logger->log_info(__METHOD__, 'GET Site Info data' );
208
  $import_siteinfo_lines = file( $site_info_path);
209
- if (count($import_siteinfo_lines)<3){
210
  $this->logger->log_error(__METHOD__,'Site Data file NOT valid.' );
211
  return false;
212
  } else {
@@ -410,7 +412,7 @@ class WPBackItUp_Restore {
410
  }
411
 
412
 
413
- if (count($error_folders)>0){
414
  $this->logger->log_error(__METHOD__,'End - Error Folders:');
415
  $this->logger->log($error_folders);
416
  return $error_folders;
@@ -469,7 +471,7 @@ class WPBackItUp_Restore {
469
  }
470
 
471
 
472
- if (count($error_files)>0) {
473
  $this->logger->log_error(__METHOD__,'End - Error Files:');
474
  $this->logger->log($error_files);
475
  return $error_folders;
@@ -552,7 +554,7 @@ class WPBackItUp_Restore {
552
 
553
 
554
  //If error on folders then return
555
- if (count($error_folders)>0){
556
  $this->logger->log_error(__METHOD__,'End - Error Folders:');
557
  $this->logger->log($error_folders);
558
  return $error_folders;
@@ -611,7 +613,7 @@ class WPBackItUp_Restore {
611
  }
612
 
613
 
614
- if (count($error_files)>0) {
615
  $this->logger->log_error(__METHOD__,'End - Error Files:');
616
  $this->logger->log($error_files);
617
  return $error_folders;
@@ -843,7 +845,8 @@ class WPBackItUp_Restore {
843
  $user_id = $dbc->get_sql_scalar($sql);
844
  $this->logger->log_info(__METHOD__,'Fetch user by id:' .$user_id);
845
 
846
- $sql = "INSERT INTO ". $table_prefix ."usermeta (user_id, meta_key, meta_value) values(" .$user_id .",'wp_capabilities', 'a:1:{s:13:\"administrator\";s:1:\"1\";}')";
 
847
  if (!$dbc->run_sql_command($sql)){
848
  $this->logger->log_error(__METHOD__,'user capabilities insert failed.');
849
  return false;
@@ -851,7 +854,8 @@ class WPBackItUp_Restore {
851
  $this->logger->log_info(__METHOD__,'User capabilities inserted successfully.');
852
  }
853
 
854
- $sql = "INSERT INTO ". $table_prefix ."usermeta (user_id, meta_key, meta_value) values(" .$user_id .",'wp_user_level', '10')";
 
855
  if (!$dbc->run_sql_command($sql)){
856
  $this->logger->log_error(__METHOD__,'User level insert failed');
857
  return false;
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
+
3
  /**
4
+ * WP BackItUp - Restore Class
 
 
5
  *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
+
12
  class WPBackItUp_Restore {
13
 
14
  private $logger;
114
  function unzip_archive_file($backup_set_list){
115
  $this->logger->log_info(__METHOD__,'Begin');
116
 
117
+ if (! is_array($backup_set_list) || count($backup_set_list)<=0) return false;
118
 
119
  $backup_file_path = $backup_set_list[0];
120
  $this->logger->log_info(__METHOD__,'Begin - Unzip Backup File:' .$backup_file_path);
208
  //Get file values
209
  $this->logger->log_info(__METHOD__, 'GET Site Info data' );
210
  $import_siteinfo_lines = file( $site_info_path);
211
+ if (!is_array($import_siteinfo_lines) || count($import_siteinfo_lines)<3){
212
  $this->logger->log_error(__METHOD__,'Site Data file NOT valid.' );
213
  return false;
214
  } else {
412
  }
413
 
414
 
415
+ if ( is_array($error_folders) && count($error_folders)>0){
416
  $this->logger->log_error(__METHOD__,'End - Error Folders:');
417
  $this->logger->log($error_folders);
418
  return $error_folders;
471
  }
472
 
473
 
474
+ if ( is_array($error_files) && count($error_files)>0) {
475
  $this->logger->log_error(__METHOD__,'End - Error Files:');
476
  $this->logger->log($error_files);
477
  return $error_folders;
554
 
555
 
556
  //If error on folders then return
557
+ if (is_array($error_folders) && count($error_folders)>0){
558
  $this->logger->log_error(__METHOD__,'End - Error Folders:');
559
  $this->logger->log($error_folders);
560
  return $error_folders;
613
  }
614
 
615
 
616
+ if (is_array($error_files) && count($error_files)>0) {
617
  $this->logger->log_error(__METHOD__,'End - Error Files:');
618
  $this->logger->log($error_files);
619
  return $error_folders;
845
  $user_id = $dbc->get_sql_scalar($sql);
846
  $this->logger->log_info(__METHOD__,'Fetch user by id:' .$user_id);
847
 
848
+ $capabilities = $table_prefix . "capabilities";
849
+ $sql = "INSERT INTO ". $table_prefix ."usermeta (user_id, meta_key, meta_value) values(" .$user_id .",'" . $capabilities . "', 'a:1:{s:13:\"administrator\";s:1:\"1\";}')";
850
  if (!$dbc->run_sql_command($sql)){
851
  $this->logger->log_error(__METHOD__,'user capabilities insert failed.');
852
  return false;
854
  $this->logger->log_info(__METHOD__,'User capabilities inserted successfully.');
855
  }
856
 
857
+ $user_level = $table_prefix . 'user_level';
858
+ $sql = "INSERT INTO ". $table_prefix ."usermeta (user_id, meta_key, meta_value) values(" .$user_id .",'" . $user_level . "', '10')";
859
  if (!$dbc->run_sql_command($sql)){
860
  $this->logger->log_error(__METHOD__,'User level insert failed');
861
  return false;
lib/includes/class-scheduler.php CHANGED
@@ -1,10 +1,11 @@
1
- <?php
 
2
  /**
3
- * WP BackItUp Scheduler Class
4
- *
5
- * @package WP Backitup
6
  *
7
- * @author cssimmon
 
 
8
  *
9
  */
10
 
1
+ <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
+
3
  /**
4
+ * WP BackItUp - Scheduler Class
 
 
5
  *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
 
lib/includes/class-sql.php CHANGED
@@ -1,13 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
- * WP Backitup SQL Class
5
- *
6
- * @package WP Backitup
7
- *
8
- * @author cssimmon
9
  *
10
  */
 
11
  class WPBackItUp_SQL {
12
 
13
  private $logger;
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
+ * WP BackItUp - SQL Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
+
12
  class WPBackItUp_SQL {
13
 
14
  private $logger;
lib/includes/class-utility.php CHANGED
@@ -1,12 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
 
2
  /**
3
- * WP Backitup Utility Class
4
- *
5
- * @package WP Backitup
6
- *
7
- * @author cssimmon
8
  *
9
  */
 
10
  class WPBackItUp_Utility {
11
 
12
  private $logger;
@@ -79,5 +81,15 @@ class WPBackItUp_Utility {
79
 
80
  return $timestamp_diff_seconds;
81
  }
 
 
 
 
 
 
 
 
 
 
82
  }
83
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
+
3
  /**
4
+ * WP BackItUp - Utility Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
+
12
  class WPBackItUp_Utility {
13
 
14
  private $logger;
81
 
82
  return $timestamp_diff_seconds;
83
  }
84
+
85
+ public static function encode_items(&$item, $key)
86
+ {
87
+ $item = utf8_encode($item);
88
+ }
89
+
90
+ public static function decode_items(&$item, $key)
91
+ {
92
+ $item = utf8_decode($item);
93
+ }
94
  }
95
 
lib/includes/class-wpbackitup-admin.php CHANGED
@@ -1,11 +1,12 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
 
2
  /**
3
- * WP Backitup Admin Class
4
- *
5
- * @package WP Backitup
6
- *
7
- * @author cssimmon
8
- *
9
  */
10
 
11
 
@@ -1236,7 +1237,7 @@ class WPBackitup_Admin {
1236
  $folder_list = glob($backup_dir . "/*",GLOB_ONLYDIR);
1237
  $backup_list=array();
1238
  $i=0;
1239
- if (count($folder_list)>0) {
1240
  foreach($folder_list as $folder) {
1241
  $backup_name = basename($folder);
1242
  $backup_prefix = substr($backup_name,0,4);
@@ -1246,11 +1247,10 @@ class WPBackitup_Admin {
1246
  $backup_prefix!='DLT_' ) {
1247
 
1248
  $i++;
1249
- if( $number_retained_archives && $i> $number_retained_archives ) break;
1250
 
1251
  $logs = glob($folder . "/*.log");
1252
  $log_exists=false;
1253
- if (count($logs)>0){
1254
  $log_exists=true;
1255
  }
1256
 
@@ -1265,17 +1265,8 @@ class WPBackitup_Admin {
1265
  "zip_files"=>$zip_files,
1266
  ));
1267
 
1268
- // $backup_list[] = [
1269
- // "backup_name" => $backup_name,
1270
- // "log_exists"=>$log_exists,
1271
- // "date_time" => filectime($folder),
1272
- // "zip_files"=>$zip_files,
1273
- // ];
1274
  }
1275
  }
1276
- //sort the list by date - doesnt work when impoing folders..use filename descending
1277
-
1278
- //usort($backup_list, create_function('$a,$b', 'return $b["date_time"] - $a["date_time"];'));
1279
 
1280
  return array_reverse($backup_list);
1281
  }
@@ -1366,7 +1357,7 @@ class WPBackitup_Admin {
1366
  */
1367
  private function update_license_options($license)
1368
  {
1369
- $logger = new WPBackItUp_Logger(false);
1370
  $logger->log('Update License Options:' .$license);
1371
 
1372
  $license=trim($license);
@@ -1402,10 +1393,11 @@ class WPBackitup_Admin {
1402
  $logger->log('Activate License Request Info:');
1403
  $logger->log($api_params);
1404
 
 
1405
  $response = wp_remote_get(
1406
  add_query_arg( $api_params, WPBACKITUP__SECURESITE_URL ),
1407
  array(
1408
- 'timeout' => 15,
1409
  'sslverify' => false
1410
  )
1411
  );
@@ -1696,7 +1688,7 @@ class WPBackitup_Admin {
1696
  );
1697
 
1698
  $url = WPBACKITUP__SECURESITE_URL .'/stats-update-test';
1699
- $response = wp_remote_get( add_query_arg( $api_params, $url ), array( 'timeout' => 15, 'sslverify' => true ) );
1700
  $logger->log('Stats Response:');
1701
  $logger->log($response);
1702
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
+
3
  /**
4
+ * WP BackItUp - Admin Class
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
+ *
10
  */
11
 
12
 
1237
  $folder_list = glob($backup_dir . "/*",GLOB_ONLYDIR);
1238
  $backup_list=array();
1239
  $i=0;
1240
+ if (is_array($folder_list) && count($folder_list)>0) {
1241
  foreach($folder_list as $folder) {
1242
  $backup_name = basename($folder);
1243
  $backup_prefix = substr($backup_name,0,4);
1247
  $backup_prefix!='DLT_' ) {
1248
 
1249
  $i++;
 
1250
 
1251
  $logs = glob($folder . "/*.log");
1252
  $log_exists=false;
1253
+ if (is_array($logs) && count($logs)>0){
1254
  $log_exists=true;
1255
  }
1256
 
1265
  "zip_files"=>$zip_files,
1266
  ));
1267
 
 
 
 
 
 
 
1268
  }
1269
  }
 
 
 
1270
 
1271
  return array_reverse($backup_list);
1272
  }
1357
  */
1358
  private function update_license_options($license)
1359
  {
1360
+ $logger = new WPBackItUp_Logger(true,null,'debug_activation');
1361
  $logger->log('Update License Options:' .$license);
1362
 
1363
  $license=trim($license);
1393
  $logger->log('Activate License Request Info:');
1394
  $logger->log($api_params);
1395
 
1396
+ //try 30 secs when connected to web.
1397
  $response = wp_remote_get(
1398
  add_query_arg( $api_params, WPBACKITUP__SECURESITE_URL ),
1399
  array(
1400
+ 'timeout' => 25,
1401
  'sslverify' => false
1402
  )
1403
  );
1688
  );
1689
 
1690
  $url = WPBACKITUP__SECURESITE_URL .'/stats-update-test';
1691
+ $response = wp_remote_get( add_query_arg( $api_params, $url ), array( 'timeout' => 25, 'sslverify' => true ) );
1692
  $logger->log('Stats Response:');
1693
  $logger->log($response);
1694
 
lib/includes/class-zip.php CHANGED
@@ -1 +1 @@
1
- <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
  * WP Backitup Zip Function
3
  *
4
  * @package WP Backitup
5
  *
6
  * @author cssimmon
7
  *
8
  */
9
  private $zip_file_count;
10
  $this->zip_file_count=0;
11
  }
 
12
  * WP BackItUp - Zip Class
13
  *
14
  * @package WP BackItUp
15
  * @author Chris Simmons <chris.simmons@wpbackitup.com>
16
  * @link http://www.wpbackitup.com
17
  *
18
  */
19
  private $zip_file_count;
20
  $this->zip_file_count=0;
21
  }
 
1
  * WP Backitup Zip Function
2
  *
3
  * @package WP Backitup
4
  *
5
  * @author cssimmon
6
  *
7
  */
8
  private $zip_file_count;
9
  $this->zip_file_count=0;
10
  }
11
+ <?php if (!defined ('ABSPATH')) die('No direct access allowed');
12
  * WP BackItUp - Zip Class
13
  *
14
  * @package WP BackItUp
15
  * @author Chris Simmons <chris.simmons@wpbackitup.com>
16
  * @link http://www.wpbackitup.com
17
  *
18
  */
19
  private $zip_file_count;
20
  $this->zip_file_count=0;
21
  }
lib/includes/handler_download.php CHANGED
@@ -1,8 +1,17 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (viewlog)');
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
 
 
 
 
 
 
 
 
 
4
  //Turn off output buffering if it was on.
5
- while (@ob_end_flush());
6
 
7
  // required for IE, otherwise Content-disposition is ignored
8
  //@apache_setenv('no-gzip', 1); //Causes failure on siteground...research
@@ -58,19 +67,23 @@ if ( isset($_REQUEST['_wpnonce']) && !empty($_REQUEST['_wpnonce'])
58
  $cnt =0;
59
  $handle = fopen($backup_path, 'rb');
60
  if ($handle !== false) {
61
- //Output Headers
62
- header("Cache-Control: no-store, no-cache, must-revalidate");
63
- header("Cache-Control: post-check=0, pre-check=0", false);
64
- header("Pragma: no-cache");
65
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT" );
66
- header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
67
 
68
- header("Content-Disposition: inline; filename=$file_name");
 
 
 
69
 
 
 
70
  header("Content-type: application/zip");
71
- header("Content-Transfer-Encoding: binary");
72
  header("Content-Length: ".$file_size);
73
 
 
 
74
  while (!feof($handle) && (connection_status()==0) ) {
75
  $buffer = fread($handle, $chunksize);
76
  echo $buffer;
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (viewlog)');
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
+ /**
5
+ * WP BackItUp - Download handler
6
+ *
7
+ * @package WP BackItUp
8
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
9
+ * @link http://www.wpbackitup.com
10
+ *
11
+ */
12
+
13
  //Turn off output buffering if it was on.
14
+ while (@ob_end_clean());
15
 
16
  // required for IE, otherwise Content-disposition is ignored
17
  //@apache_setenv('no-gzip', 1); //Causes failure on siteground...research
67
  $cnt =0;
68
  $handle = fopen($backup_path, 'rb');
69
  if ($handle !== false) {
70
+ //Have the headers already been sent for some reason
71
+ if (headers_sent()) {
72
+ $logger->log_error( __METHOD__, 'Headers already sent.' );
73
+ }
 
 
74
 
75
+ //Output Headers
76
+ header("Pragma: public");
77
+ header("Expires: -1");
78
+ header("Cache-Control: public, must-revalidate, post-check=0, pre-check=0");
79
 
80
+ header("Content-Disposition: attachment; filename=\"".urlencode($file_name)."\"");
81
+ // header("Content-Disposition: attachment; filename=\"$file_name\"");
82
  header("Content-type: application/zip");
 
83
  header("Content-Length: ".$file_size);
84
 
85
+
86
+
87
  while (!feof($handle) && (connection_status()==0) ) {
88
  $buffer = fread($handle, $chunksize);
89
  echo $buffer;
lib/includes/handler_upload.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (upload)');
 
2
  /**
3
- * WP BackItUp File Upload Handler
4
- *
5
  * @package WP BackItUp
6
- *
7
- * @author cssimmon
8
  *
9
  */
10
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (upload)');
2
+
3
  /**
4
+ * WP BackItUp - Upload Handler
5
+ *
6
  * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
 
lib/includes/handler_viewlog.php CHANGED
@@ -1,6 +1,15 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (viewlog)');
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
 
 
 
 
 
 
 
 
 
4
 
5
  if ( isset($_REQUEST['_wpnonce']) && !empty($_REQUEST['_wpnonce'])
6
  && isset($_REQUEST['backup_name']) && !empty($_REQUEST['backup_name']) ){
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed (viewlog)');
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
+ /**
5
+ * WP BackItUp - View Log Handler
6
+ *
7
+ * @package WP BackItUp
8
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
9
+ * @link http://www.wpbackitup.com
10
+ *
11
+ */
12
+
13
 
14
  if ( isset($_REQUEST['_wpnonce']) && !empty($_REQUEST['_wpnonce'])
15
  && isset($_REQUEST['backup_name']) && !empty($_REQUEST['backup_name']) ){
lib/includes/job_backup.php CHANGED
@@ -2,12 +2,12 @@
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
  /**
5
- * WP Backitup Backup
6
- *
7
- * @package WP Backitup
8
- *
9
- * @author cssimmon
10
- *
11
  */
12
 
13
  /*** Includes ***/
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
  /**
5
+ * WP BackItUp - Backup Job
6
+ *
7
+ * @package WP BackItUp
8
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
9
+ * @link http://www.wpbackitup.com
10
+ *
11
  */
12
 
13
  /*** Includes ***/
lib/includes/job_cleanup.php CHANGED
@@ -2,11 +2,11 @@
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
  /**
5
- * WP Backitup Backup
6
  *
7
- * @package WP Backitup
8
- *
9
- * @author cssimmon
10
  *
11
  */
12
 
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
  /**
5
+ * WP BackItUp - Cleanup Job
6
  *
7
+ * @package WP BackItUp
8
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
9
+ * @link http://www.wpbackitup.com
10
  *
11
  */
12
 
lib/includes/job_restore.php CHANGED
@@ -2,11 +2,11 @@
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
  /**
5
- * WP Backitup Restore Functions
6
- *
7
- * @package WP Backitup Pro
8
- *
9
- * @author cssimmon
10
  *
11
  */
12
 
@@ -246,7 +246,7 @@ if ('task_preparing'==$current_task) {
246
  $backup_path_pattern = $wp_restore->get_backup_folder_path() . '/' .$wp_restore->get_backup_name() . '*.zip' ;
247
  $logger->log_info(__METHOD__,'Fetch backups pattern:' .$backup_path_pattern);
248
  $backup_set = glob( $backup_path_pattern);
249
- if ( count($backup_set)>0){
250
  $restore_job->update_job_meta('backup_set',wp_slash($backup_set));
251
  $restore_job->update_job_meta('backup_set_remaining',wp_slash($backup_set));
252
  }else{
@@ -318,7 +318,7 @@ if ('task_unzip_backup_set'==$current_task) {
318
  array_shift( $backup_set_list ); //remove from list
319
  $restore_job->update_job_meta('backup_set_remaining',wp_slash($backup_set_list));
320
 
321
- if (count($backup_set_list)>0){
322
  //CONTINUE
323
  $logger->log('Continue unzipping backup set.');
324
  $restore_job->set_task_queued();
@@ -404,8 +404,7 @@ if ('task_validate_backup'==$current_task) {
404
  $logger->log_info(__METHOD__,'Backup Created with WP BackItUp Version :');
405
  $logger->log($restore_wpbackitup_version);
406
 
407
- //Check version if not 1.9
408
- if ("1" != $restore_wpbackitup_version[0] || "9" !=$restore_wpbackitup_version[1]){
409
  //If major version is different
410
  if ($restore_wpbackitup_version[0] != $current_wpbackitup_version[0] ||
411
  $restore_wpbackitup_version[1] != $current_wpbackitup_version[1] ) {
@@ -798,10 +797,10 @@ function set_status_success(){
798
  function end_restore($err=null, $success=null){
799
  global $WPBackitup, $wp_restore, $logger;
800
 
801
- if (true===$success) $logger->log("Backup completed: SUCCESS");
802
- if (false===$success) $logger->log("Backup completed: ERROR");
803
 
804
- $logger->log("*** END BACKUP ***");
805
 
806
  //Zip up all the logs
807
  // $zip_file_path =$wp_restore->zip_logs();
@@ -817,6 +816,6 @@ function end_restore($err=null, $success=null){
817
  //Close the logger
818
  $logger->close_file();
819
 
820
- echo('Backup has completed');
821
  exit(0);
822
  }
2
  @set_time_limit(WPBACKITUP__SCRIPT_TIMEOUT_SECONDS);
3
 
4
  /**
5
+ * WP BackItUp - Restore Job
6
+ *
7
+ * @package WP BackItUp
8
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
9
+ * @link http://www.wpbackitup.com
10
  *
11
  */
12
 
246
  $backup_path_pattern = $wp_restore->get_backup_folder_path() . '/' .$wp_restore->get_backup_name() . '*.zip' ;
247
  $logger->log_info(__METHOD__,'Fetch backups pattern:' .$backup_path_pattern);
248
  $backup_set = glob( $backup_path_pattern);
249
+ if ( is_array($backup_set) && count($backup_set)>0){
250
  $restore_job->update_job_meta('backup_set',wp_slash($backup_set));
251
  $restore_job->update_job_meta('backup_set_remaining',wp_slash($backup_set));
252
  }else{
318
  array_shift( $backup_set_list ); //remove from list
319
  $restore_job->update_job_meta('backup_set_remaining',wp_slash($backup_set_list));
320
 
321
+ if (is_array($backup_set_list) && count($backup_set_list)>0){
322
  //CONTINUE
323
  $logger->log('Continue unzipping backup set.');
324
  $restore_job->set_task_queued();
404
  $logger->log_info(__METHOD__,'Backup Created with WP BackItUp Version :');
405
  $logger->log($restore_wpbackitup_version);
406
 
407
+ if (! empty($restore_wpbackitup_version[0]) && isset ($restore_wpbackitup_version[0])){ //Check version if not old backup - this should be removed in a few releases
 
408
  //If major version is different
409
  if ($restore_wpbackitup_version[0] != $current_wpbackitup_version[0] ||
410
  $restore_wpbackitup_version[1] != $current_wpbackitup_version[1] ) {
797
  function end_restore($err=null, $success=null){
798
  global $WPBackitup, $wp_restore, $logger;
799
 
800
+ if (true===$success) $logger->log("Restore completed: SUCCESS");
801
+ if (false===$success) $logger->log("Restore completed: ERROR");
802
 
803
+ $logger->log("*** END RESTORE ***");
804
 
805
  //Zip up all the logs
806
  // $zip_file_path =$wp_restore->zip_logs();
816
  //Close the logger
817
  $logger->close_file();
818
 
819
+ echo('Restore has completed');
820
  exit(0);
821
  }
readme.txt CHANGED
@@ -151,6 +151,16 @@ Our online documentation and full list of FAQs can be found at [www.wpbackitup.c
151
 
152
 
153
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
154
  = 1.10.1 =
155
  * Update: Display backup set name in available backup lists.
156
  * Update: Remove backup retention limitations for WP BackItUp lite.
151
 
152
 
153
  == Changelog ==
154
+ = 1.10.2 =
155
+ * Update: Display backup file set name instead of date
156
+ * Fix: Backup plugins error when no files on last folder
157
+ * Fix: Extend activation request timeout
158
+ * Fix: Correct issue with restore version checking
159
+ * Fix: Correct issue with restore current user capabilities
160
+ * Fix: Correct sorting and display of available backups
161
+ * Fix: Correct issues with files named using german character set
162
+ * Fix: Correct issues with file downloads
163
+
164
  = 1.10.1 =
165
  * Update: Display backup set name in available backup lists.
166
  * Update: Remove backup retention limitations for WP BackItUp lite.
views/backup.php CHANGED
@@ -1,5 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
 
 
 
 
 
 
 
 
 
3
  $page_title = $this->friendly_name . ' Dashboard';
4
  $namespace = $this->namespace;
5
 
@@ -199,14 +208,14 @@ if (!$backup_folder_exists) {
199
  <h3><i class="fa fa-cloud-download"></i> <?php _e('Available Backups', $namespace); ?></h3>
200
 
201
  <!--View Log Form-->
202
- <form id = "viewlog" name = "viewlog" action="admin-post.php/?sc=<?php _e(current_time( 'timestamp' ) )?>" method="post">
203
  <input type="hidden" name="action" value="viewlog">
204
  <input type="hidden" id="backup_name" name="backup_name" value="">
205
  <?php wp_nonce_field($this->namespace . "-viewlog"); ?>
206
  </form>
207
 
208
 
209
- <form id = "download_backup" name = "download_backup" action="admin-post.php/?sc=<?php _e(current_time( 'timestamp' ) )?>" method="post">
210
  <input type="hidden" name="action" value="download_backup">
211
  <input type="hidden" id="backup_file" name="backup_file" value="">
212
  <?php wp_nonce_field($this->namespace . "-download_backup"); ?>
@@ -221,6 +230,9 @@ if (!$backup_folder_exists) {
221
  foreach ($backup_list as $file)
222
  {
223
 
 
 
 
224
  $backup_name = $file["backup_name"];
225
  $file_datetime = get_date_from_gmt(date('Y-m-d H:i:s', $file["date_time"]), 'Y-m-d g:i a');
226
  $log_exists = $file["log_exists"];
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
+ /**
4
+ * WP BackItUp - Backup View
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
+ *
10
+ */
11
+
12
  $page_title = $this->friendly_name . ' Dashboard';
13
  $namespace = $this->namespace;
14
 
208
  <h3><i class="fa fa-cloud-download"></i> <?php _e('Available Backups', $namespace); ?></h3>
209
 
210
  <!--View Log Form-->
211
+ <form id = "viewlog" name = "viewlog" action="admin-post.php" method="post">
212
  <input type="hidden" name="action" value="viewlog">
213
  <input type="hidden" id="backup_name" name="backup_name" value="">
214
  <?php wp_nonce_field($this->namespace . "-viewlog"); ?>
215
  </form>
216
 
217
 
218
+ <form id = "download_backup" name = "download_backup" action="admin-post.php" method="post">
219
  <input type="hidden" name="action" value="download_backup">
220
  <input type="hidden" id="backup_file" name="backup_file" value="">
221
  <?php wp_nonce_field($this->namespace . "-download_backup"); ?>
230
  foreach ($backup_list as $file)
231
  {
232
 
233
+ //Only show the number in the retained list
234
+ if($i >= $number_retained_archives ) break;
235
+
236
  $backup_name = $file["backup_name"];
237
  $file_datetime = get_date_from_gmt(date('Y-m-d H:i:s', $file["date_time"]), 'Y-m-d g:i a');
238
  $log_exists = $file["log_exists"];
views/restore.php CHANGED
@@ -1,5 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
 
 
 
 
 
 
 
 
 
3
  $page_title = $this->friendly_name . ' Restore';
4
  $namespace = $this->namespace;
5
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
+ /**
4
+ * WP BackItUp - Restore View
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
+ *
10
+ */
11
+
12
  $page_title = $this->friendly_name . ' Restore';
13
  $namespace = $this->namespace;
14
 
views/settings.php CHANGED
@@ -1,5 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
-
 
 
 
 
 
 
 
 
 
3
  $page_title = $this->friendly_name . ' Settings';
4
  $namespace = $this->namespace;
5
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
+
3
+ /**
4
+ * WP BackItUp - Settings View
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
+ *
10
+ */
11
+
12
  $page_title = $this->friendly_name . ' Settings';
13
  $namespace = $this->namespace;
14
 
views/support.php CHANGED
@@ -1,5 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
-
 
 
 
 
 
 
 
 
 
3
  $page_title = $this->friendly_name . ' Support';
4
  $namespace = $this->namespace;
5
 
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
+
3
+ /**
4
+ * WP BackItUp - Support View
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
+ *
10
+ */
11
+
12
  $page_title = $this->friendly_name . ' Support';
13
  $namespace = $this->namespace;
14
 
wp-backitup.php CHANGED
@@ -1,18 +1,19 @@
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
- * WP Backitup
5
- *
6
- * @package WP Backitup
7
- *
8
- * @author cssimmon
9
  *
10
  */
 
11
  /*
12
  Plugin Name: WP Backitup
13
  Plugin URI: http://www.wpbackitup.com
14
  Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
15
- Version: 1.10.1
16
  Author: Chris Simmons
17
  Author URI: http://www.wpbackitup.com
18
  License: GPL3
@@ -34,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
34
  */
35
 
36
  define( 'WPBACKITUP__NAMESPACE', 'wp-backitup' );
37
- define( 'WPBACKITUP__VERSION', '1.10.1');
38
  define( 'WPBACKITUP__DEBUG', false );
39
  define( 'WPBACKITUP__MINIMUM_WP_VERSION', '3.0' );
40
  define( 'WPBACKITUP__ITEM_NAME', 'WP Backitup' );
1
  <?php if (!defined ('ABSPATH')) die('No direct access allowed');
2
 
3
  /**
4
+ * WP BackItUp - Backup View
5
+ *
6
+ * @package WP BackItUp
7
+ * @author Chris Simmons <chris.simmons@wpbackitup.com>
8
+ * @link http://www.wpbackitup.com
9
  *
10
  */
11
+
12
  /*
13
  Plugin Name: WP Backitup
14
  Plugin URI: http://www.wpbackitup.com
15
  Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
16
+ Version: 1.10.2
17
  Author: Chris Simmons
18
  Author URI: http://www.wpbackitup.com
19
  License: GPL3
35
  */
36
 
37
  define( 'WPBACKITUP__NAMESPACE', 'wp-backitup' );
38
+ define( 'WPBACKITUP__VERSION', '1.10.2');
39
  define( 'WPBACKITUP__DEBUG', false );
40
  define( 'WPBACKITUP__MINIMUM_WP_VERSION', '3.0' );
41
  define( 'WPBACKITUP__ITEM_NAME', 'WP Backitup' );