Total Upkeep – WordPress Backup Plugin plus Restore & Migrate by BoldGrid - Version 1.9.0

Version Description

Release date: Mar 26th, 2019

  • New feature: Added emergency/standalone restoration CLI process.
  • Update: When storing backups in wp-content dir, make "boldgrid_backup" dir name more unique.
  • Bug fix: Ensure library's activity class is available before using it.
Download this release

Release Info

Developer boldgrid
Plugin Icon 128x128 Total Upkeep – WordPress Backup Plugin plus Restore & Migrate by BoldGrid
Version 1.9.0
Comparing to
See all releases

Code changes from version 1.8.1 to 1.9.0

admin/class-boldgrid-backup-admin-archive.php CHANGED
@@ -6,7 +6,7 @@
6
  * @since 1.5.3
7
  *
8
  * @package Boldgrid_Backup
9
- * @subpackage Boldgrid_Backup/admin
10
  * @copyright BoldGrid
11
  * @version $Id$
12
  * @author BoldGrid <support@boldgrid.com>
@@ -494,4 +494,83 @@ class Boldgrid_Backup_Admin_Archive {
494
 
495
  return $response;
496
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  }
6
  * @since 1.5.3
7
  *
8
  * @package Boldgrid_Backup
9
+ * @subpackage Boldgrid_Backup/cron
10
  * @copyright BoldGrid
11
  * @version $Id$
12
  * @author BoldGrid <support@boldgrid.com>
494
 
495
  return $response;
496
  }
497
+
498
+ /**
499
+ * Save backup information to a JSON file.
500
+ *
501
+ * The emergency restoration process will read the JSON file to discover the information about
502
+ * the last full backup created. Since the standalone restoration process does not know about
503
+ * the WordPress installation or the backup archives created, the contents of this file created
504
+ * will provide the facts.
505
+ * This method is called by Boldgrid_Backup_Admin_Core::archive_files().
506
+ *
507
+ * @since 1.8.0
508
+ *
509
+ * @see Boldgrid_Backup_Admin_Backup_Dir::get()
510
+ * @see Boldgrid_Backup_Admin_Cron::get_cron_secret()
511
+ * @see Boldgrid_Backup_Admin_Core::archive_files()
512
+ *
513
+ * @param array $info {
514
+ * An array of info about the backup just created.
515
+ *
516
+ * @type string $mode backup
517
+ * @type bool $dryrun
518
+ * @type string $compressor pcl_zip
519
+ * @type int $filesize 30992482
520
+ * @type bool $save
521
+ * @type int $total_size
522
+ * @type string $filepath C:\file.zip
523
+ * @type int $lastmodunix 1506602959
524
+ * @type int $duration 57.08
525
+ * @type int $db_duration 0.35
526
+ * @type bool $mail_success
527
+ * }
528
+ * @return bool
529
+ */
530
+ public function write_results_file( $info ) {
531
+ $success = false;
532
+ $archive_filepath = ! empty( $info['filepath'] ) ? $info['filepath'] : null;
533
+ $results_filepath = BOLDGRID_BACKUP_PATH . '/cron/restore-info.json';
534
+ $is_dir_writable = $this->core->wp_filesystem->is_writable( dirname( $results_filepath ) );
535
+
536
+ if ( $archive_filepath && $is_dir_writable ) {
537
+ $results_filepath = wp_normalize_path( $results_filepath );
538
+ $archive_filename = basename( $archive_filepath );
539
+ $archive_info = $this->core->archive->get_by_name( $archive_filename );
540
+ $archive_key = isset( $archive_info['key'] ) ? $archive_info['key'] : null;
541
+ $cron_secret = $this->core->cron->get_cron_secret();
542
+ $siteurl = site_url();
543
+ $restore_cmd = http_build_query(
544
+ [
545
+ 'mode' => 'restore',
546
+ 'siteurl' => $siteurl,
547
+ 'id' => $this->core->get_backup_identifier(),
548
+ 'secret' => $cron_secret,
549
+ 'archive_key' => $archive_key,
550
+ 'archive_filename' => $archive_filename,
551
+ ],
552
+ '',
553
+ ' '
554
+ );
555
+
556
+ $results = array(
557
+ 'ABSPATH' => ABSPATH,
558
+ 'archive_key' => $archive_key,
559
+ 'cron_secret' => $cron_secret,
560
+ 'filepath' => $archive_filepath,
561
+ 'siteurl' => $siteurl,
562
+ 'restore_cmd' => $this->core->cron->get_cron_command() . ' "' . dirname( __DIR__ ) .
563
+ '/boldgrid-backup-cron.php" ' . $restore_cmd,
564
+ 'timestamp' => time(),
565
+ );
566
+
567
+ $success = $this->core->wp_filesystem->put_contents(
568
+ $results_filepath,
569
+ wp_json_encode( $results ),
570
+ 0600
571
+ );
572
+ }
573
+
574
+ return $success;
575
+ }
576
  }
