Total Upkeep – WordPress Backup Plugin plus Restore & Migrate by BoldGrid - Version branch.issue-454.202103251048

Version Description

Download this release

Release Info

Developer boldgrid
Plugin Icon 128x128 Total Upkeep – WordPress Backup Plugin plus Restore & Migrate by BoldGrid
Version branch.issue-454.202103251048
Comparing to
See all releases

Code changes from version 1.14.11 to branch.issue-454.202103251048

admin/class-boldgrid-backup-admin-core.php CHANGED
@@ -2670,12 +2670,19 @@ class Boldgrid_Backup_Admin_Core {
2670
  * @see Boldgrid_Backup_File::send_file()
2671
  */
2672
  public function download_archive_file_callback() {
 
 
 
 
 
2673
  // Verify nonce, or die.
2674
  check_ajax_referer( 'archive_auth', 'wpnonce' );
2675
 
2676
  // Check user capabilities.
2677
  if ( ! current_user_can( 'update_plugins' ) ) {
2678
- esc_html_e( 'Security violation (not authorized).', 'boldgrid-backup' );
 
 
2679
  wp_die();
2680
  }
2681
 
@@ -2683,7 +2690,9 @@ class Boldgrid_Backup_Admin_Core {
2683
  if ( isset( $_POST['download_key'] ) && is_numeric( $_POST['download_key'] ) ) {
2684
  $download_key = (int) $_POST['download_key'];
2685
  } else {
2686
- esc_html_e( 'INVALID DOWNLOAD KEY', 'boldgrid-backup' );
 
 
2687
  wp_die();
2688
  }
2689
 
@@ -2691,7 +2700,9 @@ class Boldgrid_Backup_Admin_Core {
2691
  if ( ! empty( $_POST['download_filename'] ) ) {
2692
  $download_filename = sanitize_file_name( $_POST['download_filename'] );
2693
  } else {
2694
- esc_html_e( 'INVALID DOWNLOAD FILENAME', 'boldgrid-backup' );
 
 
2695
  wp_die();
2696
  }
2697
 
@@ -2700,7 +2711,9 @@ class Boldgrid_Backup_Admin_Core {
2700
 
2701
  // Check WP_Filesystem method; ensure it is "direct".
2702
  if ( 'direct' !== $access_type ) {
2703
- esc_html_e( 'WP_Filesystem method is not "direct"', 'boldgrid-backup' );
 
 
2704
  wp_die();
2705
  }
2706
 
@@ -2709,7 +2722,9 @@ class Boldgrid_Backup_Admin_Core {
2709
 
2710
  // If no files were found, then abort.
2711
  if ( empty( $archives ) ) {
2712
- esc_html_e( 'NO BACKUP ARCHIVES FOUND', 'boldgrid-backup' );
 
 
2713
  wp_die();
2714
  }
2715
 
@@ -2721,7 +2736,9 @@ class Boldgrid_Backup_Admin_Core {
2721
 
2722
  // Verify filename.
2723
  if ( $download_filename !== $filename ) {
2724
- esc_html_e( 'FILE NOT FOUND', 'boldgrid-backup' );
 
 
2725
  wp_die();
2726
  }
2727
 
@@ -2734,6 +2751,7 @@ class Boldgrid_Backup_Admin_Core {
2734
  }
2735
 
2736
  // Send the file and die nicely.
 
2737
  Boldgrid_Backup_File::send_file( $filepath, $filesize );
2738
  }
2739
 
2670
  * @see Boldgrid_Backup_File::send_file()
2671
  */
2672
  public function download_archive_file_callback() {
2673
+ $log = new Boldgrid_Backup_Admin_Log( $this );
2674
+ $log->init( 'backup-download.log' );
2675
+ $log->add_separator();
2676
+ $log->add( 'Attempting ajax download...' );
2677
+
2678
  // Verify nonce, or die.
2679
  check_ajax_referer( 'archive_auth', 'wpnonce' );
2680
 
2681
  // Check user capabilities.
2682
  if ( ! current_user_can( 'update_plugins' ) ) {
2683
+ $error = __( 'Security violation (not authorized).', 'boldgrid-backup' );
2684
+ echo esc_html( $error );
2685
+ $log->add( $error );
2686
  wp_die();
2687
  }
2688
 
2690
  if ( isset( $_POST['download_key'] ) && is_numeric( $_POST['download_key'] ) ) {
2691
  $download_key = (int) $_POST['download_key'];
2692
  } else {
2693
+ $error = __( 'INVALID DOWNLOAD KEY', 'boldgrid-backup' );
2694
+ echo esc_html( $error );
2695
+ $log->add( $error );
2696
  wp_die();
2697
  }
2698
 
2700
  if ( ! empty( $_POST['download_filename'] ) ) {
2701
  $download_filename = sanitize_file_name( $_POST['download_filename'] );
2702
  } else {
2703
+ $error = __( 'INVALID DOWNLOAD FILENAME', 'boldgrid-backup' );
2704
+ echo esc_html( $error );
2705
+ $log->add( $error );
2706
  wp_die();
2707
  }
2708
 
2711
 
2712
  // Check WP_Filesystem method; ensure it is "direct".
2713
  if ( 'direct' !== $access_type ) {
2714
+ $error = __( 'WP_Filesystem method is not "direct"', 'boldgrid-backup' );
2715
+ echo esc_html( $error );
2716
+ $log->add( $error );
2717
  wp_die();
2718
  }
2719
 
2722
 
2723
  // If no files were found, then abort.
2724
  if ( empty( $archives ) ) {
2725
+ $error = __( 'NO BACKUP ARCHIVES FOUND', 'boldgrid-backup' );
2726
+ echo esc_html( $error );
2727
+ $log->add( $error );
2728
  wp_die();
2729
  }
2730
 
2736
 
2737
  // Verify filename.
2738
  if ( $download_filename !== $filename ) {
2739
+ $error = __( 'FILE NOT FOUND', 'boldgrid-backup' );
2740
+ echo esc_html( $error );
2741
+ $log->add( $error );
2742
  wp_die();
2743
  }
2744
 
2751
  }
2752
 
2753
  // Send the file and die nicely.
2754
+ $log->add( 'Request validated successfully. Now on to sending the file...' );
2755
  Boldgrid_Backup_File::send_file( $filepath, $filesize );
2756
  }
2757
 
cli/{verify-8722dbabe84e610a464f1cd4d92f42c0.php → verify-20790cb73f621b9334b9917d8a8e551c.php} RENAMED
File without changes
coverage.xml CHANGED
@@ -1,6 +1,6 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1613504104">
3
- <project timestamp="1613504104">
4
  <package name="Boldgrid\Backup\Admin\Card">
5
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/admin/card/class-amazon-s3.php">
6
  <class name="Amazon_S3" namespace="Boldgrid\Backup\Admin\Card" fullPackage="Amazon">
@@ -2724,7 +2724,7 @@
2724
  </file>
2725
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/admin/class-boldgrid-backup-admin-core.php">
2726
  <class name="Boldgrid_Backup_Admin_Core" namespace="global" fullPackage="Boldgrid.Backup.Admin">
2727
- <metrics complexity="236" methods="29" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="1136" coveredstatements="544" elements="1165" coveredelements="548"/>
2728
  </class>
2729
  <line num="600" type="method" name="__construct" visibility="public" complexity="8" crap="8.07" count="29"/>
2730
  <line num="605" type="stmt" count="29"/>
@@ -3686,219 +3686,236 @@
3686
  <line num="2659" type="stmt" count="0"/>
3687
  <line num="2660" type="stmt" count="0"/>
3688
  <line num="2672" type="method" name="download_archive_file_callback" visibility="public" complexity="10" crap="110" count="0"/>
 
3689
  <line num="2674" type="stmt" count="0"/>
3690
- <line num="2677" type="stmt" count="0"/>
3691
- <line num="2678" type="stmt" count="0"/>
3692
  <line num="2679" type="stmt" count="0"/>
3693
- <line num="2680" type="stmt" count="0"/>
3694
  <line num="2683" type="stmt" count="0"/>
3695
  <line num="2684" type="stmt" count="0"/>
3696
  <line num="2685" type="stmt" count="0"/>
3697
  <line num="2686" type="stmt" count="0"/>
3698
  <line num="2687" type="stmt" count="0"/>
 
3699
  <line num="2691" type="stmt" count="0"/>
3700
  <line num="2692" type="stmt" count="0"/>
3701
  <line num="2693" type="stmt" count="0"/>
3702
  <line num="2694" type="stmt" count="0"/>
3703
  <line num="2695" type="stmt" count="0"/>
3704
- <line num="2699" type="stmt" count="0"/>
 
 
3705
  <line num="2702" type="stmt" count="0"/>
3706
  <line num="2703" type="stmt" count="0"/>
3707
  <line num="2704" type="stmt" count="0"/>
3708
  <line num="2705" type="stmt" count="0"/>
3709
- <line num="2708" type="stmt" count="0"/>
3710
- <line num="2711" type="stmt" count="0"/>
3711
- <line num="2712" type="stmt" count="0"/>
3712
  <line num="2713" type="stmt" count="0"/>
3713
  <line num="2714" type="stmt" count="0"/>
 
 
 
3714
  <line num="2718" type="stmt" count="0"/>
3715
- <line num="2719" type="stmt" count="0"/>
3716
- <line num="2720" type="stmt" count="0"/>
3717
- <line num="2723" type="stmt" count="0"/>
3718
  <line num="2724" type="stmt" count="0"/>
3719
  <line num="2725" type="stmt" count="0"/>
3720
  <line num="2726" type="stmt" count="0"/>
 
3721
  <line num="2728" type="stmt" count="0"/>
3722
- <line num="2730" type="stmt" count="0"/>
3723
- <line num="2732" type="stmt" count="0"/>
3724
  <line num="2733" type="stmt" count="0"/>
3725
  <line num="2734" type="stmt" count="0"/>
3726
- <line num="2737" type="stmt" count="0"/>
3727
  <line num="2738" type="stmt" count="0"/>
3728
- <line num="2748" type="method" name="page_backup_test" visibility="public" complexity="6" crap="42" count="0"/>
 
 
 
 
 
 
 
3729
  <line num="2750" type="stmt" count="0"/>
3730
- <line num="2753" type="stmt" count="0"/>
 
 
3731
  <line num="2756" type="stmt" count="0"/>
3732
- <line num="2759" type="stmt" count="0"/>
3733
- <line num="2762" type="stmt" count="0"/>
3734
- <line num="2764" type="stmt" count="0"/>
3735
- <line num="2767" type="stmt" count="0"/>
3736
- <line num="2770" type="stmt" count="0"/>
3737
- <line num="2773" type="stmt" count="0"/>
3738
- <line num="2776" type="stmt" count="0"/>
3739
- <line num="2779" type="stmt" count="0"/>
3740
- <line num="2781" type="stmt" count="0"/>
3741
- <line num="2789" type="stmt" count="0"/>
3742
- <line num="2790" type="stmt" count="0"/>
3743
  <line num="2791" type="stmt" count="0"/>
3744
- <line num="2792" type="stmt" count="0"/>
3745
- <line num="2793" type="stmt" count="0"/>
3746
- <line num="2796" type="stmt" count="0"/>
3747
  <line num="2797" type="stmt" count="0"/>
3748
- <line num="2798" type="stmt" count="0"/>
3749
  <line num="2799" type="stmt" count="0"/>
3750
- <line num="2800" type="stmt" count="0"/>
3751
- <line num="2801" type="stmt" count="0"/>
3752
- <line num="2802" type="stmt" count="0"/>
3753
- <line num="2803" type="stmt" count="0"/>
3754
- <line num="2805" type="stmt" count="0"/>
3755
  <line num="2808" type="stmt" count="0"/>
3756
  <line num="2809" type="stmt" count="0"/>
3757
  <line num="2810" type="stmt" count="0"/>
3758
  <line num="2811" type="stmt" count="0"/>
3759
- <line num="2812" type="stmt" count="0"/>
3760
- <line num="2813" type="stmt" count="0"/>
3761
  <line num="2815" type="stmt" count="0"/>
3762
  <line num="2816" type="stmt" count="0"/>
3763
  <line num="2817" type="stmt" count="0"/>
 
3764
  <line num="2819" type="stmt" count="0"/>
3765
  <line num="2820" type="stmt" count="0"/>
3766
  <line num="2821" type="stmt" count="0"/>
3767
  <line num="2823" type="stmt" count="0"/>
3768
- <line num="2824" type="stmt" count="0"/>
3769
  <line num="2826" type="stmt" count="0"/>
3770
  <line num="2827" type="stmt" count="0"/>
3771
  <line num="2828" type="stmt" count="0"/>
 
 
 
 
 
3772
  <line num="2835" type="stmt" count="0"/>
3773
  <line num="2837" type="stmt" count="0"/>
3774
  <line num="2838" type="stmt" count="0"/>
3775
- <line num="2840" type="stmt" count="0"/>
 
 
 
3776
  <line num="2845" type="stmt" count="0"/>
3777
  <line num="2846" type="stmt" count="0"/>
3778
- <line num="2847" type="stmt" count="0"/>
3779
- <line num="2851" type="stmt" count="0"/>
3780
- <line num="2852" type="stmt" count="0"/>
3781
- <line num="2867" type="method" name="set_doing_cron" visibility="public" complexity="3" crap="3" count="29"/>
3782
- <line num="2868" type="stmt" count="29"/>
3783
- <line num="2869" type="stmt" count="29"/>
3784
- <line num="2876" type="method" name="set_lang" visibility="public" complexity="1" crap="1" count="29"/>
3785
- <line num="2881" type="stmt" count="29"/>
3786
- <line num="2883" type="stmt" count="29"/>
3787
- <line num="2884" type="stmt" count="29"/>
3788
- <line num="2885" type="stmt" count="29"/>
3789
  <line num="2886" type="stmt" count="29"/>
3790
  <line num="2887" type="stmt" count="29"/>
3791
- <line num="2888" type="stmt" count="29"/>
3792
- <line num="2890" type="stmt" count="29"/>
3793
- <line num="2891" type="stmt" count="29"/>
3794
- <line num="2893" type="stmt" count="29"/>
3795
- <line num="2894" type="stmt" count="29"/>
3796
- <line num="2895" type="stmt" count="29"/>
3797
- <line num="2896" type="stmt" count="29"/>
3798
- <line num="2897" type="stmt" count="29"/>
3799
- <line num="2898" type="stmt" count="29"/>
3800
- <line num="2900" type="stmt" count="29"/>
3801
  <line num="2901" type="stmt" count="29"/>
3802
  <line num="2902" type="stmt" count="29"/>
 
 
 
 
3803
  <line num="2908" type="stmt" count="29"/>
3804
- <line num="2910" type="stmt" count="29"/>
3805
  <line num="2911" type="stmt" count="29"/>
3806
  <line num="2912" type="stmt" count="29"/>
3807
  <line num="2913" type="stmt" count="29"/>
3808
  <line num="2914" type="stmt" count="29"/>
 
3809
  <line num="2916" type="stmt" count="29"/>
 
3810
  <line num="2919" type="stmt" count="29"/>
3811
  <line num="2920" type="stmt" count="29"/>
3812
- <line num="2922" type="stmt" count="29"/>
3813
- <line num="2924" type="stmt" count="29"/>
3814
- <line num="2936" type="method" name="set_time_limit" visibility="public" complexity="2" crap="2" count="4"/>
3815
- <line num="2937" type="stmt" count="4"/>
3816
- <line num="2939" type="stmt" count="4"/>
3817
- <line num="2940" type="stmt" count="4"/>
3818
- <line num="2947" type="method" name="wp_ajax_restore" visibility="public" complexity="6" crap="42" count="0"/>
3819
- <line num="2948" type="stmt" count="0"/>
3820
- <line num="2949" type="stmt" count="0"/>
3821
- <line num="2952" type="stmt" count="0"/>
3822
- <line num="2953" type="stmt" count="0"/>
3823
- <line num="2954" type="stmt" count="0"/>
3824
- <line num="2956" type="stmt" count="0"/>
3825
- <line num="2957" type="stmt" count="0"/>
3826
- <line num="2958" type="stmt" count="0"/>
3827
- <line num="2961" type="stmt" count="0"/>
3828
- <line num="2962" type="stmt" count="0"/>
3829
- <line num="2963" type="stmt" count="0"/>
3830
- <line num="2965" type="stmt" count="0"/>
3831
  <line num="2966" type="stmt" count="0"/>
3832
  <line num="2967" type="stmt" count="0"/>
3833
- <line num="2969" type="stmt" count="0"/>
3834
- <line num="2982" type="stmt" count="0"/>
 
 
 
 
 
 
 
3835
  <line num="2983" type="stmt" count="0"/>
 
3836
  <line num="2985" type="stmt" count="0"/>
3837
- <line num="2986" type="stmt" count="0"/>
3838
  <line num="2987" type="stmt" count="0"/>
3839
- <line num="2988" type="stmt" count="0"/>
3840
- <line num="2989" type="stmt" count="0"/>
3841
- <line num="2991" type="stmt" count="0"/>
3842
- <line num="2992" type="stmt" count="0"/>
3843
- <line num="2993" type="stmt" count="0"/>
3844
- <line num="2994" type="stmt" count="0"/>
3845
- <line num="2996" type="stmt" count="0"/>
3846
- <line num="2998" type="stmt" count="0"/>
3847
- <line num="2999" type="stmt" count="0"/>
3848
- <line num="3015" type="method" name="boldgrid_backup_now_auto" visibility="public" complexity="4" crap="20" count="0"/>
 
 
 
3849
  <line num="3017" type="stmt" count="0"/>
3850
- <line num="3019" type="stmt" count="0"/>
3851
- <line num="3020" type="stmt" count="0"/>
3852
- <line num="3024" type="stmt" count="0"/>
3853
- <line num="3027" type="stmt" count="0"/>
3854
- <line num="3028" type="stmt" count="0"/>
3855
- <line num="3032" type="stmt" count="0"/>
3856
- <line num="3033" type="stmt" count="0"/>
3857
- <line num="3044" type="method" name="enforce_retention" visibility="public" complexity="8" crap="8.07" count="4"/>
3858
- <line num="3045" type="stmt" count="4"/>
3859
- <line num="3046" type="stmt" count="4"/>
3860
- <line num="3047" type="stmt" count="4"/>
3861
- <line num="3049" type="stmt" count="4"/>
3862
- <line num="3050" type="stmt" count="4"/>
3863
- <line num="3052" type="stmt" count="4"/>
3864
- <line num="3053" type="stmt" count="4"/>
3865
- <line num="3056" type="stmt" count="4"/>
3866
- <line num="3057" type="stmt" count="4"/>
3867
- <line num="3058" type="stmt" count="4"/>
3868
- <line num="3059" type="stmt" count="4"/>
3869
- <line num="3060" type="stmt" count="0"/>
3870
- <line num="3061" type="stmt" count="0"/>
3871
- <line num="3062" type="stmt" count="0"/>
3872
  <line num="3063" type="stmt" count="4"/>
3873
  <line num="3064" type="stmt" count="4"/>
3874
  <line num="3065" type="stmt" count="4"/>
 
3875
  <line num="3068" type="stmt" count="4"/>
 
3876
  <line num="3071" type="stmt" count="4"/>
3877
- <line num="3072" type="stmt" count="4"/>
3878
- <line num="3073" type="stmt" count="4"/>
3879
- <line num="3077" type="stmt" count="1"/>
3880
- <line num="3080" type="stmt" count="1"/>
3881
- <line num="3083" type="stmt" count="1"/>
3882
- <line num="3084" type="stmt" count="1"/>
3883
- <line num="3085" type="stmt" count="1"/>
3884
- <line num="3088" type="stmt" count="1"/>
3885
- <line num="3091" type="stmt" count="1"/>
3886
- <line num="3094" type="stmt" count="1"/>
3887
- <line num="3096" type="stmt" count="1"/>
3888
- <line num="3097" type="stmt" count="1"/>
 
 
 
 
 
 
 
3889
  <line num="3106" type="stmt" count="1"/>
3890
- <line num="3107" type="stmt" count="1"/>
3891
- <line num="3108" type="stmt" count="0"/>
3892
- <line num="3110" type="stmt" count="1"/>
3893
  <line num="3112" type="stmt" count="1"/>
3894
- <line num="3113" type="stmt" count="1"/>
3895
  <line num="3114" type="stmt" count="1"/>
3896
- <line num="3121" type="method" name="add_thickbox" visibility="public" complexity="2" crap="6" count="0"/>
3897
- <line num="3122" type="stmt" count="0"/>
3898
- <line num="3123" type="stmt" count="0"/>
3899
- <line num="3124" type="stmt" count="0"/>
3900
- <line num="3125" type="stmt" count="0"/>
3901
- <metrics loc="3126" ncloc="1631" classes="1" methods="29" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="1143" coveredstatements="544" elements="1172" coveredelements="548"/>
 
 
 
 
 
 
 
 
3902
  </file>
3903
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/admin/class-boldgrid-backup-admin-cron-log.php">
3904
  <class name="Boldgrid_Backup_Admin_Cron_Log" namespace="global" fullPackage="Boldgrid.Backup.Admin.Cron">
@@ -15494,40 +15511,64 @@
15494
  </file>
15495
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/includes/class-boldgrid-backup-file.php">
15496
  <class name="Boldgrid_Backup_File" namespace="global" fullPackage="Boldgrid.Backup">
15497
- <metrics complexity="7" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="30" coveredstatements="0" elements="31" coveredelements="0"/>
15498
  </class>
15499
- <line num="32" type="method" name="send_file" visibility="public" complexity="7" crap="56" count="0"/>
15500
  <line num="33" type="stmt" count="0"/>
15501
  <line num="34" type="stmt" count="0"/>
 
15502
  <line num="36" type="stmt" count="0"/>
15503
- <line num="37" type="stmt" count="0"/>
15504
  <line num="38" type="stmt" count="0"/>
 
15505
  <line num="40" type="stmt" count="0"/>
15506
- <line num="42" type="stmt" count="0"/>
15507
  <line num="43" type="stmt" count="0"/>
15508
- <line num="44" type="stmt" count="0"/>
 
15509
  <line num="47" type="stmt" count="0"/>
15510
- <line num="48" type="stmt" count="0"/>
15511
- <line num="49" type="stmt" count="0"/>
15512
  <line num="50" type="stmt" count="0"/>
 
 
15513
  <line num="53" type="stmt" count="0"/>
15514
  <line num="54" type="stmt" count="0"/>
15515
- <line num="55" type="stmt" count="0"/>
 
 
 
15516
  <line num="61" type="stmt" count="0"/>
15517
- <line num="64" type="stmt" count="0"/>
15518
- <line num="76" type="stmt" count="0"/>
15519
- <line num="79" type="stmt" count="0"/>
15520
- <line num="80" type="stmt" count="0"/>
15521
- <line num="81" type="stmt" count="0"/>
15522
- <line num="82" type="stmt" count="0"/>
15523
- <line num="85" type="stmt" count="0"/>
15524
  <line num="86" type="stmt" count="0"/>
15525
  <line num="87" type="stmt" count="0"/>
15526
  <line num="88" type="stmt" count="0"/>
 
15527
  <line num="90" type="stmt" count="0"/>
15528
- <line num="92" type="stmt" count="0"/>
15529
  <line num="93" type="stmt" count="0"/>
15530
- <metrics loc="94" ncloc="34" classes="1" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="30" coveredstatements="0" elements="31" coveredelements="0"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15531
  </file>
15532
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/includes/class-boldgrid-backup-i18n.php">
15533
  <class name="Boldgrid_Backup_I18n" namespace="global" fullPackage="Boldgrid.Backup">
@@ -77077,7 +77118,7 @@
77077
  <metrics loc="445" ncloc="281" classes="1" methods="21" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="216" coveredstatements="0" elements="237" coveredelements="0"/>
77078
  </file>
77079
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/vendor/composer/autoload_static.php">
77080
- <class name="ComposerStaticInit32d4cd09e587793b876fe3c5becc355c" namespace="Composer\Autoload">
77081
  <metrics complexity="2" methods="2" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="5" coveredstatements="0" elements="7" coveredelements="0"/>
77082
  </class>
77083
  <line num="91" type="method" name="getInitializer" visibility="public" complexity="1" crap="2" count="0"/>
@@ -77169,7 +77210,7 @@
77169
  <metrics loc="12" ncloc="10" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="7" coveredstatements="0" elements="7" coveredelements="0"/>
77170
  </file>
77171
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/vendor/composer/autoload_real.php">
77172
- <class name="ComposerAutoloaderInit32d4cd09e587793b876fe3c5becc355c" namespace="global">
77173
  <metrics complexity="13" methods="2" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="41" coveredstatements="0" elements="43" coveredelements="0"/>
77174
  </class>
77175
  <line num="9" type="method" name="loadClassLoader" visibility="public" complexity="2" crap="6" count="0"/>
@@ -96414,6 +96455,6 @@
96414
  <line num="16" type="stmt" count="0"/>
96415
  <metrics loc="16" ncloc="9" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="0" elements="8" coveredelements="0"/>
96416
  </file>
96417
- <metrics files="964" loc="193774" ncloc="118066" classes="872" methods="3606" coveredmethods="311" conditionals="0" coveredconditionals="0" statements="86885" coveredstatements="4602" elements="90491" coveredelements="4913"/>
96418
  </project>
96419
  </coverage>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <coverage generated="1616684211">
3
+ <project timestamp="1616684211">
4
  <package name="Boldgrid\Backup\Admin\Card">
5
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/admin/card/class-amazon-s3.php">
6
  <class name="Amazon_S3" namespace="Boldgrid\Backup\Admin\Card" fullPackage="Amazon">
2724
  </file>
2725
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/admin/class-boldgrid-backup-admin-core.php">
2726
  <class name="Boldgrid_Backup_Admin_Core" namespace="global" fullPackage="Boldgrid.Backup.Admin">
2727
+ <metrics complexity="236" methods="29" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="1153" coveredstatements="544" elements="1182" coveredelements="548"/>
2728
  </class>
2729
  <line num="600" type="method" name="__construct" visibility="public" complexity="8" crap="8.07" count="29"/>
2730
  <line num="605" type="stmt" count="29"/>
3686
  <line num="2659" type="stmt" count="0"/>
3687
  <line num="2660" type="stmt" count="0"/>
3688
  <line num="2672" type="method" name="download_archive_file_callback" visibility="public" complexity="10" crap="110" count="0"/>
3689
+ <line num="2673" type="stmt" count="0"/>
3690
  <line num="2674" type="stmt" count="0"/>
3691
+ <line num="2675" type="stmt" count="0"/>
3692
+ <line num="2676" type="stmt" count="0"/>
3693
  <line num="2679" type="stmt" count="0"/>
3694
+ <line num="2682" type="stmt" count="0"/>
3695
  <line num="2683" type="stmt" count="0"/>
3696
  <line num="2684" type="stmt" count="0"/>
3697
  <line num="2685" type="stmt" count="0"/>
3698
  <line num="2686" type="stmt" count="0"/>
3699
  <line num="2687" type="stmt" count="0"/>
3700
+ <line num="2690" type="stmt" count="0"/>
3701
  <line num="2691" type="stmt" count="0"/>
3702
  <line num="2692" type="stmt" count="0"/>
3703
  <line num="2693" type="stmt" count="0"/>
3704
  <line num="2694" type="stmt" count="0"/>
3705
  <line num="2695" type="stmt" count="0"/>
3706
+ <line num="2696" type="stmt" count="0"/>
3707
+ <line num="2700" type="stmt" count="0"/>
3708
+ <line num="2701" type="stmt" count="0"/>
3709
  <line num="2702" type="stmt" count="0"/>
3710
  <line num="2703" type="stmt" count="0"/>
3711
  <line num="2704" type="stmt" count="0"/>
3712
  <line num="2705" type="stmt" count="0"/>
3713
+ <line num="2706" type="stmt" count="0"/>
3714
+ <line num="2710" type="stmt" count="0"/>
 
3715
  <line num="2713" type="stmt" count="0"/>
3716
  <line num="2714" type="stmt" count="0"/>
3717
+ <line num="2715" type="stmt" count="0"/>
3718
+ <line num="2716" type="stmt" count="0"/>
3719
+ <line num="2717" type="stmt" count="0"/>
3720
  <line num="2718" type="stmt" count="0"/>
3721
+ <line num="2721" type="stmt" count="0"/>
 
 
3722
  <line num="2724" type="stmt" count="0"/>
3723
  <line num="2725" type="stmt" count="0"/>
3724
  <line num="2726" type="stmt" count="0"/>
3725
+ <line num="2727" type="stmt" count="0"/>
3726
  <line num="2728" type="stmt" count="0"/>
3727
+ <line num="2729" type="stmt" count="0"/>
 
3728
  <line num="2733" type="stmt" count="0"/>
3729
  <line num="2734" type="stmt" count="0"/>
3730
+ <line num="2735" type="stmt" count="0"/>
3731
  <line num="2738" type="stmt" count="0"/>
3732
+ <line num="2739" type="stmt" count="0"/>
3733
+ <line num="2740" type="stmt" count="0"/>
3734
+ <line num="2741" type="stmt" count="0"/>
3735
+ <line num="2742" type="stmt" count="0"/>
3736
+ <line num="2743" type="stmt" count="0"/>
3737
+ <line num="2745" type="stmt" count="0"/>
3738
+ <line num="2747" type="stmt" count="0"/>
3739
+ <line num="2749" type="stmt" count="0"/>
3740
  <line num="2750" type="stmt" count="0"/>
3741
+ <line num="2751" type="stmt" count="0"/>
3742
+ <line num="2754" type="stmt" count="0"/>
3743
+ <line num="2755" type="stmt" count="0"/>
3744
  <line num="2756" type="stmt" count="0"/>
3745
+ <line num="2766" type="method" name="page_backup_test" visibility="public" complexity="6" crap="42" count="0"/>
3746
+ <line num="2768" type="stmt" count="0"/>
3747
+ <line num="2771" type="stmt" count="0"/>
3748
+ <line num="2774" type="stmt" count="0"/>
3749
+ <line num="2777" type="stmt" count="0"/>
3750
+ <line num="2780" type="stmt" count="0"/>
3751
+ <line num="2782" type="stmt" count="0"/>
3752
+ <line num="2785" type="stmt" count="0"/>
3753
+ <line num="2788" type="stmt" count="0"/>
 
 
3754
  <line num="2791" type="stmt" count="0"/>
3755
+ <line num="2794" type="stmt" count="0"/>
 
 
3756
  <line num="2797" type="stmt" count="0"/>
 
3757
  <line num="2799" type="stmt" count="0"/>
3758
+ <line num="2807" type="stmt" count="0"/>
 
 
 
 
3759
  <line num="2808" type="stmt" count="0"/>
3760
  <line num="2809" type="stmt" count="0"/>
3761
  <line num="2810" type="stmt" count="0"/>
3762
  <line num="2811" type="stmt" count="0"/>
3763
+ <line num="2814" type="stmt" count="0"/>
 
3764
  <line num="2815" type="stmt" count="0"/>
3765
  <line num="2816" type="stmt" count="0"/>
3766
  <line num="2817" type="stmt" count="0"/>
3767
+ <line num="2818" type="stmt" count="0"/>
3768
  <line num="2819" type="stmt" count="0"/>
3769
  <line num="2820" type="stmt" count="0"/>
3770
  <line num="2821" type="stmt" count="0"/>
3771
  <line num="2823" type="stmt" count="0"/>
 
3772
  <line num="2826" type="stmt" count="0"/>
3773
  <line num="2827" type="stmt" count="0"/>
3774
  <line num="2828" type="stmt" count="0"/>
3775
+ <line num="2829" type="stmt" count="0"/>
3776
+ <line num="2830" type="stmt" count="0"/>
3777
+ <line num="2831" type="stmt" count="0"/>
3778
+ <line num="2833" type="stmt" count="0"/>
3779
+ <line num="2834" type="stmt" count="0"/>
3780
  <line num="2835" type="stmt" count="0"/>
3781
  <line num="2837" type="stmt" count="0"/>
3782
  <line num="2838" type="stmt" count="0"/>
3783
+ <line num="2839" type="stmt" count="0"/>
3784
+ <line num="2841" type="stmt" count="0"/>
3785
+ <line num="2842" type="stmt" count="0"/>
3786
+ <line num="2844" type="stmt" count="0"/>
3787
  <line num="2845" type="stmt" count="0"/>
3788
  <line num="2846" type="stmt" count="0"/>
3789
+ <line num="2853" type="stmt" count="0"/>
3790
+ <line num="2855" type="stmt" count="0"/>
3791
+ <line num="2856" type="stmt" count="0"/>
3792
+ <line num="2858" type="stmt" count="0"/>
3793
+ <line num="2863" type="stmt" count="0"/>
3794
+ <line num="2864" type="stmt" count="0"/>
3795
+ <line num="2865" type="stmt" count="0"/>
3796
+ <line num="2869" type="stmt" count="0"/>
3797
+ <line num="2870" type="stmt" count="0"/>
3798
+ <line num="2885" type="method" name="set_doing_cron" visibility="public" complexity="3" crap="3" count="29"/>
 
3799
  <line num="2886" type="stmt" count="29"/>
3800
  <line num="2887" type="stmt" count="29"/>
3801
+ <line num="2894" type="method" name="set_lang" visibility="public" complexity="1" crap="1" count="29"/>
3802
+ <line num="2899" type="stmt" count="29"/>
 
 
 
 
 
 
 
 
3803
  <line num="2901" type="stmt" count="29"/>
3804
  <line num="2902" type="stmt" count="29"/>
3805
+ <line num="2903" type="stmt" count="29"/>
3806
+ <line num="2904" type="stmt" count="29"/>
3807
+ <line num="2905" type="stmt" count="29"/>
3808
+ <line num="2906" type="stmt" count="29"/>
3809
  <line num="2908" type="stmt" count="29"/>
3810
+ <line num="2909" type="stmt" count="29"/>
3811
  <line num="2911" type="stmt" count="29"/>
3812
  <line num="2912" type="stmt" count="29"/>
3813
  <line num="2913" type="stmt" count="29"/>
3814
  <line num="2914" type="stmt" count="29"/>
3815
+ <line num="2915" type="stmt" count="29"/>
3816
  <line num="2916" type="stmt" count="29"/>
3817
+ <line num="2918" type="stmt" count="29"/>
3818
  <line num="2919" type="stmt" count="29"/>
3819
  <line num="2920" type="stmt" count="29"/>
3820
+ <line num="2926" type="stmt" count="29"/>
3821
+ <line num="2928" type="stmt" count="29"/>
3822
+ <line num="2929" type="stmt" count="29"/>
3823
+ <line num="2930" type="stmt" count="29"/>
3824
+ <line num="2931" type="stmt" count="29"/>
3825
+ <line num="2932" type="stmt" count="29"/>
3826
+ <line num="2934" type="stmt" count="29"/>
3827
+ <line num="2937" type="stmt" count="29"/>
3828
+ <line num="2938" type="stmt" count="29"/>
3829
+ <line num="2940" type="stmt" count="29"/>
3830
+ <line num="2942" type="stmt" count="29"/>
3831
+ <line num="2954" type="method" name="set_time_limit" visibility="public" complexity="2" crap="2" count="4"/>
3832
+ <line num="2955" type="stmt" count="4"/>
3833
+ <line num="2957" type="stmt" count="4"/>
3834
+ <line num="2958" type="stmt" count="4"/>
3835
+ <line num="2965" type="method" name="wp_ajax_restore" visibility="public" complexity="6" crap="42" count="0"/>
 
 
 
3836
  <line num="2966" type="stmt" count="0"/>
3837
  <line num="2967" type="stmt" count="0"/>
3838
+ <line num="2970" type="stmt" count="0"/>
3839
+ <line num="2971" type="stmt" count="0"/>
3840
+ <line num="2972" type="stmt" count="0"/>
3841
+ <line num="2974" type="stmt" count="0"/>
3842
+ <line num="2975" type="stmt" count="0"/>
3843
+ <line num="2976" type="stmt" count="0"/>
3844
+ <line num="2979" type="stmt" count="0"/>
3845
+ <line num="2980" type="stmt" count="0"/>
3846
+ <line num="2981" type="stmt" count="0"/>
3847
  <line num="2983" type="stmt" count="0"/>
3848
+ <line num="2984" type="stmt" count="0"/>
3849
  <line num="2985" type="stmt" count="0"/>
 
3850
  <line num="2987" type="stmt" count="0"/>
3851
+ <line num="3000" type="stmt" count="0"/>
3852
+ <line num="3001" type="stmt" count="0"/>
3853
+ <line num="3003" type="stmt" count="0"/>
3854
+ <line num="3004" type="stmt" count="0"/>
3855
+ <line num="3005" type="stmt" count="0"/>
3856
+ <line num="3006" type="stmt" count="0"/>
3857
+ <line num="3007" type="stmt" count="0"/>
3858
+ <line num="3009" type="stmt" count="0"/>
3859
+ <line num="3010" type="stmt" count="0"/>
3860
+ <line num="3011" type="stmt" count="0"/>
3861
+ <line num="3012" type="stmt" count="0"/>
3862
+ <line num="3014" type="stmt" count="0"/>
3863
+ <line num="3016" type="stmt" count="0"/>
3864
  <line num="3017" type="stmt" count="0"/>
3865
+ <line num="3033" type="method" name="boldgrid_backup_now_auto" visibility="public" complexity="4" crap="20" count="0"/>
3866
+ <line num="3035" type="stmt" count="0"/>
3867
+ <line num="3037" type="stmt" count="0"/>
3868
+ <line num="3038" type="stmt" count="0"/>
3869
+ <line num="3042" type="stmt" count="0"/>
3870
+ <line num="3045" type="stmt" count="0"/>
3871
+ <line num="3046" type="stmt" count="0"/>
3872
+ <line num="3050" type="stmt" count="0"/>
3873
+ <line num="3051" type="stmt" count="0"/>
3874
+ <line num="3062" type="method" name="enforce_retention" visibility="public" complexity="8" crap="8.07" count="4"/>
 
 
 
 
 
 
 
 
 
 
 
 
3875
  <line num="3063" type="stmt" count="4"/>
3876
  <line num="3064" type="stmt" count="4"/>
3877
  <line num="3065" type="stmt" count="4"/>
3878
+ <line num="3067" type="stmt" count="4"/>
3879
  <line num="3068" type="stmt" count="4"/>
3880
+ <line num="3070" type="stmt" count="4"/>
3881
  <line num="3071" type="stmt" count="4"/>
3882
+ <line num="3074" type="stmt" count="4"/>
3883
+ <line num="3075" type="stmt" count="4"/>
3884
+ <line num="3076" type="stmt" count="4"/>
3885
+ <line num="3077" type="stmt" count="4"/>
3886
+ <line num="3078" type="stmt" count="0"/>
3887
+ <line num="3079" type="stmt" count="0"/>
3888
+ <line num="3080" type="stmt" count="0"/>
3889
+ <line num="3081" type="stmt" count="4"/>
3890
+ <line num="3082" type="stmt" count="4"/>
3891
+ <line num="3083" type="stmt" count="4"/>
3892
+ <line num="3086" type="stmt" count="4"/>
3893
+ <line num="3089" type="stmt" count="4"/>
3894
+ <line num="3090" type="stmt" count="4"/>
3895
+ <line num="3091" type="stmt" count="4"/>
3896
+ <line num="3095" type="stmt" count="1"/>
3897
+ <line num="3098" type="stmt" count="1"/>
3898
+ <line num="3101" type="stmt" count="1"/>
3899
+ <line num="3102" type="stmt" count="1"/>
3900
+ <line num="3103" type="stmt" count="1"/>
3901
  <line num="3106" type="stmt" count="1"/>
3902
+ <line num="3109" type="stmt" count="1"/>
 
 
3903
  <line num="3112" type="stmt" count="1"/>
 
3904
  <line num="3114" type="stmt" count="1"/>
3905
+ <line num="3115" type="stmt" count="1"/>
3906
+ <line num="3124" type="stmt" count="1"/>
3907
+ <line num="3125" type="stmt" count="1"/>
3908
+ <line num="3126" type="stmt" count="0"/>
3909
+ <line num="3128" type="stmt" count="1"/>
3910
+ <line num="3130" type="stmt" count="1"/>
3911
+ <line num="3131" type="stmt" count="1"/>
3912
+ <line num="3132" type="stmt" count="1"/>
3913
+ <line num="3139" type="method" name="add_thickbox" visibility="public" complexity="2" crap="6" count="0"/>
3914
+ <line num="3140" type="stmt" count="0"/>
3915
+ <line num="3141" type="stmt" count="0"/>
3916
+ <line num="3142" type="stmt" count="0"/>
3917
+ <line num="3143" type="stmt" count="0"/>
3918
+ <metrics loc="3144" ncloc="1649" classes="1" methods="29" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="1160" coveredstatements="544" elements="1189" coveredelements="548"/>
3919
  </file>
3920
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/admin/class-boldgrid-backup-admin-cron-log.php">
3921
  <class name="Boldgrid_Backup_Admin_Cron_Log" namespace="global" fullPackage="Boldgrid.Backup.Admin.Cron">
15511
  </file>
15512
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/includes/class-boldgrid-backup-file.php">
15513
  <class name="Boldgrid_Backup_File" namespace="global" fullPackage="Boldgrid.Backup">
15514
+ <metrics complexity="8" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="54" coveredstatements="0" elements="55" coveredelements="0"/>
15515
  </class>
15516
+ <line num="32" type="method" name="send_file" visibility="public" complexity="8" crap="72" count="0"/>
15517
  <line num="33" type="stmt" count="0"/>
15518
  <line num="34" type="stmt" count="0"/>
15519
+ <line num="35" type="stmt" count="0"/>
15520
  <line num="36" type="stmt" count="0"/>
 
15521
  <line num="38" type="stmt" count="0"/>
15522
+ <line num="39" type="stmt" count="0"/>
15523
  <line num="40" type="stmt" count="0"/>
15524
+ <line num="41" type="stmt" count="0"/>
15525
  <line num="43" type="stmt" count="0"/>
15526
+ <line num="45" type="stmt" count="0"/>
15527
+ <line num="46" type="stmt" count="0"/>
15528
  <line num="47" type="stmt" count="0"/>
 
 
15529
  <line num="50" type="stmt" count="0"/>
15530
+ <line num="51" type="stmt" count="0"/>
15531
+ <line num="52" type="stmt" count="0"/>
15532
  <line num="53" type="stmt" count="0"/>
15533
  <line num="54" type="stmt" count="0"/>
15534
+ <line num="57" type="stmt" count="0"/>
15535
+ <line num="58" type="stmt" count="0"/>
15536
+ <line num="59" type="stmt" count="0"/>
15537
+ <line num="60" type="stmt" count="0"/>
15538
  <line num="61" type="stmt" count="0"/>
15539
+ <line num="62" type="stmt" count="0"/>
15540
+ <line num="68" type="stmt" count="0"/>
15541
+ <line num="71" type="stmt" count="0"/>
15542
+ <line num="83" type="stmt" count="0"/>
 
 
 
15543
  <line num="86" type="stmt" count="0"/>
15544
  <line num="87" type="stmt" count="0"/>
15545
  <line num="88" type="stmt" count="0"/>
15546
+ <line num="89" type="stmt" count="0"/>
15547
  <line num="90" type="stmt" count="0"/>
 
15548
  <line num="93" type="stmt" count="0"/>
15549
+ <line num="94" type="stmt" count="0"/>
15550
+ <line num="95" type="stmt" count="0"/>
15551
+ <line num="96" type="stmt" count="0"/>
15552
+ <line num="97" type="stmt" count="0"/>
15553
+ <line num="98" type="stmt" count="0"/>
15554
+ <line num="99" type="stmt" count="0"/>
15555
+ <line num="100" type="stmt" count="0"/>
15556
+ <line num="102" type="stmt" count="0"/>
15557
+ <line num="103" type="stmt" count="0"/>
15558
+ <line num="104" type="stmt" count="0"/>
15559
+ <line num="105" type="stmt" count="0"/>
15560
+ <line num="106" type="stmt" count="0"/>
15561
+ <line num="107" type="stmt" count="0"/>
15562
+ <line num="108" type="stmt" count="0"/>
15563
+ <line num="110" type="stmt" count="0"/>
15564
+ <line num="111" type="stmt" count="0"/>
15565
+ <line num="112" type="stmt" count="0"/>
15566
+ <line num="113" type="stmt" count="0"/>
15567
+ <line num="114" type="stmt" count="0"/>
15568
+ <line num="117" type="stmt" count="0"/>
15569
+ <line num="118" type="stmt" count="0"/>
15570
+ <line num="119" type="stmt" count="0"/>
15571
+ <metrics loc="120" ncloc="60" classes="1" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="54" coveredstatements="0" elements="55" coveredelements="0"/>
15572
  </file>
15573
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/includes/class-boldgrid-backup-i18n.php">
15574
  <class name="Boldgrid_Backup_I18n" namespace="global" fullPackage="Boldgrid.Backup">
77118
  <metrics loc="445" ncloc="281" classes="1" methods="21" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="216" coveredstatements="0" elements="237" coveredelements="0"/>
77119
  </file>
77120
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/vendor/composer/autoload_static.php">
77121
+ <class name="ComposerStaticInit681fe027f69d020ee147a0b297a454ab" namespace="Composer\Autoload">
77122
  <metrics complexity="2" methods="2" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="5" coveredstatements="0" elements="7" coveredelements="0"/>
77123
  </class>
77124
  <line num="91" type="method" name="getInitializer" visibility="public" complexity="1" crap="2" count="0"/>
77210
  <metrics loc="12" ncloc="10" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="7" coveredstatements="0" elements="7" coveredelements="0"/>
77211
  </file>
77212
  <file name="/home/travis/build/BoldGrid/boldgrid-backup/vendor/composer/autoload_real.php">
77213
+ <class name="ComposerAutoloaderInit681fe027f69d020ee147a0b297a454ab" namespace="global">
77214
  <metrics complexity="13" methods="2" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="41" coveredstatements="0" elements="43" coveredelements="0"/>
77215
  </class>
77216
  <line num="9" type="method" name="loadClassLoader" visibility="public" complexity="2" crap="6" count="0"/>
96455
  <line num="16" type="stmt" count="0"/>
96456
  <metrics loc="16" ncloc="9" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="0" elements="8" coveredelements="0"/>
96457
  </file>
96458
+ <metrics files="964" loc="193818" ncloc="118110" classes="872" methods="3606" coveredmethods="311" conditionals="0" coveredconditionals="0" statements="86926" coveredstatements="4602" elements="90532" coveredelements="4913"/>
96459
  </project>
96460
  </coverage>
includes/class-boldgrid-backup-file.php CHANGED
@@ -30,27 +30,34 @@ class Boldgrid_Backup_File {
30
  * @param int $filesize File size (optional).
31
  */
32
  public static function send_file( $filepath, $filesize = null ) {
33
- WP_Filesystem();
34
- global $wp_filesystem;
 
 
35
 
36
- if ( empty( $filepath ) || ! $wp_filesystem->exists( $filepath ) ) {
 
37
  wp_redirect( get_site_url(), 404 );
38
  }
39
 
40
  $filename = basename( $filepath );
41
 
42
  if ( empty( $filesize ) ) {
43
- $filesize = $wp_filesystem->size( $filepath );
44
  }
45
 
46
  // Send header.
 
47
  header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
48
  header( 'Content-Transfer-Encoding: binary' );
49
  header( 'Content-Type: binary/octet-stream' );
50
  header( 'Content-Length: ' . $filesize );
51
 
52
  // Check and flush output buffer if needed.
53
- if ( 0 !== ob_get_level() ) {
 
 
 
54
  ob_end_flush();
55
  }
56
 
@@ -78,17 +85,36 @@ class Boldgrid_Backup_File {
78
  // If we can't open the file, abort.
79
  $handle = fopen( $filepath, 'rb' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
80
  if ( false === $handle ) {
 
81
  wp_die();
82
  }
83
 
84
  // Loop through the file and send it 1MB at a time.
 
 
85
  while ( ! feof( $handle ) ) {
86
- $buffer = fread( $handle, 1024 * 1024 ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fread
 
 
 
 
 
 
 
87
  echo $buffer; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
 
 
88
  }
 
89
 
90
- fclose( $handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
 
 
 
 
 
91
 
 
92
  wp_die();
93
  }
94
  }
30
  * @param int $filesize File size (optional).
31
  */
32
  public static function send_file( $filepath, $filesize = null ) {
33
+ $core = apply_filters( 'boldgrid_backup_get_core', null );
34
+ $log = new Boldgrid_Backup_Admin_Log( $core );
35
+ $log->init( 'backup-download.log' );
36
+ $log->add( 'Initializing send_file() method...' );
37
 
38
+ if ( empty( $filepath ) || ! $core->wp_filesystem->exists( $filepath ) ) {
39
+ $log->add( 'Invalid filepath.' );
40
  wp_redirect( get_site_url(), 404 );
41
  }
42
 
43
  $filename = basename( $filepath );
44
 
45
  if ( empty( $filesize ) ) {
46
+ $filesize = $core->wp_filesystem->size( $filepath );
47
  }
48
 
49
  // Send header.
50
+ $log->add( 'Sending headers...' );
51
  header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
52
  header( 'Content-Transfer-Encoding: binary' );
53
  header( 'Content-Type: binary/octet-stream' );
54
  header( 'Content-Length: ' . $filesize );
55
 
56
  // Check and flush output buffer if needed.
57
+ $ob_level = ob_get_level();
58
+ $log->add( 'Output buffering level: ' . $ob_level );
59
+ if ( 0 !== $ob_level ) {
60
+ $log->add( 'Calling ob_end_flush().' );
61
  ob_end_flush();
62
  }
63
 
85
  // If we can't open the file, abort.
86
  $handle = fopen( $filepath, 'rb' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
87
  if ( false === $handle ) {
88
+ $log->add( 'Invalid handle. fopen failed.' );
89
  wp_die();
90
  }
91
 
92
  // Loop through the file and send it 1MB at a time.
93
+ $buffer_size = 1024 * 1024;
94
+ $log->add( 'Beginnig to send file... Buffer size: ' . size_format( $buffer_size, 2 ) );
95
  while ( ! feof( $handle ) ) {
96
+ $log->add( 'Reading buffer...' );
97
+ $time_start = microtime( true );
98
+ $buffer = fread( $handle, $buffer_size ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fread
99
+ $duration = microtime( true ) - $time_start;
100
+ $log->add( 'Buffer read in ' . round( $duration, 4 ) . ' seconds.' );
101
+
102
+ $log->add( 'Sending buffer...' );
103
+ $time_start = microtime( true );
104
  echo $buffer; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
105
+ $duration = microtime( true ) - $time_start;
106
+ $log->add( 'Buffer sent in ' . round( $duration, 4 ) . ' seconds.' );
107
  }
108
+ $log->add( 'Finished sending file.' );
109
 
110
+ $log->add( 'Closing file...' );
111
+ if ( fclose( $handle ) ) { // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
112
+ $log->add( 'File closed successfully.' );
113
+ } else {
114
+ $log->add( 'Error closing file.' );
115
+ }
116
 
117
+ $log->add( 'send_file() method complete. Ending with wp_die().' );
118
  wp_die();
119
  }
120
  }
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: boldgrid, joemoto, imh_brad, rramo012, bgnicolepaschen, jamesros161
3
  Tags: backup, cloud backup, database backup, restore, wordpress backup
4
  Requires at least: 4.4
5
- Tested up to: 5.7
6
  Requires PHP: 5.4
7
  Stable tag: 1.14.11
8
  License: GPLv2 or later
2
  Contributors: boldgrid, joemoto, imh_brad, rramo012, bgnicolepaschen, jamesros161
3
  Tags: backup, cloud backup, database backup, restore, wordpress backup
4
  Requires at least: 4.4
5
+ Tested up to: 5.6
6
  Requires PHP: 5.4
7
  Stable tag: 1.14.11
8
  License: GPLv2 or later
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit32d4cd09e587793b876fe3c5becc355c::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit681fe027f69d020ee147a0b297a454ab::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit32d4cd09e587793b876fe3c5becc355c
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit32d4cd09e587793b876fe3c5becc355c
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit32d4cd09e587793b876fe3c5becc355c', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit32d4cd09e587793b876fe3c5becc355c', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit32d4cd09e587793b876fe3c5becc355c::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit32d4cd09e587793b876fe3c5becc355c
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit32d4cd09e587793b876fe3c5becc355c::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire32d4cd09e587793b876fe3c5becc355c($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire32d4cd09e587793b876fe3c5becc355c($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit681fe027f69d020ee147a0b297a454ab
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit681fe027f69d020ee147a0b297a454ab', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit681fe027f69d020ee147a0b297a454ab', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit681fe027f69d020ee147a0b297a454ab::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit681fe027f69d020ee147a0b297a454ab::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire681fe027f69d020ee147a0b297a454ab($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire681fe027f69d020ee147a0b297a454ab($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit32d4cd09e587793b876fe3c5becc355c
8
  {
9
  public static $files = array (
10
  'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
@@ -91,9 +91,9 @@ class ComposerStaticInit32d4cd09e587793b876fe3c5becc355c
91
  public static function getInitializer(ClassLoader $loader)
92
  {
93
  return \Closure::bind(function () use ($loader) {
94
- $loader->prefixLengthsPsr4 = ComposerStaticInit32d4cd09e587793b876fe3c5becc355c::$prefixLengthsPsr4;
95
- $loader->prefixDirsPsr4 = ComposerStaticInit32d4cd09e587793b876fe3c5becc355c::$prefixDirsPsr4;
96
- $loader->classMap = ComposerStaticInit32d4cd09e587793b876fe3c5becc355c::$classMap;
97
 
98
  }, null, ClassLoader::class);
99
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit681fe027f69d020ee147a0b297a454ab
8
  {
9
  public static $files = array (
10
  'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
91
  public static function getInitializer(ClassLoader $loader)
92
  {
93
  return \Closure::bind(function () use ($loader) {
94
+ $loader->prefixLengthsPsr4 = ComposerStaticInit681fe027f69d020ee147a0b297a454ab::$prefixLengthsPsr4;
95
+ $loader->prefixDirsPsr4 = ComposerStaticInit681fe027f69d020ee147a0b297a454ab::$prefixDirsPsr4;
96
+ $loader->classMap = ComposerStaticInit681fe027f69d020ee147a0b297a454ab::$classMap;
97
 
98
  }, null, ClassLoader::class);
99
  }