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

Version Description

Release date: May 21st, 2020

  • Update: If backup email fails, debug info written to log file.
  • Update: Definition added to allow for skipping email headers.
Download this release

Release Info

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

Code changes from version 1.14.0-rc.2 to 1.13.4

Files changed (54) hide show
  1. admin/card/class-find-modified-files.php +0 -7
  2. admin/card/class-premium.php +1 -1
  3. admin/card/class-timely-auto-updates.php +0 -50
  4. admin/card/class-updates.php +0 -6
  5. admin/card/feature/class-database-encryption.php +1 -1
  6. admin/card/feature/class-remote-storage.php +1 -1
  7. admin/card/feature/class-scheduled-backups.php +1 -1
  8. admin/card/feature/class-timely-auto-updates.php +0 -57
  9. admin/class-boldgrid-backup-admin-archive-browser.php +5 -7
  10. admin/class-boldgrid-backup-admin-archive-details.php +0 -30
  11. admin/class-boldgrid-backup-admin-auto-rollback.php +18 -16
  12. admin/class-boldgrid-backup-admin-auto-updates.php +0 -217
  13. admin/class-boldgrid-backup-admin-core.php +23 -79
  14. admin/class-boldgrid-backup-admin-dashboard.php +0 -36
  15. admin/class-boldgrid-backup-admin-db-dump.php +1 -15
  16. admin/class-boldgrid-backup-admin-db-import.php +13 -217
  17. admin/class-boldgrid-backup-admin-db-omit.php +1 -1
  18. admin/class-boldgrid-backup-admin-email.php +35 -2
  19. admin/class-boldgrid-backup-admin-go-pro.php +1 -1
  20. admin/class-boldgrid-backup-admin-notice.php +3 -43
  21. admin/class-boldgrid-backup-admin-premium-features.php +0 -38
  22. admin/class-boldgrid-backup-admin-settings.php +3 -40
  23. admin/class-boldgrid-backup-admin-support.php +1 -36
  24. admin/class-boldgrid-backup-admin-tools.php +2 -36
  25. admin/class-boldgrid-backup-admin-transfers.php +0 -35
  26. admin/class-boldgrid-backup-admin-upload.php +0 -23
  27. admin/class-boldgrid-backup-admin.php +0 -29
  28. admin/css/boldgrid-backup-admin-settings.css +0 -31
  29. admin/css/boldgrid-backup-admin.css +0 -67
  30. admin/image/icon-128x128.png +0 -0
  31. admin/js/boldgrid-backup-admin-backup-now.js +1 -1
  32. admin/js/boldgrid-backup-admin-folder-exclude.js +17 -82
  33. admin/js/boldgrid-backup-admin-home.js +2 -12
  34. admin/js/boldgrid-backup-admin-settings-autoupdate.js +21 -64
  35. admin/js/{boldgrid-backup-admin-table-includes.js → boldgrid-backup-admin-table-include.js} +9 -46
  36. admin/partials/archives/add-new.php +6 -16
  37. admin/partials/boldgrid-backup-admin-archive-details.php +19 -24
  38. admin/partials/boldgrid-backup-admin-backup-button.php +3 -2
  39. admin/partials/boldgrid-backup-admin-dashboard.php +8 -3
  40. admin/partials/boldgrid-backup-admin-home.php +31 -36
  41. admin/partials/boldgrid-backup-admin-premium.php +10 -4
  42. admin/partials/boldgrid-backup-admin-settings.php +34 -29
  43. admin/partials/boldgrid-backup-admin-support.php +54 -49
  44. admin/partials/boldgrid-backup-admin-test.php +4 -3
  45. admin/partials/boldgrid-backup-admin-tools.php +7 -3
  46. admin/partials/boldgrid-backup-admin-transfers.php +5 -7
  47. admin/partials/settings/auto-backup.php +30 -52
  48. admin/partials/settings/auto-update.php +0 -435
  49. admin/partials/settings/backup-security.php +3 -8
  50. admin/partials/settings/storage.php +1 -1
  51. admin/partials/tools/local-remote.php +12 -8
  52. admin/partials/transfers/destination.php +2 -4
  53. boldgrid-backup.php +1 -1
  54. coverage.xml +5546 -6914
admin/card/class-find-modified-files.php CHANGED
@@ -37,12 +37,5 @@ class Find_Modified_Files extends \Boldgrid\Library\Library\Ui\Card {
37
  'Search for all files modified within a certain time period. You can also look for other versions of that file within your backups.',
38
  'boldgrid-backup' ) .
39
  '</p>';
40
-
41
- $url = esc_url( 'https://www.boldgrid.com/support/total-upkeep/additional-tools/' );
42
-
43
- $this->links = '
44
- <a target="_blank" href=" ' . $url . '">' .
45
- esc_html__( 'Setup Guide' ) . '
46
- </a>';
47
  }
48
  }
37
  'Search for all files modified within a certain time period. You can also look for other versions of that file within your backups.',
38
  'boldgrid-backup' ) .
39
  '</p>';
 
 
 
 
 
 
 
40
  }
41
  }