admin/class-boldgrid-backup-admin-archiver-utility.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-boldgrid-backup-admin-archiver-utility.php
4
+ *
5
+ * @link https://www.boldgrid.com
6
+ * @since 1.9.0
7
+ *
8
+ * @package Boldgrid_Backup
9
+ * @copyright BoldGrid
10
+ * @version $Id$
11
+ * @author BoldGrid <support@boldgrid.com>
12
+ */
13
+
14
+ /**
15
+ * Class: Boldgrid_Backup_Admin_Archiver_Utility
16
+ *
17
+ * This class is a utility class designed to help during the archiving process.
18
+ *
19
+ * @since 1.9.0
20
+ */
21
+ class Boldgrid_Backup_Admin_Archiver_Utility {
22
+ /**
23
+ * The core class object.
24
+ *
25
+ * @since 1.9.0
26
+ * @access private
27
+ * @var Boldgrid_Backup_Admin_Core
28
+ */
29
+ private $core;
30
+
31
+ /**
32
+ * Constructor.
33
+ *
34
+ * @since 1.9.0
35
+ *
36
+ * @param Boldgrid_Backup_Admin_Core $core Core class object.
37
+ */
38
+ public function __construct( $core ) {
39
+ $this->core = $core;
40
+ }
41
+
42
+ /**
43
+ * Determine whether or not we are making a full backup.
44
+ *
45
+ * A full backup, in this case, is a backup meant for full restoration purposes.
46
+ *
47
+ * @since 1.9.0
48
+ *
49
+ * @return bool
50
+ */
51
+ public function is_full_backup() {
52
+ if ( $this->core->pre_auto_update ) {
53
+ return true;
54
+ }
55
+
56
+ if ( $this->core->is_archiving_update_protection ) {
57
+ return true;
58
+ }
59
+
60
+ if ( $this->core->is_backup_full ) {
61
+ return true;
62
+ }
63
+
64
+ if ( $this->core->is_scheduled_backup && $this->core->settings->is_all_files() && $this->core->settings->is_all_tables() ) {
65
+ return true;
66
+ }
67
+
68
+ return false;
69
+ }
70
+ }
admin/class-boldgrid-backup-admin-backup-dir.php CHANGED
@@ -313,8 +313,12 @@ class Boldgrid_Backup_Admin_Backup_Dir {
313
  /*
314
  * Create the directory and all applicable files needed within for security,
315
  * such as .htaccess / etc.
 
 
 
316
  */
317
- $possible_dir .= DIRECTORY_SEPARATOR . 'boldgrid_backup';
 
318
  $backup_directory = $this->create( $possible_dir );
319
  if ( ! $backup_directory ) {
320
  continue;
313
  /*
314
  * Create the directory and all applicable files needed within for security,
315
  * such as .htaccess / etc.
316
+ *
317
+ * If directory is the wp-content directory, add additional random characters so that
318
+ * the backup directory is not simply wp-content/boldgrid_backup.
319
  */
320
+ $append = WP_CONTENT_DIR !== $possible_dir ? '' : '_' . wp_generate_password( 12, false );
321
+ $possible_dir .= DIRECTORY_SEPARATOR . 'boldgrid_backup' . $append;
322
  $backup_directory = $this->create( $possible_dir );
323
  if ( ! $backup_directory ) {
324
  continue;
admin/class-boldgrid-backup-admin-cli.php ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-boldgrid-backup-admin-cli.php
4
+ *
5
+ * @link https://www.boldgrid.com
6
+ * @since 1.8.0
7
+ *
8
+ * @package Boldgrid_Backup
9
+ * @subpackage Boldgrid_Backup/admin
10
+ * @copyright BoldGrid
11
+ * @version $Id$
12
+ * @author BoldGrid <support@boldgrid.com>
13
+ */
14
+
15
+ /**
16
+ * Class: Boldgrid_Backup_Admin_Core
17
+ *
18
+ * @since 1.8.0
19
+ */
20
+ class Boldgrid_Backup_Admin_Cli {
21
+ /**
22
+ * Available execution functions.
23
+ *
24
+ * @since 1.8.0
25
+ * @access private
26
+ * @static
27
+ * @var array
28
+ */
29
+ private static $available_exec_functions;
30
+
31
+ /**
32
+ * Get the available execution functions.
33
+ *
34
+ * @since 1.8.0
35
+ * @static
36
+ *
37
+ * @see Boldgrid_Backup_Admin_Test::is_php_safemode()
38
+ *
39
+ * @return array
40
+ */
41
+ public static function get_execution_functions() {
42
+ // If the array already has elements, then return the array.
43
+ if ( self::$available_exec_functions ) {
44
+ return self::$available_exec_functions;
45
+ }
46
+
47
+ // If PHP is in safe mode, then return an empty array.
48
+ if ( ini_get( 'safe_mode' ) ) {
49
+ return array();
50
+ }
51
+
52
+ // Get the PHP disable_functions list.
53
+ $disabled = explode( ',', ini_get( 'disable_functions' ) );
54
+
55
+ // Make an array of execution functions.
56
+ $exec_functions = array(
57
+ 'popen',
58
+ 'proc_open',
59
+ 'exec',
60
+ 'shell_exec',
61
+ 'passthru',
62
+ 'system',
63
+ );
64
+
65
+ // Iterate through the array and remove disabled functions.
66
+ foreach ( $exec_functions as $exec_function ) {
67
+ if ( in_array( $exec_function, $disabled, true ) ) {
68
+ unset( $exec_functions[ $exec_function ] );
69
+ }
70
+ }
71
+
72
+ // Save the array of execution functions.
73
+ self::$available_exec_functions = $exec_functions;
74
+
75
+ return $exec_functions;
76
+ }
77
+
78
+ /**
79
+ * Call an execute command.
80
+ *
81
+ * To be used by Boldgrid_Backup_Admin_Core::execute_command() and some others.
82
+ *
83
+ * @since 1.8.0
84
+ *
85
+ * @param string $command A command string to be executed.
86
+ * @param bool $success Success or failure of the operation, passed back.
87
+ * @param int $return_var If present, the return_var, passed back.
88
+ * @return string|bool Returns the command output or FALSE on error.
89
+ */
90
+ public static function call_command( $command, &$success = false, &$return_var = 0 ) {
91
+ $success = false;
92
+
93
+ // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions, WordPress.WP.AlternativeFunctions
94
+
95
+ // Test getting output using available execution functions, until one is successful.
96
+ $available_exec_functions = self::get_execution_functions();
97
+
98
+ foreach ( $available_exec_functions as $exec_function ) {
99
+ switch ( $exec_function ) {
100
+ case 'exec':
101
+ exec( $command, $out, $return_var );
102
+
103
+ // If the exit status is int(0), then it was successful.
104
+ if ( 0 === $return_var ) {
105
+ $output = implode( PHP_EOL, $out );
106
+
107
+ $success = true;
108
+
109
+ break 2;
110
+ } else {
111
+ $output = false;
112
+ }
113
+
114
+ break 2;
115
+
116
+ case 'passthru':
117
+ // If output buffering is enabled, then use passthru.
118
+ if ( ob_start() ) {
119
+ passthru( $command, $return_var );
120
+
121
+ // Get current buffer contents and delete current output buffer.
122
+ $output = ob_get_clean();
123
+
124
+ // If the exit status is int(0), then it was successful.
125
+ if ( 0 === $return_var ) {
126
+ $success = true;
127
+
128
+ break 2;
129
+ } else {
130
+ $output = false;
131
+ }
132
+ }
133
+
134
+ break 2;
135
+
136
+ case 'popen':
137
+ $handle = popen( $command, 'r' );
138
+
139
+ $output = fread( $handle, 4096 );
140
+
141
+ /*
142
+ * If handle is a valid resource, then check for success.
143
+ */
144
+ if ( false !== $handle ) {
145
+ // Close the process handle and get the return status.
146
+ $return_var = pclose( $handle );
147
+
148
+ // If the exit status is int(0), then it was successful.
149
+ if ( 0 === $return_var ) {
150
+ $success = true;
151
+
152
+ break 2;
153
+ } else {
154
+ // Bad exit status code (non-zero).
155
+ $output = false;
156
+ }
157
+ } else {
158
+ // Failed to create a process handle.
159
+ $output = false;
160
+ }
161
+
162
+ break 2;
163
+
164
+ case 'proc_open':
165
+ // Create the descriptor spec array.
166
+ $descriptorspec = array(
167
+ 0 => array(
168
+ 'pipe',
169
+ 'r',
170
+ ),
171
+ 1 => array(
172
+ 'pipe',
173
+ 'w',
174
+ ),
175
+ 2 => array(
176
+ 'pipe',
177
+ 'w',
178
+ ),
179
+ );
180
+
181
+ // Open a process handle.
182
+ $handle = proc_open( $command, $descriptorspec, $pipes );
183
+
184
+ if ( is_resource( $handle ) ) {
185
+ // Close unused pipes[0].
186
+ fclose( $pipes[0] );
187
+
188
+ // Read output from pipes[1].
189
+ $output = stream_get_contents( $pipes[1] );
190
+
191
+ // Close pipes[1].
192
+ fclose( $pipes[1] );
193
+
194
+ // Close unused pipes[0].
195
+ fclose( $pipes[2] );
196
+
197
+ // Close the process handle and get the return status.
198
+ $return_var = proc_close( $handle );
199
+
200
+ // If the exit status is int(0), then it was successful.
201
+ if ( 0 === $return_var ) {
202
+ $success = true;
203
+
204
+ break 2;
205
+ } else {
206
+ $output = false;
207
+ }
208
+ }
209
+
210
+ break 2;
211
+
212
+ case 'shell_exec':
213
+ $output = shell_exec( $command );
214
+
215
+ if ( false === strpos( $output, 'command not found' ) ) {
216
+ $success = true;
217
+
218
+ break 2;
219
+ } else {
220
+ $output = false;
221
+ }
222
+
223
+ break 2;
224
+
225
+ case 'system':
226
+ // If output buffering is enabled, then use system.
227
+ if ( ob_start() ) {
228
+ system( $command, $return_var );
229
+
230
+ // Get current buffer contents and delete current output buffer.
231
+ $output = ob_get_clean();
232
+
233
+ // If the exit status is int(0), then it was successful.
234
+ if ( 0 === $return_var ) {
235
+ $success = true;
236
+
237
+ break 2;
238
+ } else {
239
+ $output = false;
240
+ }
241
+ }
242
+
243
+ break 2;
244
+
245
+ default:
246
+ break;
247
+ }
248
+ }
249
+
250
+ // phpcs:enable WordPress.PHP.DiscouragedPHPFunctions, WordPress.WP.AlternativeFunctions
251
+
252
+ if ( ! empty( $output ) ) {
253
+ $output = trim( $output );
254
+ }
255
+
256
+ if ( ! $success ) {
257
+ $output = false;
258
+ }
259
+
260
+ return $output;
261
+ }
262
+ }
admin/class-boldgrid-backup-admin-config.php CHANGED
@@ -411,6 +411,8 @@ class Boldgrid_Backup_Admin_Config {
411
  *
412
  * @since 1.0
413
  *
 
 
414
  * @return array
415
  */
416
  public function get_available_compressors() {
411
  *
412
  * @since 1.0
413
  *
414
+ * @see Boldgrid_Backup_Admin_Core::execute_command()
415
+ *
416
  * @return array
417
  */
418
  public function get_available_compressors() {
admin/class-boldgrid-backup-admin-core.php CHANGED
@@ -20,11 +20,18 @@
20
  * @since 1.0
21
  */
22
  class Boldgrid_Backup_Admin_Core {
 
 
 
 
 
 
 
 
23
  /**
24
  * Auto Rollback class.
25
  *
26
  * @since 1.5.2
27
- * @access public
28
  * @var Boldgrid_Backup_Admin_Auto_Rollback
29
  */
30
  public $auto_rollback;
@@ -33,7 +40,6 @@ class Boldgrid_Backup_Admin_Core {
33
  * The settings class object.
34
  *
35
  * @since 1.0
36
- * @access public
37
  * @var Boldgrid_Backup_Admin_Settings
38
  */
39
  public $settings;
@@ -42,7 +48,6 @@ class Boldgrid_Backup_Admin_Core {
42
  * The configuration class object.
43
  *
44
  * @since 1.0
45
- * @access public
46
  * @var Boldgrid_Backup_Admin_Config
47
  */
48
  public $config;
@@ -51,7 +56,6 @@ class Boldgrid_Backup_Admin_Core {
51
  * Plugin configs.
52
  *
53
  * @since 1.3.4
54
- * @access plublic
55
  * @var array
56
  */
57
  public $configs;
@@ -60,7 +64,6 @@ class Boldgrid_Backup_Admin_Core {
60
  * Core Files class.
61
  *
62
  * @since 1.6.0
63
- * @access public
64
  * @var Boldgrid_Backup_Admin_Core_Files
65
  */
66
  public $core_files;
@@ -72,7 +75,6 @@ class Boldgrid_Backup_Admin_Core {
72
  * this->archive_files runs, it reports doing_ajax as true.
73
  *
74
  * @since 1.5.2
75
- * @access public
76
  * @var bool
77
  */
78
  public $doing_ajax;
@@ -84,7 +86,6 @@ class Boldgrid_Backup_Admin_Core {
84
  * true.
85
  *
86
  * @since 1.5.1
87
- * @access public
88
  * @var bool
89
  */
90
  public $doing_cron;
@@ -109,7 +110,6 @@ class Boldgrid_Backup_Admin_Core {
109
  * Email.
110
  *
111
  * @since 1.5.2
112
- * @access public
113
  * @var Boldgrid_Backup_Admin_Email
114
  */
115
  public $email;
@@ -121,7 +121,6 @@ class Boldgrid_Backup_Admin_Core {
121
  * language strings.
122
  *
123
  * @since 1.5.3
124
- * @access public
125
  * @var Boldgrid_Backup_Admin_Email
126
  */
127
  public $elements = array();
@@ -130,7 +129,6 @@ class Boldgrid_Backup_Admin_Core {
130
  * The functionality test class object.
131
  *
132
  * @since 1.0
133
- * @access public
134
  * @var Boldgrid_Backup_Admin_Test
135
  */
136
  public $test;
@@ -139,7 +137,6 @@ class Boldgrid_Backup_Admin_Core {
139
  * The Time class object.
140
  *
141
  * @since 1.6.0
142
- * @access public
143
  * @var Boldgrid_Backup_Admin_Time
144
  */
145
  public $time;
@@ -148,7 +145,6 @@ class Boldgrid_Backup_Admin_Core {
148
  * An instance of Boldgrid_Backup_Admin_Tools.
149
  *
150
  * @since 1.6.0
151
- * @access public
152
  * @var Boldgrid_Backup_Admin_Tools
153
  */
154
  public $tools;
@@ -157,7 +153,6 @@ class Boldgrid_Backup_Admin_Core {
157
  * An instance of Boldgrid_Backup_Admin_Utility.
158
  *
159
  * @since 1.5.3
160
- * @access public
161
  * @var Boldgrid_Backup_Admin_Utility
162
  */
163
  public $utility;
@@ -166,7 +161,6 @@ class Boldgrid_Backup_Admin_Core {
166
  * The admin notice class object.
167
  *
168
  * @since 1.0
169
- * @access public
170
  * @var Boldgrid_Backup_Admin_Notice
171
  */
172
  public $notice;
@@ -175,7 +169,6 @@ class Boldgrid_Backup_Admin_Core {
175
  * WordPress' global pagenow.
176
  *
177
  * @since 1.6.0
178
- * @access public
179
  * @var string
180
  */
181
  public $pagenow;
@@ -186,7 +179,6 @@ class Boldgrid_Backup_Admin_Core {
186
  * WordPress does an auto upgrade).
187
  *
188
  * @since 1.6.0
189
- * @access public
190
  * @var bool
191
  */
192
  public $pre_auto_update = false;
@@ -195,7 +187,6 @@ class Boldgrid_Backup_Admin_Core {
195
  * The admin cron class object.
196
  *
197
  * @since 1.0
198
- * @access public
199
  * @var Boldgrid_Backup_Admin_Cron
200
  */
201
  public $cron;
@@ -204,7 +195,6 @@ class Boldgrid_Backup_Admin_Core {
204
  * Cron log class.
205
  *
206
  * @since 1.6.5
207
- * @access public
208
  * @var Boldgrid_Backup_Admin_Cron_Log
209
  */
210
  public $cron_log;
@@ -213,7 +203,6 @@ class Boldgrid_Backup_Admin_Core {
213
  * Cron test class.
214
  *
215
  * @since 1.6.5
216
- * @access public
217
  * @var Boldgrid_Backup_Admin_Cron_Test
218
  */
219
  public $cron_test;
@@ -222,7 +211,6 @@ class Boldgrid_Backup_Admin_Core {
222
  * The admin xhprof class object.
223
  *
224
  * @since 1.2
225
- * @access public
226
  * @var Boldgrid_Backup_Admin_Xhprof
227
  */
228
  public $xhprof;
@@ -231,7 +219,6 @@ class Boldgrid_Backup_Admin_Core {
231
  * WP Cron class.
232
  *
233
  * @since 1.5.1
234
- * @access public
235
  * @var Boldgrid_Backup_Admin_WP_Cron
236
  */
237
  public $wp_cron;
@@ -240,7 +227,6 @@ class Boldgrid_Backup_Admin_Core {
240
  * An instance of the filesystem.
241
  *
242
  * @since 1.5.1
243
- * @access public
244
  * @var WP_Filesystem
245
  */
246
  public $wp_filesystem;
@@ -249,7 +235,6 @@ class Boldgrid_Backup_Admin_Core {
249
  * An instance of the Boldgrid_Backup_Admin_Archive class.
250
  *
251
  * @since 1.5.3
252
- * @access public
253
  * @var Boldgrid_Backup_Admin_Archive
254
  */
255
  public $archive;
@@ -258,7 +243,6 @@ class Boldgrid_Backup_Admin_Core {
258
  * An instance of the Boldgrid_Backup_Admin_Archives class.
259
  *
260
  * @since 1.6.0
261
- * @access public
262
  * @var Boldgrid_Backup_Admin_Archives
263
  */
264
  public $archives;
@@ -267,7 +251,6 @@ class Boldgrid_Backup_Admin_Core {
267
  * An instance of the Boldgrid_Backup_Admin_Archives_All class.
268
  *
269
  * @since 1.6.0
270
- * @access public
271
  * @var Boldgrid_Backup_Admin_Archives_All
272
  */
273
  public $archives_all;
@@ -276,7 +259,6 @@ class Boldgrid_Backup_Admin_Core {
276
  * An instance of the Boldgrid_Backup_Admin_Archive_Actions class.
277
  *
278
  * @since 1.6.0
279
- * @access public
280
  * @var Boldgrid_Backup_Admin_Archive_Actions
281
  */
282
  public $archive_actions;
@@ -285,7 +267,6 @@ class Boldgrid_Backup_Admin_Core {
285
  * An instance of the Boldgrid_Backup_Admin_Archive_Browser class.
286
  *
287
  * @since 1.5.2
288
- * @access public
289
  * @var Boldgrid_Backup_Admin_Archive_Browser
290
  */
291
  public $archive_browser;
@@ -294,7 +275,6 @@ class Boldgrid_Backup_Admin_Core {
294
  * An instance of the Archive Log class.
295
  *
296
  * @since 1.5.1
297
- * @access public
298
  * @var Boldgrid_Backup_Admin_Archive_Log
299
  */
300
  public $archive_log;
@@ -303,7 +283,6 @@ class Boldgrid_Backup_Admin_Core {
303
  * An instance of the Archive Details class.
304
  *
305
  * @since 1.5.1
306
- * @access public
307
  * @var Boldgrid_Backup_Admin_Archive_Details
308
  */
309
  public $archive_details;
@@ -312,25 +291,14 @@ class Boldgrid_Backup_Admin_Core {
312
  * An instance of the Archive Fail class.
313
  *
314
  * @since 1.5.2
315
- * @access public
316
  * @var Boldgrid_Backup_Admin_Archive_Fail
317
  */
318
  public $archive_fail;
319
 
320
- /**
321
- * Available execution functions.
322
- *
323
- * @since 1.0
324
- * @access private
325
- * @var array
326
- */
327
- private $available_exec_functions = null;
328
-
329
  /**
330
  * Db Dump.
331
  *
332
  * @since 1.5.3
333
- * @access public
334
  * @var Boldgrid_Backup_Admin_Db_Dump
335
  */
336
  public $db_dump;
@@ -339,7 +307,6 @@ class Boldgrid_Backup_Admin_Core {
339
  * Database backup file path.
340
  *
341
  * @since 1.0
342
- * @access public
343
  * @var string
344
  */
345
  public $db_dump_filepath = '';
@@ -348,7 +315,6 @@ class Boldgrid_Backup_Admin_Core {
348
  * Db Get.
349
  *
350
  * @since 1.5.3
351
- * @access public
352
  * @var Boldgrid_Backup_Admin_Db_Dump
353
  */
354
  public $db_get;
@@ -357,7 +323,6 @@ class Boldgrid_Backup_Admin_Core {
357
  * An instance of Boldgrid_Backup_Admin_Db_Omit.
358
  *
359
  * @since 1.5.3
360
- * @access public
361
  * @var Boldgrid_Backup_Admin_Db_Omit
362
  */
363
  public $db_omit;
@@ -425,7 +390,6 @@ class Boldgrid_Backup_Admin_Core {
425
  * choosing a full backup.
426
  *
427
  * @since 1.6.0
428
- * @access public
429
  * @var bool
430
  */
431
  public $is_backup_full = false;
@@ -434,7 +398,6 @@ class Boldgrid_Backup_Admin_Core {
434
  * Value indicating we are in the Backup Site Now callback.
435
  *
436
  * @since 1.6.0
437
- * @access public
438
  * @var bool
439
  */
440
  public $is_backup_now = false;
@@ -464,6 +427,14 @@ class Boldgrid_Backup_Admin_Core {
464
  */
465
  public $is_archiving_update_protection = false;
466
 
 
 
 
 
 
 
 
 
467
  /**
468
  * Common elements.
469
  *
@@ -476,7 +447,6 @@ class Boldgrid_Backup_Admin_Core {
476
  * Local storage.
477
  *
478
  * @since 1.5.2
479
- * @access public
480
  * @var Boldgrid_Backup_Admin_Storage_Local
481
  */
482
  public $local;
@@ -485,7 +455,6 @@ class Boldgrid_Backup_Admin_Core {
485
  * Path to our config.rating-prompt.php file.
486
  *
487
  * @since 1.7.2
488
- * @access public
489
  * @var string
490
  */
491
  public $rating_prompt_config;
@@ -494,7 +463,6 @@ class Boldgrid_Backup_Admin_Core {
494
  * The Restore Helper class.
495
  *
496
  * @since 1.6.1
497
- * @access public
498
  * @var Boldgrid_Backup_Admin_Restore_Helper
499
  */
500
  public $restore_helper;
@@ -503,7 +471,6 @@ class Boldgrid_Backup_Admin_Core {
503
  * The scheduler class object.
504
  *
505
  * @since 1.5.1
506
- * @access public
507
  * @var Boldgrid_Backup_Admin_Scheduler
508
  */
509
  public $scheduler;
@@ -512,7 +479,6 @@ class Boldgrid_Backup_Admin_Core {
512
  * The public download class object.
513
  *
514
  * @since 1.7.0
515
- * @access public
516
  * @var Boldgrid_Backup_Download
517
  */
518
  public $download;
@@ -521,7 +487,6 @@ class Boldgrid_Backup_Admin_Core {
521
  * An instance of the Boldgrid\Library\Library\Activity class.
522
  *
523
  * @since 1.7.2
524
- * @access public
525
  * @var Boldgrid\Library\Library\Activity
526
  */
527
  public $activity;
@@ -597,6 +562,8 @@ class Boldgrid_Backup_Admin_Core {
597
 
598
  $this->archive_fail = new Boldgrid_Backup_Admin_Archive_Fail( $this );
599
 
 
 
600
  $this->wp_cron = new Boldgrid_Backup_Admin_WP_Cron( $this );
601
 
602
  $this->scheduler = new Boldgrid_Backup_Admin_Scheduler( $this );
@@ -743,73 +710,25 @@ class Boldgrid_Backup_Admin_Core {
743
  $this->premium->run();
744
  }
745
 
746
- /**
747
- * Get the available execution functions.
748
- *
749
- * @since 1.0
750
- *
751
- * @return array An array of function names.
752
- */
753
- public function get_execution_functions() {
754
- // If the array already has elements, then return the array.
755
- if ( $this->available_exec_functions ) {
756
- return $this->available_exec_functions;
757
- }
758
-
759
- // If PHP is in safe mode, then return an empty array.
760
- if ( $this->test->is_php_safemode() ) {
761
- return array();
762
- }
763
-
764
- // Get the PHP disable_functions list.
765
- $disabled = explode( ',', ini_get( 'disable_functions' ) );
766
-
767
- // Make an array of execution functions.
768
- $exec_functions = array(
769
- 'popen',
770
- 'proc_open',
771
- 'exec',
772
- 'shell_exec',
773
- 'passthru',
774
- 'system',
775
- );
776
-
777
- // Iterate through the array and remove disabled functions.
778
- foreach ( $exec_functions as $exec_function ) {
779
- if ( in_array( $exec_function, $disabled, true ) ) {
780
- unset( $exec_functions[ $exec_function ] );
781
- }
782
- }
783
-
784
- // Save the array of execution functions.
785
- $this->available_exec_functions = $exec_functions;
786
-
787
- return $exec_functions;
788
- }
789
-
790
  /**
791
  * Execute a system command using an array of execution functions.
792
  *
793
  * @since 1.0
794
  *
 
 
795
  * @param string $command A command string to be executed.
796
- * @param array $available_exec_functions An array of available execution functions.
797
  * @param bool $success Success or failure of the operation, passed back.
798
  * @param int $return_var If present, the return_var, passed back.
799
  * @param string $filepath An optional file path to write the output.
800
  * @return string|bool Returns the command output or FALSE on error.
801
  */
802
- public function execute_command( $command, $available_exec_functions = array(), &$success = false, &$return_var = 0, $filepath = null ) {
803
  // If no command was passed, then fail.
804
  if ( empty( $command ) ) {
805
  return false;
806
  }
807
 
808
- // If there are no supplied execution functions, then retrieve available ones.
809
- if ( empty( $available_exec_functions ) ) {
810
- $available_exec_functions = $this->get_execution_functions();
811
- }
812
-
813
  // If an output filepath is supplied, and the directory is writable, then write to file.
814
  if ( $filepath && $this->wp_filesystem->is_writable( dirname( $filepath ) ) ) {
815
  $command .= ' > ' . wp_normalize_path( $filepath );
@@ -820,177 +739,8 @@ class Boldgrid_Backup_Admin_Core {
820
  $command .= ' 2>/dev/null';
821
  }
822
 
823
- // Initialize $success.
824
- $success = false;
825
-
826
- // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions, WordPress.WP.AlternativeFunctions
827
-
828
- // Test getting output using available execution functions, until one is successful.
829
- foreach ( $available_exec_functions as $exec_function ) {
830
- switch ( $exec_function ) {
831
- case 'exec':
832
- exec( $command, $out, $return_var );
833
-
834
- // If the exit status is int(0), then it was successful.
835
- if ( 0 === $return_var ) {
836
- $output = implode( PHP_EOL, $out );
837
-
838
- $success = true;
839
-
840
- break 2;
841
- } else {
842
- $output = false;
843
- }
844
-
845
- break 2;
846
-
847
- case 'passthru':
848
- // If output buffering is enabled, then use passthru.
849
- if ( ob_start() ) {
850
- passthru( $command, $return_var );
851
-
852
- // Get current buffer contents and delete current output buffer.
853
- $output = ob_get_clean();
854
-
855
- // If the exit status is int(0), then it was successful.
856
- if ( 0 === $return_var ) {
857
- $success = true;
858
-
859
- break 2;
860
- } else {
861
- $output = false;
862
- }
863
- }
864
-
865
- break 2;
866
-
867
- case 'popen':
868
- $handle = popen( $command, 'r' );
869
-
870
- $output = fread( $handle, 4096 );
871
-
872
- /*
873
- * If handle is a valid resource, then check for success.
874
- */
875
- if ( false !== $handle ) {
876
- // Close the process handle and get the return status.
877
- $return_var = pclose( $handle );
878
-
879
- // If the exit status is int(0), then it was successful.
880
- if ( 0 === $return_var ) {
881
- $success = true;
882
-
883
- break 2;
884
- } else {
885
- // Bad exit status code (non-zero).
886
- $output = false;
887
- }
888
- } else {
889
- // Failed to create a process handle.
890
- $output = false;
891
- }
892
-
893
- break 2;
894
-
895
- case 'proc_open':
896
- // Create the descriptor spec array.
897
- $descriptorspec = array(
898
- 0 => array(
899
- 'pipe',
900
- 'r',
901
- ),
902
- 1 => array(
903
- 'pipe',
904
- 'w',
905
- ),
906
- 2 => array(
907
- 'pipe',
908
- 'w',
909
- ),
910
- );
911
-
912
- // Open a process handle.
913
- $handle = proc_open( $command, $descriptorspec, $pipes );
914
-
915
- if ( is_resource( $handle ) ) {
916
- // Close unused pipes[0].
917
- fclose( $pipes[0] );
918
-
919
- // Read output from pipes[1].
920
- $output = stream_get_contents( $pipes[1] );
921
-
922
- // Close pipes[1].
923
- fclose( $pipes[1] );
924
-
925
- // Close unused pipes[0].
926
- fclose( $pipes[2] );
927
-
928
- // Close the process handle and get the return status.
929
- $return_var = proc_close( $handle );
930
-
931
- // If the exit status is int(0), then it was successful.
932
- if ( 0 === $return_var ) {
933
- $success = true;
934
-
935
- break 2;
936
- } else {
937
- $output = false;
938
- }
939
- }
940
-
941
- break 2;
942
-
943
- case 'shell_exec':
944
- $output = shell_exec( $command );
945
-
946
- if ( false === strpos( $output, 'command not found' ) ) {
947
- $success = true;
948
-
949
- break 2;
950
- } else {
951
- $output = false;
952
- }
953
-
954
- break 2;
955
-
956
- case 'system':
957
- // If output buffering is enabled, then use system.
958
- if ( ob_start() ) {
959
- system( $command, $return_var );
960
-
961
- // Get current buffer contents and delete current output buffer.
962
- $output = ob_get_clean();
963
-
964
- // If the exit status is int(0), then it was successful.
965
- if ( 0 === $return_var ) {
966
- $success = true;
967
-
968
- break 2;
969
- } else {
970
- $output = false;
971
- }
972
- }
973
-
974
- break 2;
975
-
976
- default:
977
- break;
978
- }
979
- }
980
-
981
- // phpcs:enable WordPress.PHP.DiscouragedPHPFunctions, WordPress.WP.AlternativeFunctions
982
-
983
- // If there is output, then trim it.
984
- if ( ! empty( $output ) ) {
985
- $output = trim( $output );
986
- }
987
 
988
- // If the command was not successful, then return FALSE.
989
- if ( ! $success ) {
990
- return false;
991
- }
992
-
993
- // Success.
994
  return $output;
995
  }
996
 
@@ -1241,7 +991,6 @@ class Boldgrid_Backup_Admin_Core {
1241
  *
1242
  * @see Boldgrid_Backup_Admin_Test::run_functionality_tests()
1243
  * @see Boldgrid_Backup_Admin_Backup_Dir::get()
1244
- * @see Boldgrid_Backup_Admin_Core::execute_command()
1245
  * @see Boldgrid_Backup_Admin_Utility::update_siteurl()
1246
  * @global WP_Filesystem $wp_filesystem The WordPress Filesystem API global object.
1247
  * @global wpdb $wpdb The WordPress database class object.
@@ -1552,7 +1301,8 @@ class Boldgrid_Backup_Admin_Core {
1552
  *
1553
  * @since 1.0
1554
  *
1555
- * @see Boldgrid_Backup_Admin_Core::backup_database().
 
1556
  *
1557
  * @param bool $save A switch to save the archive file. Default is FALSE.
1558
  * @param bool $dryrun An optional switch to perform a dry run test.
@@ -1561,6 +1311,8 @@ class Boldgrid_Backup_Admin_Core {
1561
  public function archive_files( $save = false, $dryrun = false ) {
1562
  $this->pre_auto_update = 'pre_auto_update' === current_filter();
1563
 
 
 
1564
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
1565
  array(
1566
  'status' => __( 'Initializing backup', 'boldgrid-backup' ),
@@ -1578,8 +1330,6 @@ class Boldgrid_Backup_Admin_Core {
1578
  $this->in_progress->set();
1579
  }
1580
 
1581
- $is_scheduled_backup = $this->doing_cron && ! $this->pre_auto_update;
1582
-
1583
  /*
1584
  * If this is a scheduled backup and no location is selected to save the
1585
  * backup to, abort.
@@ -1589,7 +1339,7 @@ class Boldgrid_Backup_Admin_Core {
1589
  * wanted to change their retention settings but did not want to schedule
1590
  * backups, validating storage locations would be problematic.
1591
  */
1592
- if ( $is_scheduled_backup && ! $this->remote->any_enabled() ) {
1593
  $error = __( 'No backup locations selected! While we could create a backup archive, you have not selected where the backup archive should be saved to. Please choose a storage location in your BoldGrid Backup Settings to save this backup archive to.', 'boldgrid-backup' );
1594
  $this->archive_fail->schedule_fail_email( $error );
1595
  return array(
@@ -1620,17 +1370,34 @@ class Boldgrid_Backup_Admin_Core {
1620
  * adjust which folders are actually included / excluded.
1621
  */
1622
  $info = array(
1623
- 'mode' => 'backup',
1624
- 'dryrun' => $dryrun,
1625
- 'compressor' => null,
1626
- 'filesize' => 0,
1627
- 'save' => $save,
1628
- 'total_size' => 0,
1629
- 'folder_include' => $this->folder_exclusion->from_settings( 'include' ),
1630
- 'folder_exclude' => $this->folder_exclusion->from_settings( 'exclude' ),
1631
- 'table_exclude' => $this->db_omit->get_excluded_tables(),
1632
- 'title' => ! empty( $_POST['backup_title'] ) ? stripslashes( $_POST['backup_title'] ) : null, // phpcs:ignore WordPress.CSRF.NonceVerification,WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine
1633
- 'description' => ! empty( $_POST['backup_description'] ) ? stripslashes( $_POST['backup_description'] ) : null, // phpcs:ignore WordPress.CSRF.NonceVerification,WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1634
  );
1635
 
1636
  // Determine how this backup was triggered.
@@ -1802,9 +1569,10 @@ class Boldgrid_Backup_Admin_Core {
1802
  // Stop timer.
1803
  $time_stop = microtime( true );
1804
 
1805
- // Calculate duration and MD5.
1806
  $info['duration'] = number_format( ( $time_stop - $time_start ), 2, '.', '' );
1807
  $info['db_duration'] = number_format( ( $db_time_stop - $time_start ), 2, '.', '' );
 
1808
 
1809
  /**
1810
  * Actions to take after a backup has been created.
@@ -1817,7 +1585,7 @@ class Boldgrid_Backup_Admin_Core {
1817
  *
1818
  * @since 1.5.2
1819
  *
1820
- * @param array $info{
1821
  * An array of info about the backup just created.
1822
  *
1823
  * @type string $mode backup
@@ -1844,7 +1612,7 @@ class Boldgrid_Backup_Admin_Core {
1844
  * not only include the standard info about the backup (which we're sending now), it will
1845
  * also include info about other jobs that were ran (such as uploading the backup remotely).
1846
  */
1847
- if ( $this->email->user_wants_notification( 'backup' ) && ! $is_scheduled_backup ) {
1848
  $email_parts = $this->email->post_archive_parts( $info );
1849
  $email_body = $email_parts['body']['main'] . $email_parts['body']['signature'];
1850
  $info['mail_success'] = $this->email->send( $email_parts['subject'], $email_body );
@@ -1857,14 +1625,17 @@ class Boldgrid_Backup_Admin_Core {
1857
 
1858
  $this->archive_log->write( $info );
1859
 
1860
- $info['file_md5'] = md5_file( $info['filepath'] );
1861
-
1862
  // Enforce retention setting.
1863
  $this->enforce_retention();
1864
 
1865
  update_option( 'boldgrid_backup_latest_backup', $info );
1866
  }
1867
 
 
 
 
 
 
1868
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
1869
  array(
1870
  'status' => __( 'Backup complete!', 'boldgrid-backup' ),
@@ -2475,8 +2246,9 @@ class Boldgrid_Backup_Admin_Core {
2475
 
2476
  $this->is_backup_now = true;
2477
 
2478
- $key = 'folder_exclusion_type';
2479
- $this->is_backup_full = isset( $_POST[ $key ] ) && 'full' === $_POST[ $key ];
 
2480
 
2481
  $this->is_archiving_update_protection = ! empty( $_POST['is_updating'] ) &&
2482
  'true' === $_POST['is_updating'];
20
  * @since 1.0
21
  */
22
  class Boldgrid_Backup_Admin_Core {
23
+ /**
24
+ * Archiver Utility class.
25
+ *
26
+ * @since 1.9.0
27
+ * @var Boldgrid_Backup_Admin_Archiver_Utility
28
+ */
29
+ public $archiver_utility;
30
+
31
  /**
32
  * Auto Rollback class.
33
  *
34
  * @since 1.5.2
 
35
  * @var Boldgrid_Backup_Admin_Auto_Rollback
36
  */
37
  public $auto_rollback;
40
  * The settings class object.
41
  *
42
  * @since 1.0
 
43
  * @var Boldgrid_Backup_Admin_Settings
44
  */
45
  public $settings;
48
  * The configuration class object.
49
  *
50
  * @since 1.0
 
51
  * @var Boldgrid_Backup_Admin_Config
52
  */
53
  public $config;
56
  * Plugin configs.
57
  *
58
  * @since 1.3.4
 
59
  * @var array
60
  */
61
  public $configs;
64
  * Core Files class.
65
  *
66
  * @since 1.6.0
 
67
  * @var Boldgrid_Backup_Admin_Core_Files
68
  */
69
  public $core_files;
75
  * this->archive_files runs, it reports doing_ajax as true.
76
  *
77
  * @since 1.5.2
 
78
  * @var bool
79
  */
80
  public $doing_ajax;
86
  * true.
87
  *
88
  * @since 1.5.1
 
89
  * @var bool
90
  */
91
  public $doing_cron;
110
  * Email.
111
  *
112
  * @since 1.5.2
 
113
  * @var Boldgrid_Backup_Admin_Email
114
  */
115
  public $email;
121
  * language strings.
122
  *
123
  * @since 1.5.3
 
124
  * @var Boldgrid_Backup_Admin_Email
125
  */
126
  public $elements = array();
129
  * The functionality test class object.
130
  *
131
  * @since 1.0
 
132
  * @var Boldgrid_Backup_Admin_Test
133
  */
134
  public $test;
137
  * The Time class object.
138
  *
139
  * @since 1.6.0
 
140
  * @var Boldgrid_Backup_Admin_Time
141
  */
142
  public $time;
145
  * An instance of Boldgrid_Backup_Admin_Tools.
146
  *
147
  * @since 1.6.0
 
148
  * @var Boldgrid_Backup_Admin_Tools
149
  */
150
  public $tools;
153
  * An instance of Boldgrid_Backup_Admin_Utility.
154
  *
155
  * @since 1.5.3
 
156
  * @var Boldgrid_Backup_Admin_Utility
157
  */
158
  public $utility;
161
  * The admin notice class object.
162
  *
163
  * @since 1.0
 
164
  * @var Boldgrid_Backup_Admin_Notice
165
  */
166
  public $notice;
169
  * WordPress' global pagenow.
170
  *
171
  * @since 1.6.0
 
172
  * @var string
173
  */
174
  public $pagenow;
179
  * WordPress does an auto upgrade).
180
  *
181
  * @since 1.6.0
 
182
  * @var bool
183
  */
184
  public $pre_auto_update = false;
187
  * The admin cron class object.
188
  *
189
  * @since 1.0
 
190
  * @var Boldgrid_Backup_Admin_Cron
191
  */
192
  public $cron;
195
  * Cron log class.
196
  *
197
  * @since 1.6.5
 
198
  * @var Boldgrid_Backup_Admin_Cron_Log
199
  */
200
  public $cron_log;
203
  * Cron test class.
204
  *
205
  * @since 1.6.5
 
206
  * @var Boldgrid_Backup_Admin_Cron_Test
207
  */
208
  public $cron_test;
211
  * The admin xhprof class object.
212
  *
213
  * @since 1.2
 
214
  * @var Boldgrid_Backup_Admin_Xhprof
215
  */
216
  public $xhprof;
219
  * WP Cron class.
220
  *
221
  * @since 1.5.1
 
222
  * @var Boldgrid_Backup_Admin_WP_Cron
223
  */
224
  public $wp_cron;
227
  * An instance of the filesystem.
228
  *
229
  * @since 1.5.1
 
230
  * @var WP_Filesystem
231
  */
232
  public $wp_filesystem;
235
  * An instance of the Boldgrid_Backup_Admin_Archive class.
236
  *
237
  * @since 1.5.3
 
238
  * @var Boldgrid_Backup_Admin_Archive
239
  */
240
  public $archive;
243
  * An instance of the Boldgrid_Backup_Admin_Archives class.
244
  *
245
  * @since 1.6.0
 
246
  * @var Boldgrid_Backup_Admin_Archives
247
  */
248
  public $archives;
251
  * An instance of the Boldgrid_Backup_Admin_Archives_All class.
252
  *
253
  * @since 1.6.0
 
254
  * @var Boldgrid_Backup_Admin_Archives_All
255
  */
256
  public $archives_all;
259
  * An instance of the Boldgrid_Backup_Admin_Archive_Actions class.
260
  *
261
  * @since 1.6.0
 
262
  * @var Boldgrid_Backup_Admin_Archive_Actions
263
  */
264
  public $archive_actions;
267
  * An instance of the Boldgrid_Backup_Admin_Archive_Browser class.
268
  *
269
  * @since 1.5.2
 
270
  * @var Boldgrid_Backup_Admin_Archive_Browser
271
  */
272
  public $archive_browser;
275
  * An instance of the Archive Log class.
276
  *
277
  * @since 1.5.1
 
278
  * @var Boldgrid_Backup_Admin_Archive_Log
279
  */
280
  public $archive_log;
283
  * An instance of the Archive Details class.
284
  *
285
  * @since 1.5.1
 
286
  * @var Boldgrid_Backup_Admin_Archive_Details
287
  */
288
  public $archive_details;
291
  * An instance of the Archive Fail class.
292
  *
293
  * @since 1.5.2
 
294
  * @var Boldgrid_Backup_Admin_Archive_Fail
295
  */
296
  public $archive_fail;
297
 
 
 
 
 
 
 
 
 
 
298
  /**
299
  * Db Dump.
300
  *
301
  * @since 1.5.3
 
302
  * @var Boldgrid_Backup_Admin_Db_Dump
303
  */
304
  public $db_dump;
307
  * Database backup file path.
308
  *
309
  * @since 1.0
 
310
  * @var string
311
  */
312
  public $db_dump_filepath = '';
315
  * Db Get.
316
  *
317
  * @since 1.5.3
 
318
  * @var Boldgrid_Backup_Admin_Db_Dump
319
  */
320
  public $db_get;
323
  * An instance of Boldgrid_Backup_Admin_Db_Omit.
324
  *
325
  * @since 1.5.3
 
326
  * @var Boldgrid_Backup_Admin_Db_Omit
327
  */
328
  public $db_omit;
390
  * choosing a full backup.
391
  *
392
  * @since 1.6.0
 
393
  * @var bool
394
  */
395
  public $is_backup_full = false;
398
  * Value indicating we are in the Backup Site Now callback.
399
  *
400
  * @since 1.6.0
 
401
  * @var bool
402
  */
403
  public $is_backup_now = false;
427
  */
428
  public $is_archiving_update_protection = false;
429
 
430
+ /**
431
+ * Whether or not we are in a scheduled backup (IE a cron backup).
432
+ *
433
+ * @since 1.9.0
434
+ * @var bool
435
+ */
436
+ public $is_scheduled_backup;
437
+
438
  /**
439
  * Common elements.
440
  *
447
  * Local storage.
448
  *
449
  * @since 1.5.2
 
450
  * @var Boldgrid_Backup_Admin_Storage_Local
451
  */
452
  public $local;
455
  * Path to our config.rating-prompt.php file.
456
  *
457
  * @since 1.7.2
 
458
  * @var string
459
  */
460
  public $rating_prompt_config;
463
  * The Restore Helper class.
464
  *
465
  * @since 1.6.1
 
466
  * @var Boldgrid_Backup_Admin_Restore_Helper
467
  */
468
  public $restore_helper;
471
  * The scheduler class object.
472
  *
473
  * @since 1.5.1
 
474
  * @var Boldgrid_Backup_Admin_Scheduler
475
  */
476
  public $scheduler;
479
  * The public download class object.
480
  *
481
  * @since 1.7.0
 
482
  * @var Boldgrid_Backup_Download
483
  */
484
  public $download;
487
  * An instance of the Boldgrid\Library\Library\Activity class.
488
  *
489
  * @since 1.7.2
 
490
  * @var Boldgrid\Library\Library\Activity
491
  */
492
  public $activity;
562
 
563
  $this->archive_fail = new Boldgrid_Backup_Admin_Archive_Fail( $this );
564
 
565
+ $this->archiver_utility = new Boldgrid_Backup_Admin_Archiver_Utility( $this );
566
+
567
  $this->wp_cron = new Boldgrid_Backup_Admin_WP_Cron( $this );
568
 
569
  $this->scheduler = new Boldgrid_Backup_Admin_Scheduler( $this );
710
  $this->premium->run();
711
  }
712
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
713
  /**
714
  * Execute a system command using an array of execution functions.
715
  *
716
  * @since 1.0
717
  *
718
+ * @see Boldgrid_Backup_Admin_Cli::call_command()
719
+ *
720
  * @param string $command A command string to be executed.
 
721
  * @param bool $success Success or failure of the operation, passed back.
722
  * @param int $return_var If present, the return_var, passed back.
723
  * @param string $filepath An optional file path to write the output.
724
  * @return string|bool Returns the command output or FALSE on error.
725
  */
726
+ public function execute_command( $command, &$success = false, &$return_var = 0, $filepath = null ) {
727
  // If no command was passed, then fail.
728
  if ( empty( $command ) ) {
729
  return false;
730
  }
731
 
 
 
 
 
 
732
  // If an output filepath is supplied, and the directory is writable, then write to file.
733
  if ( $filepath && $this->wp_filesystem->is_writable( dirname( $filepath ) ) ) {
734
  $command .= ' > ' . wp_normalize_path( $filepath );
739
  $command .= ' 2>/dev/null';
740
  }
741
 
742
+ $output = Boldgrid_Backup_Admin_Cli::call_command( $command, $success, $return_var );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
 
 
 
 
 
 
 
744
  return $output;
745
  }
746
 
991
  *
992
  * @see Boldgrid_Backup_Admin_Test::run_functionality_tests()
993
  * @see Boldgrid_Backup_Admin_Backup_Dir::get()
 
994
  * @see Boldgrid_Backup_Admin_Utility::update_siteurl()
995
  * @global WP_Filesystem $wp_filesystem The WordPress Filesystem API global object.
996
  * @global wpdb $wpdb The WordPress database class object.
1301
  *
1302
  * @since 1.0
1303
  *
1304
+ * @see Boldgrid_Backup_Admin_Core::backup_database()
1305
+ * @see Boldgrid_Backup_Admin_Archive::write_results_file()
1306
  *
1307
  * @param bool $save A switch to save the archive file. Default is FALSE.
1308
  * @param bool $dryrun An optional switch to perform a dry run test.
1311
  public function archive_files( $save = false, $dryrun = false ) {
1312
  $this->pre_auto_update = 'pre_auto_update' === current_filter();
1313
 
1314
+ $this->is_scheduled_backup = $this->doing_cron && ! $this->pre_auto_update;
1315
+
1316
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
1317
  array(
1318
  'status' => __( 'Initializing backup', 'boldgrid-backup' ),
1330
  $this->in_progress->set();
1331
  }
1332
 
 
 
1333
  /*
1334
  * If this is a scheduled backup and no location is selected to save the
1335
  * backup to, abort.
1339
  * wanted to change their retention settings but did not want to schedule
1340
  * backups, validating storage locations would be problematic.
1341
  */
1342
+ if ( $this->is_scheduled_backup && ! $this->remote->any_enabled() ) {
1343
  $error = __( 'No backup locations selected! While we could create a backup archive, you have not selected where the backup archive should be saved to. Please choose a storage location in your BoldGrid Backup Settings to save this backup archive to.', 'boldgrid-backup' );
1344
  $this->archive_fail->schedule_fail_email( $error );
1345
  return array(
1370
  * adjust which folders are actually included / excluded.
1371
  */
1372
  $info = array(
1373
+ 'mode' => 'backup',
1374
+ 'dryrun' => $dryrun,
1375
+ 'compressor' => null,
1376
+ 'filesize' => 0,
1377
+ 'save' => $save,
1378
+ 'total_size' => 0,
1379
+ 'folder_include' => $this->folder_exclusion->from_settings( 'include' ),
1380
+ 'folder_exclude' => $this->folder_exclusion->from_settings( 'exclude' ),
1381
+ 'table_exclude' => $this->db_omit->get_excluded_tables(),
1382
+ 'title' => ! empty( $_POST['backup_title'] ) ? stripslashes( $_POST['backup_title'] ) : null, // phpcs:ignore WordPress.CSRF.NonceVerification,WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine
1383
+ 'description' => ! empty( $_POST['backup_description'] ) ? stripslashes( $_POST['backup_description'] ) : null, // phpcs:ignore WordPress.CSRF.NonceVerification,WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine
1384
+ // Information used for the emergency restoration process.
1385
+ 'ABSPATH' => ABSPATH,
1386
+ 'backup_id' => $this->get_backup_identifier(),
1387
+ 'siteurl' => site_url(),
1388
+ 'timestamp' => time(),
1389
+ // Environment information.
1390
+ 'gateway_interface' => getenv( 'GATEWAY_INTERFACE' ),
1391
+ 'http_host' => getenv( 'HTTP_HOST' ),
1392
+ 'php_sapi_name' => php_sapi_name(),
1393
+ 'php_uname' => php_uname(),
1394
+ 'php_version' => phpversion(),
1395
+ 'server_addr' => getenv( 'SERVER_ADDR' ) ? getenv( 'SERVER_ADDR' ) : getenv( 'LOCAL_ADDR' ),
1396
+ 'server_name' => getenv( 'SERVER_NAME' ),
1397
+ 'server_protocol' => getenv( 'SERVER_PROTOCOL' ),
1398
+ 'server_software' => getenv( 'SERVER_SOFTWARE' ),
1399
+ 'uid' => getmyuid(),
1400
+ 'username' => get_current_user(),
1401
  );
1402
 
1403
  // Determine how this backup was triggered.
1569
  // Stop timer.
1570
  $time_stop = microtime( true );
1571
 
1572
+ // Calculate duration.
1573
  $info['duration'] = number_format( ( $time_stop - $time_start ), 2, '.', '' );
1574
  $info['db_duration'] = number_format( ( $db_time_stop - $time_start ), 2, '.', '' );
1575
+ $info['db_filename'] = basename( $this->db_dump_filepath );
1576
 
1577
  /**
1578
  * Actions to take after a backup has been created.
1585
  *
1586
  * @since 1.5.2
1587
  *
1588
+ * @param array $info {
1589
  * An array of info about the backup just created.
1590
  *
1591
  * @type string $mode backup
1612
  * not only include the standard info about the backup (which we're sending now), it will
1613
  * also include info about other jobs that were ran (such as uploading the backup remotely).
1614
  */
1615
+ if ( $this->email->user_wants_notification( 'backup' ) && ! $this->is_scheduled_backup ) {
1616
  $email_parts = $this->email->post_archive_parts( $info );
1617
  $email_body = $email_parts['body']['main'] . $email_parts['body']['signature'];
1618
  $info['mail_success'] = $this->email->send( $email_parts['subject'], $email_body );
1625
 
1626
  $this->archive_log->write( $info );
1627
 
 
 
1628
  // Enforce retention setting.
1629
  $this->enforce_retention();
1630
 
1631
  update_option( 'boldgrid_backup_latest_backup', $info );
1632
  }
1633
 
1634
+ // Actions to take if we're creating a full site backup.
1635
+ if ( ! $dryrun && $this->archiver_utility->is_full_backup() ) {
1636
+ $this->archive->write_results_file( $info );
1637
+ }
1638
+
1639
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
1640
  array(
1641
  'status' => __( 'Backup complete!', 'boldgrid-backup' ),
2246
 
2247
  $this->is_backup_now = true;
2248
 
2249
+ $is_all_files = isset( $_POST['folder_exclusion_type'] ) && 'full' === $_POST['folder_exclusion_type'];
2250
+ $is_all_tables = isset( $_POST['table_inclusion_type'] ) && 'full' === $_POST['table_inclusion_type'];
2251
+ $this->is_backup_full = $is_all_files && $is_all_tables;
2252
 
2253
  $this->is_archiving_update_protection = ! empty( $_POST['is_updating'] ) &&
2254
  'true' === $_POST['is_updating'];
admin/class-boldgrid-backup-admin-cron.php CHANGED
@@ -81,6 +81,15 @@ class Boldgrid_Backup_Admin_Cron {
81
  $this->core = $core;
82
  }
83
 
 
 
 
 
 
 
 
 
 
84
  /**
85
  * Add cron entry for backups from stored settings.
86
  *
@@ -395,6 +404,8 @@ class Boldgrid_Backup_Admin_Cron {
395
  *
396
  * @since 1.6.0
397
  *
 
 
398
  * @param string $crontab A string of crons, similar to raw output of crontab -l.
399
  * @return bool
400
  */
@@ -429,7 +440,7 @@ class Boldgrid_Backup_Admin_Cron {
429
  // Write crontab.
430
  $command = 'crontab ' . $temp_crontab_path;
431
 
432
- $crontab = $this->core->execute_command( $command, null, $success );
433
 
434
  // Remove temp crontab file.
435
  $deleted = $this->core->wp_filesystem->delete( $temp_crontab_path, false, 'f' );
@@ -442,6 +453,8 @@ class Boldgrid_Backup_Admin_Cron {
442
  *
443
  * @since 1.2
444
  *
 
 
445
  * @global WP_Filesystem $wp_filesystem The WordPress Filesystem API global object.
446
  *
447
  * @param string $mode Please see in-method comments when the $pattern is
@@ -491,7 +504,7 @@ class Boldgrid_Backup_Admin_Cron {
491
  // Read crontab.
492
  $command = 'crontab -l';
493
 
494
- $crontab = $this->core->execute_command( $command, null, $success );
495
 
496
  // If the command to retrieve crontab failed, then abort.
497
  if ( ! $success ) {
@@ -540,7 +553,7 @@ class Boldgrid_Backup_Admin_Cron {
540
  // Write crontab.
541
  $command = 'crontab ' . $temp_crontab_path;
542
 
543
- $crontab = $this->core->execute_command( $command, null, $success );
544
 
545
  // Remove temp crontab file.
546
  $wp_filesystem->delete( $temp_crontab_path, false, 'f' );
@@ -644,6 +657,8 @@ class Boldgrid_Backup_Admin_Cron {
644
  *
645
  * @since 1.5.2
646
  *
 
 
647
  * @param bool $raw Return a string of crons when true, an array when false.
648
  * @return mixed
649
  */
@@ -672,7 +687,7 @@ class Boldgrid_Backup_Admin_Cron {
672
 
673
  // Write crontab to temp file.
674
  $command = sprintf( 'crontab -l > %1$s', $crontab_file_path );
675
- $this->core->execute_command( $command, null, $success );
676
 
677
  // Read the crontab from temp file.
678
  $crontab = $this->core->wp_filesystem->get_contents( $crontab_file_path );
@@ -681,7 +696,7 @@ class Boldgrid_Backup_Admin_Cron {
681
  $this->core->wp_filesystem->delete( $crontab_file_path );
682
  } else {
683
  $command = 'crontab -l';
684
- $crontab = $this->core->execute_command( $command, null, $success );
685
  }
686
 
687
  if ( ! $success ) {
81
  $this->core = $core;
82
  }
83
 
84
+ /**
85
+ * Get the cron command prefix.
86
+ *
87
+ * @return string
88
+ */
89
+ public function get_cron_command() {
90
+ return $this->cron_command;
91
+ }
92
+
93
  /**
94
  * Add cron entry for backups from stored settings.
95
  *
404
  *
405
  * @since 1.6.0
406
  *
407
+ * @see Boldgrid_Backup_Admin_Core::execute_command()
408
+ *
409
  * @param string $crontab A string of crons, similar to raw output of crontab -l.
410
  * @return bool
411
  */
440
  // Write crontab.
441
  $command = 'crontab ' . $temp_crontab_path;
442
 
443
+ $crontab = $this->core->execute_command( $command, $success );
444
 
445
  // Remove temp crontab file.
446
  $deleted = $this->core->wp_filesystem->delete( $temp_crontab_path, false, 'f' );
453
  *
454
  * @since 1.2
455
  *
456
+ * @see Boldgrid_Backup_Admin_Core::execute_command()
457
+ *
458
  * @global WP_Filesystem $wp_filesystem The WordPress Filesystem API global object.
459
  *
460
  * @param string $mode Please see in-method comments when the $pattern is
504
  // Read crontab.
505
  $command = 'crontab -l';
506
 
507
+ $crontab = $this->core->execute_command( $command, $success );
508
 
509
  // If the command to retrieve crontab failed, then abort.
510
  if ( ! $success ) {
553
  // Write crontab.
554
  $command = 'crontab ' . $temp_crontab_path;
555
 
556
+ $crontab = $this->core->execute_command( $command, $success );
557
 
558
  // Remove temp crontab file.
559
  $wp_filesystem->delete( $temp_crontab_path, false, 'f' );
657
  *
658
  * @since 1.5.2
659
  *
660
+ * @see Boldgrid_Backup_Admin_Core::execute_command()
661
+ *
662
  * @param bool $raw Return a string of crons when true, an array when false.
663
  * @return mixed
664
  */
687
 
688
  // Write crontab to temp file.
689
  $command = sprintf( 'crontab -l > %1$s', $crontab_file_path );
690
+ $this->core->execute_command( $command, $success );
691
 
692
  // Read the crontab from temp file.
693
  $crontab = $this->core->wp_filesystem->get_contents( $crontab_file_path );
696
  $this->core->wp_filesystem->delete( $crontab_file_path );
697
  } else {
698
  $command = 'crontab -l';
699
+ $crontab = $this->core->execute_command( $command, $success );
700
  }
701
 
702
  if ( ! $success ) {
admin/class-boldgrid-backup-admin-folder-exclusion.php CHANGED
@@ -146,6 +146,11 @@ class Boldgrid_Backup_Admin_Folder_Exclusion {
146
  return false;
147
  }
148
 
 
 
 
 
 
149
  // Get comma-delimited lists from user input or settings. Sanitizing is done below.
150
  $include = $this->in_ajax_preview ? $_POST['include'] : $this->from_settings( 'include' );
151
  $exclude = $this->in_ajax_preview ? $_POST['exclude'] : $this->from_settings( 'exclude' );
146
  return false;
147
  }
148
 
149
+ // Do not allow the "cron/restore-info.json" file used for emergency restorations.
150
+ if ( $this->is_match( 'cron/restore-info.json', $file ) ) {
151
+ return false;
152
+ }
153
+
154
  // Get comma-delimited lists from user input or settings. Sanitizing is done below.
155
  $include = $this->in_ajax_preview ? $_POST['include'] : $this->from_settings( 'include' );
156
  $exclude = $this->in_ajax_preview ? $_POST['exclude'] : $this->from_settings( 'exclude' );
admin/class-boldgrid-backup-admin-restore-helper.php CHANGED
@@ -165,14 +165,17 @@ class Boldgrid_Backup_Admin_Restore_Helper {
165
  /**
166
  * Prepare for a restoration via cron job.
167
  *
 
 
168
  * @since 1.6.1
169
  *
170
  * @return bool
171
  */
172
  public function prepare_restore() {
 
173
  $pending_rollback = get_site_option( 'boldgrid_backup_pending_rollback' );
174
 
175
- if ( empty( $pending_rollback ) ) {
176
  return false;
177
  }
178
 
@@ -182,9 +185,12 @@ class Boldgrid_Backup_Admin_Restore_Helper {
182
  * The archive_key and the archive_filename must match.
183
  */
184
  $_POST['restore_now'] = 1;
185
- $_POST['archive_key'] = 0;
186
- $_POST['archive_filename'] = basename( $pending_rollback['filepath'] );
 
 
187
 
 
188
  return true;
189
  }
190
 
165
  /**
166
  * Prepare for a restoration via cron job.
167
  *
168
+ * The restoration request is validated elsewhere.
169
+ *
170
  * @since 1.6.1
171
  *
172
  * @return bool
173
  */
174
  public function prepare_restore() {
175
+ // phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification,WordPress.VIP
176
  $pending_rollback = get_site_option( 'boldgrid_backup_pending_rollback' );
177
 
178
+ if ( empty( $pending_rollback ) && empty( $_GET['archive_filename'] ) ) {
179
  return false;
180
  }
181
 
185
  * The archive_key and the archive_filename must match.
186
  */
187
  $_POST['restore_now'] = 1;
188
+ $_POST['archive_key'] = ( ! empty( $_GET['archive_key'] ) && is_numeric( $_GET['archive_key'] ) ) ?
189
+ (int) $_GET['archive_key'] : 0;
190
+ $_POST['archive_filename'] = ! empty( $pending_rollback['filepath'] ) ?
191
+ basename( $pending_rollback['filepath'] ) : $_GET['archive_filename'];
192
 
193
+ // phpcs:enable WordPress.CSRF.NonceVerification.NoNonceVerification,WordPress.VIP
194
  return true;
195
  }
196
 
admin/class-boldgrid-backup-admin-settings.php CHANGED
@@ -79,6 +79,20 @@ class Boldgrid_Backup_Admin_Settings {
79
  return $count;
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  /**
83
  * Get settings using defaults.
84
  *
@@ -220,6 +234,55 @@ class Boldgrid_Backup_Admin_Settings {
220
  return $settings;
221
  }
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  /**
224
  * Move backups from one directory to another.
225
  *
79
  return $count;
80
  }
81
 
82
+ /**
83
+ * Get a setting from the settings.
84
+ *
85
+ * @since 1.9.0
86
+ *
87
+ * @param string $key The setting name.
88
+ * @return mixed
89
+ */
90
+ public function get_setting( $key ) {
91
+ $settings = $this->get_settings();
92
+
93
+ return isset( $settings[ $key ] ) ? $settings[ $key ] : null;
94
+ }
95
+
96
  /**
97
  * Get settings using defaults.
98
  *
234
  return $settings;
235
  }
236
 
237
+ /**
238
+ * Whether or not we are backing up all files, as defined in the settings.
239
+ *
240
+ * @since 1.9.0
241
+ *
242
+ * @return bool
243
+ */
244
+ public function is_all_files() {
245
+ $is_all = true;
246
+
247
+ $folder_exclusion_exclude = $this->get_setting( 'folder_exclusion_exclude' );
248
+ $folder_exclusion_include = $this->get_setting( 'folder_exclusion_include' );
249
+
250
+ if ( $this->core->folder_exclusion->default_include !== $folder_exclusion_include ) {
251
+ $is_all = false;
252
+ }
253
+
254
+ if ( $this->core->folder_exclusion->default_exclude !== $folder_exclusion_exclude ) {
255
+ $is_all = false;
256
+ }
257
+
258
+ /**
259
+ * Filter whether or not the backup is considered backing up all files.
260
+ *
261
+ * For example, an advanced user may have custom include / exclude settings, and wants this
262
+ * to be considered a backup of all their files.
263
+ *
264
+ * @since 1.9.0
265
+ *
266
+ * @param bool $is_all The current value of $is_all.
267
+ */
268
+ apply_filters( 'boldgrid_backup_settings_is_all_files', $is_all );
269
+
270
+ return $is_all;
271
+ }
272
+
273
+ /**
274
+ * Whether or not we are backing up all tables, as defined in the settings.
275
+ *
276
+ * @since 1.9.0
277
+ *
278
+ * @return bool
279
+ */
280
+ public function is_all_tables() {
281
+ $exclude_tables = $this->get_setting( 'exclude_tables' );
282
+
283
+ return empty( $exclude_tables );
284
+ }
285
+
286
  /**
287
  * Move backups from one directory to another.
288
  *
admin/class-boldgrid-backup-admin-test.php CHANGED
@@ -26,7 +26,6 @@ class Boldgrid_Backup_Admin_Test {
26
  * When we create test files, this is the prefix for all of them.
27
  *
28
  * @since 1.5.1
29
- * @access public
30
  * @var string
31
  */
32
  public $test_prefix = 'boldgrid-backup-test-file-';
@@ -109,7 +108,6 @@ class Boldgrid_Backup_Admin_Test {
109
  * Default value is 300 seconds (5 minutes).
110
  *
111
  * @since 1.3.1
112
- * @access public
113
  * @var int
114
  */
115
  public $transient_time = 300;
@@ -144,7 +142,7 @@ class Boldgrid_Backup_Admin_Test {
144
 
145
  // Write the file with an exec method.
146
  $command = sprintf( 'echo "%1$s" > %2$s', $txt, $file );
147
- $this->core->execute_command( $command, array(), $success );
148
  if ( ! $success ) {
149
  return false;
150
  }
@@ -674,7 +672,7 @@ class Boldgrid_Backup_Admin_Test {
674
 
675
  // Find a command that gives us an array.
676
  foreach ( $cmds as $cmd ) {
677
- $this->core->execute_command( $cmd, array(), $null, $null, $filepath );
678
 
679
  // Our command may have resulted in unexpected output. Look for a json string.
680
  preg_match( '/{.*}/', $this->core->wp_filesystem->get_contents( $filepath ), $matches );
26
  * When we create test files, this is the prefix for all of them.
27
  *
28
  * @since 1.5.1
 
29
  * @var string
30
  */
31
  public $test_prefix = 'boldgrid-backup-test-file-';
108
  * Default value is 300 seconds (5 minutes).
109
  *
110
  * @since 1.3.1
 
111
  * @var int
112
  */
113
  public $transient_time = 300;
142
 
143
  // Write the file with an exec method.
144
  $command = sprintf( 'echo "%1$s" > %2$s', $txt, $file );
145
+ $this->core->execute_command( $command, $success );
146
  if ( ! $success ) {
147
  return false;
148
  }
672
 
673
  // Find a command that gives us an array.
674
  foreach ( $cmds as $cmd ) {
675
+ $this->core->execute_command( $cmd, $null, $null, $filepath );
676
 
677
  // Our command may have resulted in unexpected output. Look for a json string.
678
  preg_match( '/{.*}/', $this->core->wp_filesystem->get_contents( $filepath ), $matches );
admin/compressor/class-boldgrid-backup-admin-compressor-php-zip.php CHANGED
@@ -91,9 +91,15 @@ class Boldgrid_Backup_Admin_Compressor_Php_Zip extends Boldgrid_Backup_Admin_Com
91
  *
92
  * @see Boldgrid_Backup_Admin_Filelist::get_total_size()
93
  *
94
- * @param array $filelist File list.