admin/card/class-premium.php CHANGED
@@ -38,7 +38,7 @@ class Premium extends \Boldgrid\Library\Library\Ui\Card {
38
  $features = [];
39
 
40
  if ( empty( $api_key ) ) {
41
- $this->title = esc_html__( 'BoldGrid Central', 'boldgrid-backup' );
42
 
43
  $this->subTitle = esc_html__( 'All the tools and services you need to succeed.', 'boldgrid-backup' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
44
 
38
  $features = [];
39
 
40
  if ( empty( $api_key ) ) {
41
+ $this->title = esc_html__( 'Build Better Websites With BoldGrid Central', 'boldgrid-backup' );
42
 
43
  $this->subTitle = esc_html__( 'All the tools and services you need to succeed.', 'boldgrid-backup' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
44
 
admin/card/class-timely-auto-updates.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
- /**
3
- * Timely Auto Updates class.
4
- *
5
- * @link https://www.boldgrid.com
6
- * @since 1.14.0
7
- *
8
- * @package Boldgrid\Backup
9
- * @subpackage Boldgrid\Backup\Card
10
- * @copyright BoldGrid
11
- * @author BoldGrid <support@boldgrid.com>
12
- */
13
-
14
- namespace Boldgrid\Backup\Admin\Card;
15
-
16
- /**
17
- * Class: Timely Auto Updates
18
- *
19
- * This class is responsible for rendering the "Timely Auto Updates" card on this plugin's Premium Features page.
20
- *
21
- * @since 1.14.0
22
- */
23
- class Timely_Auto_Updates extends \Boldgrid\Library\Library\Ui\Card {
24
- /**
25
- * Init.
26
- *
27
- * @since 1.14.0
28
- */
29
- public function init() {
30
- $this->id = 'bgbkup_timely_auto_updates';
31
-
32
- $this->title = esc_html__( 'Timely Auto Updates', 'boldgrid-backup' );
33
-
34
- $this->footer = '
35
- <p>' .
36
- esc_html__(
37
- 'Gives you more control over when new updates are installed by WordPress\' Automatic Updates.',
38
- 'boldgrid-backup' ) .
39
- '</p>';
40
-
41
- $url = esc_url( 'https://www.boldgrid.com/support/total-upkeep/timely-auto-updates/' );
42
-
43
- $this->links = '
44
- <a target="_blank" href="' . $url . '">' .
45
- esc_html__( 'Setup Guide', 'boldgrid-backup' ) . '
46
- </a>';
47
-
48
- $this->icon = '<span class="dashicons dashicons-clock"></span>';
49
- }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/card/class-updates.php CHANGED
@@ -27,9 +27,6 @@ class Updates extends \Boldgrid\Library\Library\Ui\Card {
27
  * @since 1.11.0
28
  */
29
  public function init() {
30
-
31
- $core = apply_filters( 'boldgrid_backup_get_core', null );
32
-
33
  $this->id = 'bgbkup_updates';
34
 
35
  $this->title = esc_html__( 'Update Management', 'boldgrid-backup' );
@@ -43,8 +40,5 @@ class Updates extends \Boldgrid\Library\Library\Ui\Card {
43
  new Feature\Auto_Rollback(),
44
  new Feature\Auto_Update_Backup(),
45
  ];
46
- if ( $core->config->get_is_premium() ) {
47
- $this->features[] = new Feature\Timely_Auto_Updates();
48
- }
49
  }
50
  }
27
  * @since 1.11.0
28
  */
29
  public function init() {
 
 
 
30
  $this->id = 'bgbkup_updates';
31
 
32
  $this->title = esc_html__( 'Update Management', 'boldgrid-backup' );
40
  new Feature\Auto_Rollback(),
41
  new Feature\Auto_Update_Backup(),
42
  ];
 
 
 
43
  }
44
  }
admin/card/feature/class-database-encryption.php CHANGED
@@ -31,7 +31,7 @@ class Database_Encryption extends \Boldgrid\Library\Library\Ui\Feature {
31
 
32
  $this->title = esc_html__( 'Database Encryption', 'boldgrid-backup' );
33
 
34
- $this->content = '<p>' . esc_html__( 'Secure your sensitive data with Database Encryption.', 'boldgrid-backup' ) . '</p>';
35
  $this->content .= '<div class="notice notice-warning inline"><p>' . wp_kses(
36
  sprintf(
37
  // translators: 1 An opening anchor tag to the Remote Storage settings, 2 its closing anchor tag.
31
 
32
  $this->title = esc_html__( 'Database Encryption', 'boldgrid-backup' );
33
 
34
+ $this->content = '<p>' . esc_html__( 'Secure your sensitive data with database encryption.', 'boldgrid-backup' ) . '</p>';
35
  $this->content .= '<div class="notice notice-warning inline"><p>' . wp_kses(
36
  sprintf(
37
  // translators: 1 An opening anchor tag to the Remote Storage settings, 2 its closing anchor tag.
admin/card/feature/class-remote-storage.php CHANGED
@@ -55,7 +55,7 @@ class Remote_Storage extends \Boldgrid\Library\Library\Ui\Feature {
55
  $this->content .= '<div class="notice notice-error inline"><p>' . wp_kses(
56
  sprintf(
57
  // translators: 1 An opening anchor tag to the Remote Storage settings, 2 its closing anchor tag.
58
- __( 'Remote Storage is not configured. %1$sFix this%2$s', 'boldgrid-backup' ),
59
  '<a href="' . esc_url( $core->settings->get_settings_url( 'section_storage' ) ) . '">',
60
  '</a>'
61
  ),
55
  $this->content .= '<div class="notice notice-error inline"><p>' . wp_kses(
56
  sprintf(
57
  // translators: 1 An opening anchor tag to the Remote Storage settings, 2 its closing anchor tag.
58
+ __( 'Remote storage is not configured. %1$sFix this%2$s', 'boldgrid-backup' ),
59
  '<a href="' . esc_url( $core->settings->get_settings_url( 'section_storage' ) ) . '">',
60
  '</a>'
61
  ),
admin/card/feature/class-scheduled-backups.php CHANGED
@@ -71,7 +71,7 @@ class Scheduled_Backups extends \Boldgrid\Library\Library\Ui\Feature {
71
  $this->content .= '<div class="notice notice-error inline"><p>' . wp_kses(
72
  sprintf(
73
  // translators: 1 An opening anchor tag to the settings page, 2 its closing tag.
74
- __( 'Scheduled Backups not configured. %1$sFix this%2$s.', 'boldgrid-backup' ),
75
  '<a href="' . esc_url( $core->settings->get_settings_url() ) . '">',
76
  '</a>'
77
  ),
71
  $this->content .= '<div class="notice notice-error inline"><p>' . wp_kses(
72
  sprintf(
73
  // translators: 1 An opening anchor tag to the settings page, 2 its closing tag.
74
+ __( 'Scheduled backups not configured. %1$sFix this%2$s.', 'boldgrid-backup' ),
75
  '<a href="' . esc_url( $core->settings->get_settings_url() ) . '">',
76
  '</a>'
77
  ),
admin/card/feature/class-timely-auto-updates.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
- /**
3
- * Timely_Auto_Updates class.
4
- *
5
- * @link https://www.boldgrid.com
6
- * @since 1.14.0
7
- *
8
- * @package Boldgrid\Backup
9
- * @subpackage Boldgrid\Backup\Feature
10
- * @copyright BoldGrid
11
- * @author BoldGrid <support@boldgrid.com>
12
- */
13
-
14
- namespace Boldgrid\Backup\Admin\Card\Feature;
15
-
16
- /**
17
- * Class: Timely_Auto_Updates.
18
- *
19
- * This class is responsible for rendering the, "Timely Auto Updates" feature on the BoldGrid.
20
- * Backup Dashboard.
21
- *
22
- * @since 1.14.0
23
- */
24
- class Timely_Auto_Updates extends \Boldgrid\Library\Library\Ui\Feature {
25
- /**
26
- * Init.
27
- *
28
- * @since 1.14.0
29
- */
30
- public function init() {
31
- $core = apply_filters( 'boldgrid_backup_get_core', null );
32
-
33
- $this->icon = '<span class="dashicons dashicons-clock"></span>';
34
-
35
- $this->title = __( 'Timely Auto Updates', 'boldgrid-backup' );
36
-
37
- // Determine whether or not this feature is enabled.
38
- $auto_update_settings = $core->settings->get_setting( 'auto_update' );
39
-
40
- $is_enabled = ! empty( $auto_update_settings['timely-updates-enabled'] );
41
-
42
- if ( $is_enabled ) {
43
- $this->content = '<p>' . esc_html__( 'Timely Auto Updates are enabled!', 'boldgrid-backup' ) . '</p>';
44
- } else {
45
- $this->content = '<p>' . esc_html__( 'By setting up Timely Auto Updates, you can have more control over when new updates are installed by WordPress.', 'boldgrid-backup' ) . '</p>';
46
- $this->content .= '<div class="notice notice-warning inline"><p>' . wp_kses(
47
- sprintf(
48
- // translators: 1 Opening anchor tag to "Auto Updates" settings page, 2 its closing tag.
49
- __( 'Timely Auto Updates are not enabled. %1$sFix this%2$s.', 'boldgrid-backup' ),
50
- '<a href="' . esc_url( $core->settings->get_settings_url( 'section_auto_updates' ) ) . '">',
51
- '</a>'
52
- ),
53
- [ 'a' => [ 'href' => [] ] ]
54
- ) . '</p></div>';
55
- }
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/class-boldgrid-backup-admin-archive-browser.php CHANGED
@@ -322,19 +322,17 @@ class Boldgrid_Backup_Admin_Archive_Browser {
322
  $importer = new Boldgrid_Backup_Admin_Db_Import( $this->core );
323
  $success = $importer->import_from_archive( $filepath, $file );
324
 
325
- if ( true === $success ) {
326
  $this->core->notice->add_user_notice(
327
  // translators: 1: Filename 2: File path.
328
- sprintf( __( 'Success! Database %1$s imported from %2$s.', 'boldgrid-backup' ), $file, $filepath ),
329
- $this->core->notice->lang['dis_success']
330
  );
331
- } elseif ( false !== $success ) {
332
- $this->core->notice->add_user_notice( $success, $this->core->notice->lang['dis_error'] );
333
  } else {
334
  $this->core->notice->add_user_notice(
335
  // translators: 1: Filename 2: File path.
336
- sprintf( __( 'Error, unable to import database %1$s from %2$s.', 'boldgrid-backup' ), $file, $filepath ),
337
- $this->core->notice->lang['dis_error']
338
  );
339
  }
340
  }
322
  $importer = new Boldgrid_Backup_Admin_Db_Import( $this->core );
323
  $success = $importer->import_from_archive( $filepath, $file );
324
 
325
+ if ( ! $success ) {
326
  $this->core->notice->add_user_notice(
327
  // translators: 1: Filename 2: File path.
328
+ sprintf( __( 'Error, unable to import database %1$s from %2$s.', 'boldgrid-backup' ), $file, $filepath ),
329
+ $this->core->notice->lang['dis_error']
330
  );
 
 
331
  } else {
332
  $this->core->notice->add_user_notice(
333
  // translators: 1: Filename 2: File path.
334
+ sprintf( __( 'Success! Database %1$s imported from %2$s.', 'boldgrid-backup' ), $file, $filepath ),
335
+ $this->core->notice->lang['dis_success']
336
  );
337
  }
338
  }
admin/class-boldgrid-backup-admin-archive-details.php CHANGED
@@ -133,7 +133,6 @@ class Boldgrid_Backup_Admin_Archive_Details {
133
 
134
  $this->enqueue_scripts();
135
  $this->core->archive_actions->enqueue_scripts();
136
- $this->core->auto_rollback->enqueue_home_scripts();
137
 
138
  $archive_found = false;
139
 
@@ -162,36 +161,7 @@ class Boldgrid_Backup_Admin_Archive_Details {
162
  $title = $this->core->archive->get_attribute( 'title' );
163
  $description = $this->core->archive->get_attribute( 'description' );
164
 
165
- $settings = $this->core->settings->get_settings();
166
- wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
167
- wp_enqueue_style( 'bglib-ui-css' );
168
-
169
- $in_modal = true;
170
- $modal = include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-backup-modal.php';
171
- $in_modal = false;
172
-
173
- echo '
174
- <div class="wrap">
175
- <div id="bglib-page-container" class="bgbkup-page-container">
176
- <div id="bglib-page-top">
177
- <div id="bglib-page-header" class="bglib-has-logo">
178
- <h1>' . esc_html__( 'Total Upkeep Preflight Check', 'boldgrid-backup' ) . '</h1>
179
- <div class="page-title-actions">
180
- <a href="#TB_inline?width=800&amp;height=600&amp;inlineId=backup_now_content" class="thickbox page-title-action page-title-action-primary">' .
181
- esc_html__( 'Backup Site Now', 'boldgrid-backup' ) . '
182
- </a>
183
- <a class="page-title-action add-new">' . esc_html__( 'Upload Backup', 'boldgrid-backup' ) . '</a>
184
- </div>
185
- </div>
186
- </div>
187
- <div id="bglib-page-content">
188
- <div class="wp-header-end"></div>';
189
- echo $modal; //phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
190
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-archive-details.php';
191
- echo '
192
- </div>
193
- </div>
194
- </div>';
195
  }
196
 
197
  /**
133
 
134
  $this->enqueue_scripts();
135
  $this->core->archive_actions->enqueue_scripts();
 
136
 
137
  $archive_found = false;
138
 
161
  $title = $this->core->archive->get_attribute( 'title' );
162
  $description = $this->core->archive->get_attribute( 'description' );
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-archive-details.php';
 
 
 
 
165
  }
166
 
167
  /**
admin/class-boldgrid-backup-admin-auto-rollback.php CHANGED
@@ -358,25 +358,27 @@ class Boldgrid_Backup_Admin_Auto_Rollback {
358
  * @since 1.6.0
359
  */
360
  public function enqueue_update_selectors() {
361
- $handle = 'boldgrid-backup-admin-update-selectors';
362
-
363
- wp_register_script(
364
- $handle,
365
- plugin_dir_url( __FILE__ ) . 'js/boldgrid-backup-admin-update-selectors.js',
366
- array( 'jquery' ),
367
- BOLDGRID_BACKUP_VERSION,
368
- false
369
- );
 
370
 
371
- $localize_script_data = array(
372
- // Generally used as the title attr of a disable update button.
373
- 'backupInProgress' => __( 'Your website is currently being backed up. You can perform updates when the backup is complete.', 'boldgrid-backup' ),
374
- 'waitClass' => 'bgbu-wait',
375
- );
376
 
377
- wp_localize_script( $handle, 'boldgrid_backup_admin_update_selectors', $localize_script_data );
378
 
379
- wp_enqueue_script( $handle );
 
380
  }
381
 
382
  /**
358
  * @since 1.6.0
359
  */
360
  public function enqueue_update_selectors() {
361
+ if ( $this->on_update_page || $this->core->utility->is_admin_page( 'boldgrid-backup' ) ) {
362
+ $handle = 'boldgrid-backup-admin-update-selectors';
363
+
364
+ wp_register_script(
365
+ $handle,
366
+ plugin_dir_url( __FILE__ ) . 'js/boldgrid-backup-admin-update-selectors.js',
367
+ array( 'jquery' ),
368
+ BOLDGRID_BACKUP_VERSION,
369
+ false
370
+ );
371
 
372
+ $localize_script_data = array(
373
+ // Generally used as the title attr of a disable update button.
374
+ 'backupInProgress' => __( 'Your website is currently being backed up. You can perform updates when the backup is complete.', 'boldgrid-backup' ),
375
+ 'waitClass' => 'bgbu-wait',
376
+ );
377
 
378
+ wp_localize_script( $handle, 'boldgrid_backup_admin_update_selectors', $localize_script_data );
379
 
380
+ wp_enqueue_script( $handle );
381
+ }
382
  }
383
 
384
  /**
admin/class-boldgrid-backup-admin-auto-updates.php DELETED
@@ -1,217 +0,0 @@
1
- <?php
2
- /**
3
- * File: class-boldgrid-backup-admin-auto-updates.php
4
- *
5
- * @link https://www.boldgrid.com
6
- * @since 1.14.0
7
- *
8
- * @package Boldgrid_Backup
9
- * @subpackage Boldgrid_Backup/admin
10
- * @copyright BoldGrid
11
- * @version 1.14.0
12
- * @author BoldGrid <support@boldgrid.com>
13
- */
14
-
15
- use Boldgrid\Library\Library\Plugin\Plugins;
16
-
17
- /**
18
- * Class: Boldgrid_Backup_Admin_Auto_Updates.
19
- *
20
- * @since 1.14.0
21
- */
22
- class Boldgrid_Backup_Admin_Auto_Updates {
23
- /**
24
- * Settings.
25
- *
26
- * @since 1.14.0
27
- * @var array
28
- */
29
- public $settings;
30
-
31
- /**
32
- * Active Plugins.
33
- *
34
- * @since 1.14.0
35
- * @var array
36
- */
37
- public $plugins = array();
38
-
39
- /**
40
- * Themes.
41
- *
42
- * @since 1.14.0
43
- * @var array
44
- */
45
- public $themes = array();
46
-
47
- /**
48
- * Active Plugins.
49
- *
50
- * @since 1.14.0
51
- * @var Boldgrid_Backup_Admin_Core
52
- */
53
- public $core;
54
-
55
- /**
56
- * Constructor.
57
- *
58
- * @since 1.14.0
59
- */
60
- public function __construct() {
61
-
62
- $this->set_settings();
63
- $plugins = new \Boldgrid\Library\Library\Plugin\Plugins();
64
- $this->plugins = $plugins->getAllPlugins();
65
- $this->themes = new \Boldgrid\Library\Library\Theme\Themes();
66
- add_filter( 'automatic_updater_disabled', '__return_false' );
67
- }
68
-
69
- /**
70
- * Set Settings.
71
- *
72
- * @since 1.14.0
73
- */
74
- public function set_settings() {
75
- $boldgrid_backup_settings = get_site_option( 'boldgrid_backup_settings', array() );
76
- if ( isset( $boldgrid_backup_settings['auto_update'] ) ) {
77
- $this->settings = $boldgrid_backup_settings['auto_update'];
78
- } else {
79
- $this->settings = array(
80
- 'days' => 0,
81
- );
82
- }
83
- }
84
-
85
- /**
86
- * Maybe Update Plugin.
87
- *
88
- * @since 1.14.0
89
- *
90
- * @param string $slug Plugin Slug.
91
- * @return bool
92
- */
93
- public function maybe_update_plugin( $slug ) {
94
- $days_to_wait = $this->settings['days'];
95
- $plugin = \Boldgrid\Library\Library\Plugin\Plugins::getBySlug( $this->plugins, $slug );
96
- $plugin->setUpdateData();
97
-
98
- $days_since_release = $plugin->updateData->days; //phpcs:ignore WordPress.NamingConventions.ValidVariableName
99
- $plugin_update_enabled = array_key_exists( $plugin->getFile(), $this->settings['plugins'] ) ? (bool) $this->settings['plugins'][ $plugin->getFile() ] : (bool) $this->settings['plugins']['default'];
100
- $is_update_time = ( $days_since_release >= $days_to_wait );
101
- if ( $is_update_time && true === $plugin_update_enabled ) {
102
- return true;
103
- } else {
104
- return false;
105
- }
106
- }
107
-
108
- /**
109
- * Maybe Update Theme.
110
- *
111
- * @since 1.14.0
112
- *
113
- * @param string $stylesheet Theme's Stylesheet.
114
- * @return bool
115
- */
116
- public function maybe_update_theme( $stylesheet ) {
117
- $days_to_wait = $this->settings['days'];
118
- $theme = $this->themes->getFromStylesheet( $stylesheet );
119
- $days_since_release = $theme->updateData->days; //phpcs:ignore WordPress.NamingConventions.ValidVariableName
120
- $theme_update_enabled = isset( $this->settings['themes'][ $stylesheet ] ) ? (bool) $this->settings['themes'][ $stylesheet ] : (bool) $this->settings['plugins']['default'];
121
- $is_update_time = ( $days_since_release >= $days_to_wait );
122
-
123
- if ( $is_update_time && true === $theme_update_enabled ) {
124
- return true;
125
- } else {
126
- return false;
127
- }
128
- }
129
-
130
- /**
131
- * Auto Update Plugins.
132
- *
133
- * This method is the callback for the 'auto_update_plugin' action hook.
134
- *
135
- * @since 1.14.0
136
- *
137
- * @param bool $update Whether or not to update.
138
- * @param stdClass $item The item class passed to callback.
139
- * @return bool
140
- */
141
- public function auto_update_plugins( $update, stdClass $item ) {
142
- // Array of plugin slugs to always auto-update.
143
- $plugins = array();
144
- foreach ( $this->plugins as $plugin ) {
145
- if ( $this->maybe_update_plugin( $plugin->getSlug() ) ) {
146
- $plugins[] = $plugin->getSlug();
147
- }
148
- }
149
- if ( in_array( $item->slug, $plugins, true ) ) {
150
- // Always update plugins in this array.
151
- return true;
152
- } else {
153
- // Else, Do Not Update Plugin.
154
- return false;
155
- }
156
- }
157
-
158
- /**
159
- * Auto Update Themes.
160
- *
161
- * This method is the callback for the 'auto_update_theme' action hook.
162
- *
163
- * @since 1.14.0
164
- *
165
- * @param bool $update Whether or not to update.
166
- * @param stdClass $item The item class passed to callback.
167
- * @return bool
168
- */
169
- public function auto_update_themes( $update, stdClass $item ) {
170
- // Array of theme stylesheets to always auto-update.
171
- $themes = array();
172
- foreach ( $this->themes->get() as $theme ) {
173
- if ( $this->maybe_update_theme( $theme->stylesheet ) ) {
174
- $themes[] = $theme->stylesheet;
175
- }
176
- }
177
- if ( in_array( $item->theme, $themes, true ) ) {
178
- // Always update themes in this array.
179
- return true;
180
- } else {
181
- // Else, Do Not Update theme.
182
- return false;
183
- }
184
- }
185
-
186
- /**
187
- * Auto Update Core.
188
- *
189
- * Sets the type of updates to perform for wpcore.
190
- *
191
- * @since 1.14.0
192
- */
193
- public function auto_update_core() {
194
- $wpcs_default = array(
195
- 'all' => false,
196
- 'minor' => true,
197
- 'major' => false,
198
- 'translation' => false,
199
- 'dev' => false,
200
- );
201
-
202
- $wpcs = isset( $this->settings['wpcore'] ) ? $this->settings['wpcore'] : $wpcs_default;
203
- if ( $wpcs['all'] ) {
204
- add_filter( 'auto_update_core', '__return_true' );
205
- }
206
-
207
- $dev = ( $wpcs['dev'] ) ? 'true' : 'false';
208
- $major = ( $wpcs['major'] ) ? 'true' : 'false';
209
- $minor = ( $wpcs['minor'] ) ? 'true' : 'false';
210
- $translation = ( $wpcs['translation'] ) ? 'true' : 'false';
211
-
212
- add_filter( 'allow_major_auto_core_updates', '__return_' . $major );
213
- add_filter( 'allow_minor_auto_core_updates', '__return_' . $minor );
214
- add_filter( 'auto_update_translation', '__return_' . $translation );
215
- add_filter( 'allow_dev_auto_core_updates', '__return_' . $dev );
216
- }
217
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/class-boldgrid-backup-admin-core.php CHANGED
@@ -342,6 +342,16 @@ class Boldgrid_Backup_Admin_Core {
342
  */
343
  public $archive_fail;
344
 
 
 
 
 
 
 
 
 
 
 
345
  /**
346
  * Db Dump.
347
  *
@@ -374,14 +384,6 @@ class Boldgrid_Backup_Admin_Core {
374
  */
375
  public $db_omit;
376
 
377
- /**
378
- * Database Restoration errro
379
- *
380
- * @since 1.14.0
381
- * @var string
382
- */
383
- public $db_restore_error;
384
-
385
  /**
386
  * An instance of Boldgrid_Backup_Admin_Filelist.
387
  *
@@ -562,14 +564,6 @@ class Boldgrid_Backup_Admin_Core {
562
  */
563
  public $activity;
564
 
565
- /**
566
- * An instance of the Auto Updates class
567
- *
568
- * @since 1.14.0
569
- * @var Boldgrid_Backup_Admin_Auto_Updates
570
- */
571
- public $auto_updates;
572
-
573
  /**
574
  * Constructor.
575
  *
@@ -698,12 +692,9 @@ class Boldgrid_Backup_Admin_Core {
698
  $this->dashboard = new Boldgrid_Backup_Admin_Dashboard( $this );
699
 
700
  // Instantiate Boldgrid\Library\Library\Plugin\Plugin.
701
- $this->plugin = \Boldgrid\Library\Library\Plugin\Factory::create( 'boldgrid-backup', $this->configs );
702
  $this->premium_page = new Boldgrid_Backup_Admin_Premium_Features( $this );
703
 
704
- // Instantiate Boldgrid_Backup_Admin_Auto_Updates.
705
- $this->auto_updates = new Boldgrid_Backup_Admin_Auto_Updates();
706
-
707
  // Ensure there is a backup identifier.
708
  $this->get_backup_identifier();
709
 
@@ -1261,7 +1252,6 @@ class Boldgrid_Backup_Admin_Core {
1261
  $status = $importer->import( $db_dump_filepath );
1262
 
1263
  if ( ! empty( $status['error'] ) ) {
1264
- $this->db_restore_error = $status['error'];
1265
  do_action( 'boldgrid_backup_notice', $status['error'], 'notice notice-error is-dismissible' );
1266
  return false;
1267
  }
@@ -1535,6 +1525,8 @@ class Boldgrid_Backup_Admin_Core {
1535
  * @return array An array of archive file information.
1536
  */
1537
  public function archive_files( $save = false, $dryrun = false ) {
 
 
1538
  $this->logger->init( 'archive-' . time() . '.log' );
1539
  $this->logger->add( 'Backup process initialized.' );
1540
 
@@ -1918,6 +1910,8 @@ class Boldgrid_Backup_Admin_Core {
1918
  $this->logger->add( 'Backup complete!' );
1919
  $this->logger->add_memory();
1920
 
 
 
1921
  // Return the array of archive information.
1922
  return $info;
1923
  }
@@ -2381,12 +2375,7 @@ class Boldgrid_Backup_Admin_Core {
2381
  $this->wp_filesystem->delete( $db_dump_filepath, false, 'f' );
2382
 
2383
  // Display notice of deletion status.
2384
- if ( ! $restore_ok && $this->db_restore_error ) {
2385
- return [
2386
- 'error' => $this->db_restore_error,
2387
- ];
2388
- }
2389
- if ( ! $restore_ok && ! $this->db_restore_error ) {
2390
  return [
2391
  'error' => esc_html__( 'Could not restore database.', 'boldgrid-backup' ),
2392
  ];
@@ -2433,6 +2422,7 @@ class Boldgrid_Backup_Admin_Core {
2433
  global $pagenow;
2434
 
2435
  // Thickbox used for Backup Site Now modal.
 
2436
  wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
2437
 
2438
  wp_enqueue_style( 'bglib-ui-css' );
@@ -2454,6 +2444,11 @@ class Boldgrid_Backup_Admin_Core {
2454
  $this->folder_exclusion->enqueue_scripts();
2455
  $this->db_omit->enqueue_scripts();
2456
 
 
 
 
 
 
2457
  // Get archive list.
2458
  $archives = $this->get_archive_list();
2459
 
@@ -2524,11 +2519,6 @@ class Boldgrid_Backup_Admin_Core {
2524
  // If there were any errors encountered during the backup, save them to the In Progress data.
2525
  if ( ! empty( $archive_info['error'] ) ) {
2526
  Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'error', $archive_info['error'] );
2527
- $this->notice->add_user_notice(
2528
- '<p>' . $archive_info['error'] . '</p>',
2529
- 'notice notice-error is-dismissible',
2530
- 'Backup Failed'
2531
- );
2532
  }
2533
 
2534
  if ( $this->is_archiving_update_protection ) {
@@ -2698,43 +2688,8 @@ class Boldgrid_Backup_Admin_Core {
2698
  BOLDGRID_BACKUP_VERSION, 'all'
2699
  );
2700
 
2701
- $settings = $this->settings->get_settings();
2702
- wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
2703
- wp_enqueue_style( 'bglib-ui-css' );
2704
-
2705
- $this->auto_rollback->enqueue_home_scripts();
2706
- $this->auto_rollback->enqueue_backup_scripts();
2707
- $this->archive_actions->enqueue_scripts();
2708
-
2709
- $this->folder_exclusion->enqueue_scripts();
2710
- $this->db_omit->enqueue_scripts();
2711
-
2712
- $in_modal = true;
2713
- $modal = include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-backup-modal.php';
2714
- $in_modal = false;
2715
-
2716
- echo '
2717
- <div class="wrap">
2718
- <div id="bglib-page-container" class="bgbkup-page-container">
2719
- <div id="bglib-page-top">
2720
- <div id="bglib-page-header" class="bglib-has-logo">
2721
- <h1>' . esc_html__( 'Total Upkeep Preflight Check', 'boldgrid-backup' ) . '</h1>
2722
- <div class="page-title-actions">
2723
- <a href="#TB_inline?width=800&amp;height=600&amp;inlineId=backup_now_content" class="thickbox page-title-action page-title-action-primary">' .
2724
- esc_html__( 'Backup Site Now', 'boldgrid-backup' ) . '
2725
- </a>
2726
- <a class="page-title-action add-new">' . esc_html__( 'Upload Backup', 'boldgrid-backup' ) . '</a>
2727
- </div>
2728
- </div>
2729
- </div>
2730
- <div id="bglib-page-content">
2731
- <div class="wp-header-end"></div>';
2732
- echo $modal; //phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
2733
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-test.php';
2734
- echo '
2735
- </div>
2736
- </div>
2737
- </div>';
2738
  }
2739
 
2740
  /**
@@ -2988,15 +2943,4 @@ class Boldgrid_Backup_Admin_Core {
2988
  $counter --;
2989
  }
2990
  }
2991
-
2992
- /**
2993
- * Add thickbox to bolgrid_backup admin pages.
2994
- *
2995
- * @since 1.14.0
2996
- */
2997
- public function add_thickbox( $hook_suffix ) {
2998
- if ( false !== strpos( $hook_suffix, 'boldgrid-backup' ) ) {
2999
- add_thickbox();
3000
- }
3001
- }
3002
  }
342
  */
343
  public $archive_fail;
344
 
345
+ /**
346
+ * Whether or not we're in the middle of archiving files.
347
+ *
348
+ * This is set at the beginning and end of self::archive_files().
349
+ *
350
+ * @since 1.13.4
351
+ * @var bool
352
+ */
353
+ public $archiving_files = false;
354
+
355
  /**
356
  * Db Dump.
357
  *
384
  */
385
  public $db_omit;
386
 
 
 
 
 
 
 
 
 
387
  /**
388
  * An instance of Boldgrid_Backup_Admin_Filelist.
389
  *
564
  */
565
  public $activity;
566
 
 
 
 
 
 
 
 
 
567
  /**
568
  * Constructor.
569
  *
692
  $this->dashboard = new Boldgrid_Backup_Admin_Dashboard( $this );
693
 
694
  // Instantiate Boldgrid\Library\Library\Plugin\Plugin.
695
+ $this->plugin = new \Boldgrid\Library\Library\Plugin\Plugin( 'boldgrid-backup', $this->configs );
696
  $this->premium_page = new Boldgrid_Backup_Admin_Premium_Features( $this );
697
 
 
 
 
698
  // Ensure there is a backup identifier.
699
  $this->get_backup_identifier();
700
 
1252
  $status = $importer->import( $db_dump_filepath );
1253
 
1254
  if ( ! empty( $status['error'] ) ) {
 
1255
  do_action( 'boldgrid_backup_notice', $status['error'], 'notice notice-error is-dismissible' );
1256
  return false;
1257
  }
1525
  * @return array An array of archive file information.
1526
  */
1527
  public function archive_files( $save = false, $dryrun = false ) {
1528
+ $this->archiving_files = true;
1529
+
1530
  $this->logger->init( 'archive-' . time() . '.log' );
1531
  $this->logger->add( 'Backup process initialized.' );
1532
 
1910
  $this->logger->add( 'Backup complete!' );
1911
  $this->logger->add_memory();
1912
 
1913
+ $this->archiving_files = false;
1914
+
1915
  // Return the array of archive information.
1916
  return $info;
1917
  }
2375
  $this->wp_filesystem->delete( $db_dump_filepath, false, 'f' );
2376
 
2377
  // Display notice of deletion status.
2378
+ if ( ! $restore_ok ) {
 
 
 
 
 
2379
  return [
2380
  'error' => esc_html__( 'Could not restore database.', 'boldgrid-backup' ),
2381
  ];
2422
  global $pagenow;
2423
 
2424
  // Thickbox used for Backup Site Now modal.
2425
+ add_thickbox();
2426
  wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
2427
 
2428
  wp_enqueue_style( 'bglib-ui-css' );
2444
  $this->folder_exclusion->enqueue_scripts();
2445
  $this->db_omit->enqueue_scripts();
2446
 
2447
+ // If uploading an archive file.
2448
+ if ( ! empty( $_FILES['file'] ) ) {
2449
+ $this->upload->upload_archive_file();
2450
+ }
2451
+
2452
  // Get archive list.
2453
  $archives = $this->get_archive_list();
2454
 
2519
  // If there were any errors encountered during the backup, save them to the In Progress data.
2520
  if ( ! empty( $archive_info['error'] ) ) {
2521
  Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'error', $archive_info['error'] );
 
 
 
 
 
2522
  }
2523
 
2524
  if ( $this->is_archiving_update_protection ) {
2688
  BOLDGRID_BACKUP_VERSION, 'all'
2689
  );
2690
 
2691
+ // Load template view.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2692
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-test.php';
 
 
 
 
2693
  }
2694
 
2695
  /**
2943
  $counter --;
2944
  }
2945
  }
 
 
 
 
 
 
 
 
 
 
 
2946
  }
admin/class-boldgrid-backup-admin-dashboard.php CHANGED
@@ -79,42 +79,6 @@ class Boldgrid_Backup_Admin_Dashboard {
79
  * @since 1.11.0
80
  */
81
  public function page() {
82
- $settings = $this->core->settings->get_settings();
83
- wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
84
- wp_enqueue_style( 'bglib-ui-css' );
85
-
86
- $this->core->auto_rollback->enqueue_home_scripts();
87
- $this->core->auto_rollback->enqueue_backup_scripts();
88
- $this->core->archive_actions->enqueue_scripts();
89
-
90
- $this->core->folder_exclusion->enqueue_scripts();
91
- $this->core->db_omit->enqueue_scripts();
92
-
93
- $in_modal = true;
94
- $modal = include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-backup-modal.php';
95
- $in_modal = false;
96
-
97
- echo '
98
- <div class="wrap">
99
- <div id="bglib-page-container" class="bgbkup-page-container">
100
- <div id="bglib-page-top">
101
- <div id="bglib-page-header" class="bglib-has-logo">
102
- <h1>' . esc_html( BOLDGRID_BACKUP_TITLE . ' ' . __( 'Dashboard', 'boldgrid-backup' ) ) . '</h1>
103
- <div class="page-title-actions">
104
- <a href="#TB_inline?width=800&amp;height=600&amp;inlineId=backup_now_content" class="thickbox page-title-action page-title-action-primary">' .
105
- esc_html__( 'Backup Site Now', 'boldgrid-backup' ) . '
106
- </a>
107
- <a class="page-title-action add-new">' . esc_html__( 'Upload Backup', 'boldgrid-backup' ) . '</a>
108
- </div>
109
- </div>
110
- </div>
111
- <div id="bglib-page-content">
112
- <div class="wp-header-end"></div>';
113
- echo $modal; //phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
114
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-dashboard.php';
115
- echo '
116
- </div>
117
- </div>
118
- </div>';
119
  }
120
  }
79
  * @since 1.11.0
80
  */
81
  public function page() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-dashboard.php';
 
 
 
 
83
  }
84
  }
admin/class-boldgrid-backup-admin-db-dump.php CHANGED
@@ -63,8 +63,7 @@ class Boldgrid_Backup_Admin_Db_Dump {
63
  *
64
  * In the list below, it is important that $include_tables is processed last.
65
  */
66
- $include_views = $this->core->db_get->filter_by_type( $include_tables, 'VIEW' );
67
-
68
  $include_tables = $this->core->db_get->filter_by_type( $include_tables, 'BASE TABLE' );
69
 
70
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
@@ -82,19 +81,6 @@ class Boldgrid_Backup_Admin_Db_Dump {
82
  */
83
  do_action( 'boldgrid_backup_pre_dump', $file );
84
 
85
- if ( ! empty( $include_views ) ) {
86
- $db_import = new Boldgrid_Backup_Admin_Db_Import();
87
- $user_has_privileges = $db_import->has_db_privileges( array( 'SHOW VIEW' ) );
88
- if ( false === $user_has_privileges ) {
89
- return array(
90
- 'error' => esc_html__(
91
- 'The database contains VIEWS, but the database user does not have the permissions needed to create a backup.',
92
- 'boldgrid-backup'
93
- ),
94
- );
95
- }
96
- }
97
-
98
  try {
99
  $dump = new IMysqldump\Mysqldump(
100
  $this->get_connection_string(),
63
  *
64
  * In the list below, it is important that $include_tables is processed last.
65
  */
66
+ $include_views = $this->core->db_get->filter_by_type( $include_tables, 'VIEW' );
 
67
  $include_tables = $this->core->db_get->filter_by_type( $include_tables, 'BASE TABLE' );
68
 
69
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
81
  */
82
  do_action( 'boldgrid_backup_pre_dump', $file );
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  try {
85
  $dump = new IMysqldump\Mysqldump(
86
  $this->get_connection_string(),
admin/class-boldgrid-backup-admin-db-import.php CHANGED
@@ -13,7 +13,7 @@
13
  */
14
 
15
  /**
16
- * Class: Boldgrid_Backup_Admin_Db_Import.
17
  *
18
  * @since 1.5.1
19
  */
@@ -22,8 +22,8 @@ class Boldgrid_Backup_Admin_Db_Import {
22
  * The core class object.
23
  *
24
  * @since 1.6.0
25
- * @var Boldgrid_Backup_Admin_Core
26
  * @access private
 
27
  */
28
  private $core;
29
 
@@ -49,23 +49,6 @@ class Boldgrid_Backup_Admin_Db_Import {
49
  }
50
  }
51
 
52
- /**
53
- * Get Lines from file.
54
- *
55
- * Gets an array of lines from a file.
56
- *
57
- * @since 1.14.0
58
- *
59
- * @param string $file String ocntaining the path of the file.
60
- *
61
- * @return array An array of lines.
62
- */
63
- public function get_lines( $file ) {
64
- if ( false === file_exists( $file ) ) {
65
- return false;
66
- }
67
- return file( $file );
68
- }
69
  /**
70
  * Import a mysqldump.
71
  *
@@ -75,7 +58,7 @@ class Boldgrid_Backup_Admin_Db_Import {
75
  * @return bool TRUE on success.
76
  */
77
  public function import( $file ) {
78
- $lines = $this->get_lines( $file );
79
 
80
  if ( false === $lines ) {
81
  return array(
@@ -87,18 +70,6 @@ class Boldgrid_Backup_Admin_Db_Import {
87
  );
88
  }
89
 
90
- $lines = $this->fix_view_statements( $lines );
91
-
92
- if ( true === empty( $lines ) ) {
93
- return array(
94
- 'error' => sprintf(
95
- /* translators: 1: Database File Name */
96
- __( 'MySQL Database User does not have necessary priviliges to restore mysqldump, %1$s.', 'boldgrid-backup' ),
97
- $file
98
- ),
99
- );
100
- }
101
-
102
  $success = $this->import_lines( $lines );
103
 
104
  return $success;
@@ -107,7 +78,8 @@ class Boldgrid_Backup_Admin_Db_Import {
107
  /**
108
  * Import a database dump from an archive.
109
  *
110
- * Pass in "file.zip" and "backup.sql" and we'll find "backup.sql" in the file.zip file and restore it.
 
111
  *
112
  * @since 1.6.0
113
  *
@@ -118,7 +90,8 @@ class Boldgrid_Backup_Admin_Db_Import {
118
  public function import_from_archive( $archive_filepath, $file ) {
119
  $this->core->archive->init( $archive_filepath );
120
  $file_contents = $this->core->archive->get_dump_file( $file );
121
- $sql = ! empty( $file_contents[0]['content'] ) ? $file_contents[0]['content'] : null;
 
122
  if ( empty( $sql ) ) {
123
  $this->errors[] = __( 'Unable to get contents of file.', 'boldgrid-backup' );
124
  return false;
@@ -132,7 +105,8 @@ class Boldgrid_Backup_Admin_Db_Import {
132
  /**
133
  * Import lines (queries).
134
  *
135
- * This method accepts an array of $lines, and loops through each $line and imports it.
 
136
  *
137
  * These lines usually come from either a .sql file, or a string is parsed
138
  * into separate lines.
@@ -165,7 +139,7 @@ class Boldgrid_Backup_Admin_Db_Import {
165
 
166
  // Check if this is the end of the query.
167
  if ( substr( trim( $line ), -1, 1 ) === ';' ) {
168
- $affected_rows = $this->exec_import( $db, $templine );
169
  if ( false === $affected_rows ) {
170
  return false;
171
  }
@@ -180,8 +154,9 @@ class Boldgrid_Backup_Admin_Db_Import {
180
  /**
181
  * Import a string into a database.
182
  *
183
- * Generally this method is used when we grab a .sql file from within a .zip file and import it.
184
- * Instead of saving the .sql file then importing, it comes straight from the .zip file as a string to here.
 
185
  *
186
  * @since 1.6.0
187
  *
@@ -191,187 +166,8 @@ class Boldgrid_Backup_Admin_Db_Import {
191
  public function import_string( $string ) {
192
  $lines = preg_split( "/\\r\\n|\\r|\\n/", $string );
193
 
194
- $lines = $this->fix_view_statements( $lines );
195
-
196
- if ( true === empty( $lines ) ) {
197
- return __( 'The Database User does not have the necessary priviliges to restore this database.', 'boldgrid-backup' );
198
- }
199
-
200
  $success = $this->import_lines( $lines );
201
 
202
  return $success;
203
  }
204
-
205
- /**
206
- * Fix View Statements.
207
- *
208
- * Fixes view statements to ensure the definer matches the current db user.
209
- *
210
- * @since 1.14.0
211
- *
212
- * @param array $lines An array of lines from db file.
213
- * @return array
214
- */
215
- public function fix_view_statements( array $lines ) {
216
-
217
- $has_drop_view_if_exists = false;
218
-
219
- foreach ( $lines as $line ) {
220
- if ( strpos( $line, 'DROP VIEW IF EXISTS' ) ) {
221
- $has_drop_view_if_exists = true;
222
- }
223
- }
224
-
225
- if ( false === $has_drop_view_if_exists ) {
226
- return $lines;
227
- }
228
-
229
- $user_has_privileges = $this->has_db_privileges( array( 'SHOW VIEW', 'CREATE VIEW' ) );
230
-
231
- if ( false === $user_has_privileges ) {
232
- return array();
233
- }
234
-
235
- $fixed_lines = array();
236
-
237
- foreach ( $lines as $line ) {
238
- if ( strpos( $line, 'DEFINER=' ) === 9 ) {
239
- $fixed_lines[] = $this->fix_definer( $line );
240
- } else {
241
- $fixed_lines[] = $line;
242
- }
243
- }
244
-
245
- return $fixed_lines;
246
- }
247
-
248
- /**
249
- * Fix Definer.
250
- *
251
- * Fixes the actual definer line.
252
- *
253
- * @since 1.14.0
254
- *
255
- * @param string $line The line from db dump file to fix.
256
- * @return string The line with the DEFINER option removed.
257
- */
258
- public function fix_definer( $line ) {
259
- $line_fixed_definer = '';
260
- $sql_security_offset = strpos( $line, 'SQL SECURITY' );
261
- $line_fixed_definer = substr( $line, 0, 9 );
262
- if ( strpos( $line, '@`%`' ) ) {
263
- $line_fixed_definer .= 'DEFINER=`' . DB_USER . '`@`%` ';
264
- } else {
265
- $line_fixed_definer .= 'DEFINER=`' . DB_USER . '`@`' . DB_HOST . '` ';
266
- }
267
-
268
- if ( strpos( $line, 'SQL SECURITY' ) ) {
269
- $line_fixed_definer .= subStr( $line, $sql_security_offset );
270
- } else {
271
- $line_fixed_definer .= '*/';
272
- }
273
-
274
- return $line_fixed_definer;
275
- }
276
-
277
- /**
278
- * Tests if database user has specific privileges.
279
- *
280
- * @since 1.14.0
281
- *
282
- * @param array $privileges An array of permissions to check against.
283
- * @return bool True if user has specified privileges.
284
- */
285
- public function has_db_privileges( array $privileges ) {
286
- $user_grants = $this->get_db_privileges();
287
- if ( in_array( 'ALL', $user_grants, true ) ) {
288
- return true;
289
- }
290
- if ( count( $privileges ) === count( array_intersect( $privileges, $user_grants ) ) ) {
291
- return true;
292
- }
293
- return false;
294
- }
295
-
296
- /**
297
- * Get database user privileges.
298
- *
299
- * @since 1.14.0
300
- *
301
- * @global wpdb $wpdb The WordPress database class object.
302
- *
303
- * @return array An array of database user privileges.
304
- */
305
- public function get_db_privileges() {
306
- $results = $this->show_grants_query();
307
-
308
- foreach ( $results as $result ) {
309
- $result[0] = str_replace( '\\', '', $result[0] );
310
- $is_string_db_grant = ( false !== strpos( $result[0], 'ON `' . DB_NAME . '`' ) );
311
- $is_string_all_grant = ( false !== strpos( $result[0], 'ON *.*' ) );
312
- $is_grant_all_privileges = ( false !== strpos( $result[0], 'GRANT ALL PRIVILEGES' ) );
313
-
314
- if ( ( $is_string_db_grant || $is_string_all_grant ) && $is_grant_all_privileges ) {
315
- return array( 'ALL' );
316
- }
317
- if ( ( $is_string_db_grant ) && false === $is_grant_all_privileges ) {
318
- return $this->get_grants_array( $result[0] );
319
- }
320
- }
321
- return array();
322
- }
323
-
324
- /**
325
- * Show Grants Query.
326
- *
327
- * Queries the database for 'SHOW GRANTS'.
328
- *
329
- * @since 1.14.0
330
- *
331
- * @return array an array of results from the database query
332
- */
333
- public function show_grants_query() {
334
- $db = new PDO( sprintf( 'mysql:host=%1$s;dbname=%2$s;', DB_HOST, DB_NAME ), DB_USER, DB_PASSWORD );
335
- $db_statement = $db->query( 'SHOW GRANTS' );
336
- return $db_statement->fetchAll();
337
- }
338
-
339
- /**
340
- * Execute Import.
341
- *
342
- * Executes Import MySql Query.
343
- *
344
- * @since 1.14.0
345
- *
346
- * @param PDO $db The PDO Object.
347
- * @param string $sql_line The line of sql to execute.
348
- *
349
- * @return int Number of affected rows
350
- */
351
- public function exec_import( PDO $db, $sql_line ) {
352
- return $db->exec( $sql_line );
353
- }
354
-
355
- /**
356
- * Get a user's grants in the form of an array.
357
- *
358
- * @since 1.14.0
359
- *
360
- * @param string $grants_string A string containing the user's grants.
361
- * @return array
362
- */
363
- public function get_grants_array( $grants_string ) {
364
- $expected_grants_string_start = 6;
365
-
366
- if ( strpos( $grants_string, 'GRANT' ) === 0 ) {
367
- $grants_string = substr( $grants_string, $expected_grants_string_start );
368
- }
369
-
370
- $on_strpos = strpos( $grants_string, ' ON ' );
371
- if ( $on_strpos ) {
372
- $grants_string = substr( $grants_string, 0, $on_strpos );
373
- }
374
-
375
- return explode( ', ', $grants_string );
376
- }
377
  }
13
  */
14
 
15
  /**
16
+ * Class: Boldgrid_Backup_Admin_Db_Import
17
  *
18
  * @since 1.5.1
19
  */
22
  * The core class object.
23
  *
24
  * @since 1.6.0
 
25
  * @access private
26
+ * @var Boldgrid_Backup_Admin_Core
27
  */
28
  private $core;
29
 
49
  }
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  /**
53
  * Import a mysqldump.
54
  *
58
  * @return bool TRUE on success.
59
  */
60
  public function import( $file ) {
61
+ $lines = file( $file );
62
 
63
  if ( false === $lines ) {
64
  return array(
70
  );
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  $success = $this->import_lines( $lines );
74
 
75
  return $success;
78
  /**
79
  * Import a database dump from an archive.
80
  *
81
+ * Pass in "file.zip" and "backup.sql" and we'll find "backup.sql" in the
82
+ * "file.zip" file and restore it.
83
  *
84
  * @since 1.6.0
85
  *
90
  public function import_from_archive( $archive_filepath, $file ) {
91
  $this->core->archive->init( $archive_filepath );
92
  $file_contents = $this->core->archive->get_dump_file( $file );
93
+
94
+ $sql = ! empty( $file_contents[0]['content'] ) ? $file_contents[0]['content'] : null;
95
  if ( empty( $sql ) ) {
96
  $this->errors[] = __( 'Unable to get contents of file.', 'boldgrid-backup' );
97
  return false;
105
  /**
106
  * Import lines (queries).
107
  *
108
+ * This method accepts an array of $lines, and loops through each $line and
109
+ * imports it.
110
  *
111
  * These lines usually come from either a .sql file, or a string is parsed
112
  * into separate lines.
139
 
140
  // Check if this is the end of the query.
141
  if ( substr( trim( $line ), -1, 1 ) === ';' ) {
142
+ $affected_rows = $db->exec( $templine );
143
  if ( false === $affected_rows ) {
144
  return false;
145
  }
154
  /**
155
  * Import a string into a database.
156
  *
157
+ * Generally this method is used when we grab a .sql file from within a .zip
158
+ * file and import it. Instead of saving the .sql file then importing, it
159
+ * comes straight from the .zip file as a string to here.
160
  *
161
  * @since 1.6.0
162
  *
166
  public function import_string( $string ) {
167
  $lines = preg_split( "/\\r\\n|\\r|\\n/", $string );
168
 
 
 
 
 
 
 
169
  $success = $this->import_lines( $lines );
170
 
171
  return $success;
172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  }
admin/class-boldgrid-backup-admin-db-omit.php CHANGED
@@ -101,7 +101,7 @@ class Boldgrid_Backup_Admin_Db_Omit {
101
  $handle = 'boldgrid-backup-admin-table-include';
102
  wp_register_script(
103
  $handle,
104
- plugin_dir_url( __FILE__ ) . 'js/boldgrid-backup-admin-table-includes.js',
105
  array( 'jquery' ),
106
  BOLDGRID_BACKUP_VERSION,
107
  false
101
  $handle = 'boldgrid-backup-admin-table-include';
102
  wp_register_script(
103
  $handle,
104
+ plugin_dir_url( __FILE__ ) . 'js/boldgrid-backup-admin-table-include.js',
105
  array( 'jquery' ),
106
  BOLDGRID_BACKUP_VERSION,
107
  false
admin/class-boldgrid-backup-admin-email.php CHANGED
@@ -214,8 +214,22 @@ class Boldgrid_Backup_Admin_Email {
214
  $headers = 'From: ' . $site_title . ' <' . $admin_email . '>' . "\r\n" . 'X-Mailer: PHP/' .
215
  phpversion() . "\r\n";
216
 
217
- // Send mail.
218
- $status = wp_mail( $admin_email, $subject, $body, $headers );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
  // Return status.
221
  return $status;
@@ -233,4 +247,23 @@ class Boldgrid_Backup_Admin_Email {
233
 
234
  return ! empty( $settings['notifications'][ $task ] );
235
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
214
  $headers = 'From: ' . $site_title . ' <' . $admin_email . '>' . "\r\n" . 'X-Mailer: PHP/' .
215
  phpversion() . "\r\n";
216
 
217
+ /*
218
+ * Send mail.
219
+ *
220
+ * The default behaviour is to include $headers in our call to wp_mail. In very rare circumstances,
221
+ * this will cause the following error:
222
+ *
223
+ * # Could not instantiate mail function.
224
+ * # phpmailer_exception_code 2
225
+ *
226
+ * In those rare cases, the user can define BGBKUP_SKIP_EMAIL_HEADERS to skip adding the headers.
227
+ */
228
+ if ( defined( 'BGBKUP_SKIP_EMAIL_HEADERS' ) ) {
229
+ $status = wp_mail( $admin_email, $subject, $body );
230
+ } else {
231
+ $status = wp_mail( $admin_email, $subject, $body, $headers );
232
+ }
233
 
234
  // Return status.
235
  return $status;
247
 
248
  return ! empty( $settings['notifications'][ $task ] );
249
  }
250
+
251
+ /**
252
+ * Hook into the wp_mail_failed action.
253
+ *
254
+ * @since 1.13.4
255
+ *
256
+ * @param WP_Error $wp_error A WP error object.
257
+ */
258
+ public function wp_mail_failed( $wp_error ) {
259
+ // If in the middle of archiving files and an email failed, add info about it to the log.
260
+ if ( $this->core->archiving_files ) {
261
+ $errors = array(
262
+ 'wp_error' => $wp_error,
263
+ 'last_error' => error_get_last(),
264
+ );
265
+
266
+ $this->core->logger->add( 'wp_mail_failed: ' . print_r( $errors, 1 ) ); // phpcs:ignore
267
+ }
268
+ }
269
  }
admin/class-boldgrid-backup-admin-go-pro.php CHANGED
@@ -90,7 +90,7 @@ class Boldgrid_Backup_Admin_Go_Pro {
90
 
91
  $is_premium = $this->core->config->get_is_premium();
92
 
93
- $premium_plugin = \Boldgrid\Library\Library\Plugin\Factory::create( 'boldgrid-backup-premium' );
94
 
95
  $notices = [
96
  [
90
 
91
  $is_premium = $this->core->config->get_is_premium();
92
 
93
+ $premium_plugin = new \Boldgrid\Library\Library\Plugin\Plugin( 'boldgrid-backup-premium' );
94
 
95
  $notices = [
96
  [
admin/class-boldgrid-backup-admin-notice.php CHANGED
@@ -236,55 +236,15 @@ class Boldgrid_Backup_Admin_Notice {
236
  * @since 1.7.0
237
  */
238
  public function display_autoupdate_notice() {
239
- $auto_update_array = [
240
- ( apply_filters( 'allow_major_auto_core_updates', false ) ) ? 'Major' : false,
241
- ( apply_filters( 'allow_minor_auto_core_updates', false ) ) ? 'Minor' : false,
242
- ( apply_filters( 'allow_dev_auto_core_updates', false ) ) ? 'Development' : false,
243
- ( apply_filters( 'auto_update_translation', false ) ) ? 'Translation' : false,
244
- ];
245
- $auto_update_array = array_filter( $auto_update_array );
246
- $update_msg = '';
247
- switch ( count( $auto_update_array ) ) {
248
- case 0:
249
- $update_msg = esc_html__( 'disabled for all', 'boldgrid-backup' );
250
- break;
251
- case 1:
252
- $auto_update_array = array_values( $auto_update_array );
253
- $update_msg = sprintf(
254
- // translators: 1: Auto Update Type.
255
- esc_html__( 'enabled for %s', 'boldgrid-backup' ),
256
- $auto_update_array[0]
257
- );
258
- break;
259
- case 4:
260
- $update_msg = esc_html__( 'enabled for all', 'boldgrid-backup' );
261
- break;
262
- default:
263
- $x = array_slice( $auto_update_array, 0, -1 );
264
-
265
- $auto_update_string = implode( ', ', $x );
266
- $update_msg = sprintf(
267
- // translators: 1: Auto Update Types, 2: Auto Update Type.
268
- esc_html__(
269
- 'enabled for %1$s and %2$s',
270
- 'boldgrid-backup'
271
- ),
272
- $auto_update_string,
273
- end( $auto_update_array )
274
- );
275
- break;
276
- }
277
-
278
  $message = sprintf(
279
  // translators: 1: HTML anchor opening tag, 2: HTML anchor closing tag, 3: Plugin title.
280
  esc_html__(
281
- 'Auto Updates are %4$s WordPress Core Updates. This can be configured in the %1$s%3$s Settings%2$s.',
282
  'boldgrid-backup'
283
  ),
284
  '<a href="' . admin_url( 'admin.php?page=boldgrid-backup-settings&section=section_auto_updates' ) . '">',
285
  '</a>',
286
- BOLDGRID_BACKUP_TITLE,
287
- $update_msg
288
  );
289
 
290
  do_action( 'boldgrid_backup_notice', $message, 'notice notice-info is-dismissible' );
@@ -301,7 +261,7 @@ class Boldgrid_Backup_Admin_Notice {
301
  * @see \Boldgrid\Library\Library\Notice::show()
302
  */
303
  public function plugin_renamed_notice() {
304
- $plugin = \Boldgrid\Library\Library\Plugin\Factory::create( 'boldgrid-backup' );
305
 
306
  /*
307
  * Only show to existing users.
236
  * @since 1.7.0
237
  */
238
  public function display_autoupdate_notice() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  $message = sprintf(
240
  // translators: 1: HTML anchor opening tag, 2: HTML anchor closing tag, 3: Plugin title.
241
  esc_html__(
242
+ 'Auto Updates can be configured in the %1$s%3$s Settings%2$s.',
243
  'boldgrid-backup'
244
  ),
245
  '<a href="' . admin_url( 'admin.php?page=boldgrid-backup-settings&section=section_auto_updates' ) . '">',
246
  '</a>',
247
+ BOLDGRID_BACKUP_TITLE
 
248
  );
249
 
250
  do_action( 'boldgrid_backup_notice', $message, 'notice notice-info is-dismissible' );
261
  * @see \Boldgrid\Library\Library\Notice::show()
262
  */
263
  public function plugin_renamed_notice() {
264
+ $plugin = new \Boldgrid\Library\Library\Plugin\Plugin( 'boldgrid-backup' );
265
 
266
  /*
267
  * Only show to existing users.
admin/class-boldgrid-backup-admin-premium-features.php CHANGED
@@ -78,7 +78,6 @@ class Boldgrid_Backup_Admin_Premium_Features {
78
 
79
  $this->page = $plugin->getPageBySlug( 'boldgrid-backup-premium-features' );
80
  $cards = [
81
- new Card\Timely_Auto_Updates( $this->page ),
82
  new Card\Database_Encryption( $this->page ),
83
  new Card\Google_Drive( $this->page ),
84
  new Card\Amazon_S3( $this->page ),
@@ -101,47 +100,10 @@ class Boldgrid_Backup_Admin_Premium_Features {
101
  * @return array returns an array of the $nav, $dashboard, and $premium_box for validation.
102
  */
103
  public function page() {
104
-
105
  wp_enqueue_style( 'bglib-ui-css' );
106
- $settings = $this->core->settings->get_settings();
107
- wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
108
-
109
- $this->core->auto_rollback->enqueue_home_scripts();
110
- $this->core->auto_rollback->enqueue_backup_scripts();
111
- $this->core->archive_actions->enqueue_scripts();
112
-
113
- $this->core->folder_exclusion->enqueue_scripts();
114
- $this->core->db_omit->enqueue_scripts();
115
-
116
- $in_modal = true;
117
- $modal = include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-backup-modal.php';
118
- $in_modal = false;
119
 
120
  $this->admin_enqueue_scripts( 'boldgrid-backup-admin-premium-features' );
121
-
122
- echo '
123
- <div class="wrap">
124
- <div id="bglib-page-container" class="bgbkup-page-container">
125
- <div id="bglib-page-top">
126
- <div id="bglib-page-header" class="bglib-has-logo">
127
- <h1>' . esc_html__( 'Total Upkeep Premium Features', 'boldgrid-backup' ) . '</h1>
128
- <div class="page-title-actions">
129
- <a href="#TB_inline?width=800&amp;height=600&amp;inlineId=backup_now_content" class="thickbox page-title-action page-title-action-primary">' .
130
- esc_html__( 'Backup Site Now', 'boldgrid-backup' ) . '
131
- </a>
132
- <a class="page-title-action add-new">' . esc_html__( 'Upload Backup', 'boldgrid-backup' ) . '</a>
133
- </div>
134
- </div>
135
- </div>
136
- <div id="bglib-page-content">
137
- <div class="wp-header-end"></div>';
138
- echo $modal; //phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
139
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-premium.php';
140
- echo '
141
- </div>
142
- </div>
143
- </div>';
144
-
145
  $this->page->setAllNoticesRead();
146
  return array(
147
  'nav' => $nav,
78
 
79
  $this->page = $plugin->getPageBySlug( 'boldgrid-backup-premium-features' );
80
  $cards = [
 
81
  new Card\Database_Encryption( $this->page ),
82
  new Card\Google_Drive( $this->page ),
83
  new Card\Amazon_S3( $this->page ),
100
  * @return array returns an array of the $nav, $dashboard, and $premium_box for validation.
101
  */
102
  public function page() {
 
103
  wp_enqueue_style( 'bglib-ui-css' );
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  $this->admin_enqueue_scripts( 'boldgrid-backup-admin-premium-features' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-premium.php';
 
 
 
 
 
107
  $this->page->setAllNoticesRead();
108
  return array(
109
  'nav' => $nav,
admin/class-boldgrid-backup-admin-settings.php CHANGED
@@ -402,7 +402,7 @@ class Boldgrid_Backup_Admin_Settings {
402
  * @param string $new_dir Destination directory.
403
  * @return bool TRUE on success / no backups needed to be moved.
404
  */
405
- public function move_backups( $old_dir, $new_dir ) {
406
  $fail_count = 0;
407
 
408
  $old_dir = Boldgrid_Backup_Admin_Utility::trailingslashit( $old_dir );
@@ -700,15 +700,6 @@ class Boldgrid_Backup_Admin_Settings {
700
  $settings['folder_exclusion_exclude'] = $this->core->folder_exclusion->from_post( 'exclude' );
701
  $settings['folder_exclusion_type'] = $this->core->folder_exclusion->from_post( 'type' );
702
 
703
- /*
704
- * Save Auto Backup options
705
- *
706
- * @since 1.14.0
707
- */
708
- if ( ! empty( $_POST['auto_update'] ) ) {
709
- $settings['auto_update'] = $_POST['auto_update'];
710
- }
711
-
712
  // Read BoldGrid settings form POST request, sanitize, and merge settings with saved.
713
  $boldgrid_settings = array_merge(
714
  get_option( 'boldgrid_settings' ),
@@ -790,21 +781,17 @@ class Boldgrid_Backup_Admin_Settings {
790
  * @see Boldgrid_Backup_Admin_Config::is_premium_active
791
  */
792
  public function page_backup_settings() {
793
-
794
  $is_premium = $this->core->config->get_is_premium();
795
  $is_premium_installed = $this->core->config->is_premium_installed;
796
  $is_premium_active = $this->core->config->is_premium_active;
797
 
 
798
  wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
799
  wp_enqueue_style( 'bglib-ui-css' );
800
  wp_enqueue_script( 'bglib-ui-js' );
801
  wp_enqueue_script( 'bglib-sticky' );
802
  wp_enqueue_script( 'bglib-license' );
803
 
804
- $this->core->auto_rollback->enqueue_home_scripts();
805
- $this->core->auto_rollback->enqueue_backup_scripts();
806
- $this->core->archive_actions->enqueue_scripts();
807
-
808
  if ( ! $this->is_saving_settings ) {
809
  $is_functional = $this->core->test->run_functionality_tests();
810
  }
@@ -931,32 +918,8 @@ class Boldgrid_Backup_Admin_Settings {
931
  $settings['encrypt_db'] = false;
932
  }
933
 
934
- $in_modal = true;
935
- $modal = include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-backup-modal.php';
936
- $in_modal = false;
937
-
938
- echo '
939
- <div class="wrap">
940
- <div id="bglib-page-container" class="bgbkup-page-container">
941
- <div id="bglib-page-top">
942
- <div id="bglib-page-header" class="bglib-has-logo">
943
- <h1>' . esc_html__( 'Total Upkeep Backup and Restore Settings', 'boldgrid-backup' ) . '</h1>
944
- <div class="page-title-actions">
945
- <a href="#TB_inline?width=800&amp;height=600&amp;inlineId=backup_now_content" class="thickbox page-title-action page-title-action-primary">' .
946
- esc_html__( 'Backup Site Now', 'boldgrid-backup' ) . '
947
- </a>
948
- <a class="page-title-action add-new">' . esc_html__( 'Upload Backup', 'boldgrid-backup' ) . '</a>
949
- </div>
950
- </div>
951
- </div>
952
- <div id="bglib-page-content">
953
- <div class="wp-header-end"></div>';
954
- echo $modal; //phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
955
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-settings.php';
956
- echo '
957
- </div>
958
- </div>
959
- </div>';
960
  }
961
 
962
  /**
402
  * @param string $new_dir Destination directory.
403
  * @return bool TRUE on success / no backups needed to be moved.
404
  */
405
+ private function move_backups( $old_dir, $new_dir ) {
406
  $fail_count = 0;
407
 
408
  $old_dir = Boldgrid_Backup_Admin_Utility::trailingslashit( $old_dir );
700
  $settings['folder_exclusion_exclude'] = $this->core->folder_exclusion->from_post( 'exclude' );
701
  $settings['folder_exclusion_type'] = $this->core->folder_exclusion->from_post( 'type' );
702
 
 
 
 
 
 
 
 
 
 
703
  // Read BoldGrid settings form POST request, sanitize, and merge settings with saved.
704
  $boldgrid_settings = array_merge(
705
  get_option( 'boldgrid_settings' ),
781
  * @see Boldgrid_Backup_Admin_Config::is_premium_active
782
  */
783
  public function page_backup_settings() {
 
784
  $is_premium = $this->core->config->get_is_premium();
785
  $is_premium_installed = $this->core->config->is_premium_installed;
786
  $is_premium_active = $this->core->config->is_premium_active;
787
 
788
+ add_thickbox();
789
  wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
790
  wp_enqueue_style( 'bglib-ui-css' );
791
  wp_enqueue_script( 'bglib-ui-js' );
792
  wp_enqueue_script( 'bglib-sticky' );
793
  wp_enqueue_script( 'bglib-license' );
794
 
 
 
 
 
795
  if ( ! $this->is_saving_settings ) {
796
  $is_functional = $this->core->test->run_functionality_tests();
797
  }
918
  $settings['encrypt_db'] = false;
919
  }
920
 
921
+ // Include the page template.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-settings.php';
 
 
 
 
923
  }
924
 
925
  /**
admin/class-boldgrid-backup-admin-support.php CHANGED
@@ -174,43 +174,8 @@ class Boldgrid_Backup_Admin_Support {
174
  * @since 1.10.1
175
  */
176
  public function page() {
177
-
178
  wp_enqueue_style( 'bglib-ui-css' );
179
- $settings = $this->core->settings->get_settings();
180
- wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
181
-
182
- $this->core->auto_rollback->enqueue_home_scripts();
183
- $this->core->auto_rollback->enqueue_backup_scripts();
184
- $this->core->archive_actions->enqueue_scripts();
185
-
186
- $this->core->folder_exclusion->enqueue_scripts();
187
- $this->core->db_omit->enqueue_scripts();
188
-
189
- $in_modal = true;
190
- $modal = include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-backup-modal.php';
191
- $in_modal = false;
192
-
193
- echo '
194
- <div class="wrap">
195
- <div id="bglib-page-container" class="bgbkup-page-container">
196
- <div id="bglib-page-top">
197
- <div id="bglib-page-header" class="bglib-has-logo">
198
- <h1>' . esc_html__( 'Total Upkeep Support', 'boldgrid-backup' ) . '</h1>
199
- <div class="page-title-actions">
200
- <a href="#TB_inline?width=800&amp;height=600&amp;inlineId=backup_now_content" class="thickbox page-title-action page-title-action-primary">' .
201
- esc_html__( 'Backup Site Now', 'boldgrid-backup' ) . '
202
- </a>
203
- <a class="page-title-action add-new">' . esc_html__( 'Upload Backup', 'boldgrid-backup' ) . '</a>
204
- </div>
205
- </div>
206
- </div>
207
- <div id="bglib-page-content">
208
- <div class="wp-header-end"></div>';
209
- echo $modal; //phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped, WordPress.Security.EscapeOutput
210
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-support.php';
211
- echo '
212
- </div>
213
- </div>
214
- </div>';
215
  }
216
  }
174
  * @since 1.10.1
175
  */
176
  public function page() {
 
177
  wp_enqueue_style( 'bglib-ui-css' );
178
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-support.php';
 
 
 
 
180
  }
181
  }