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

Version Description

Release date: June 4rd, 2020

  • Update: Create log file for local retention.
Download this release

Release Info

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

Code changes from version 1.14.0-rc.3 to 1.13.7

Files changed (90) 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 +6 -10
  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 +37 -100
  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-go-pro.php +1 -1
  19. admin/class-boldgrid-backup-admin-in-progress-tmp.php +13 -12
  20. admin/class-boldgrid-backup-admin-log.php +20 -8
  21. admin/class-boldgrid-backup-admin-notice.php +3 -43
  22. admin/class-boldgrid-backup-admin-premium-features.php +0 -38
  23. admin/class-boldgrid-backup-admin-settings.php +3 -49
  24. admin/class-boldgrid-backup-admin-support.php +0 -35
  25. admin/class-boldgrid-backup-admin-tools.php +2 -36
  26. admin/class-boldgrid-backup-admin-transfers.php +0 -35
  27. admin/class-boldgrid-backup-admin-upload.php +0 -23
  28. admin/class-boldgrid-backup-admin.php +0 -29
  29. admin/compressor/class-boldgrid-backup-admin-compressor-system-zip.php +7 -141
  30. admin/css/boldgrid-backup-admin-settings.css +0 -31
  31. admin/css/boldgrid-backup-admin.css +0 -67
  32. admin/image/icon-128x128.png +0 -0
  33. admin/js/boldgrid-backup-admin-backup-now.js +1 -1
  34. admin/js/boldgrid-backup-admin-folder-exclude.js +17 -82
  35. admin/js/boldgrid-backup-admin-home.js +11 -31
  36. admin/js/boldgrid-backup-admin-in-progress.js +3 -9
  37. admin/js/boldgrid-backup-admin-settings-autoupdate.js +21 -64
  38. admin/js/boldgrid-backup-admin-settings.js +0 -18
  39. admin/js/{boldgrid-backup-admin-table-includes.js → boldgrid-backup-admin-table-include.js} +9 -46
  40. admin/partials/archives/add-new.php +6 -17
  41. admin/partials/boldgrid-backup-admin-archive-details.php +19 -24
  42. admin/partials/boldgrid-backup-admin-backup-button.php +3 -2
  43. admin/partials/boldgrid-backup-admin-dashboard.php +8 -3
  44. admin/partials/boldgrid-backup-admin-home.php +31 -36
  45. admin/partials/boldgrid-backup-admin-premium.php +10 -4
  46. admin/partials/boldgrid-backup-admin-settings.php +34 -29
  47. admin/partials/boldgrid-backup-admin-support.php +54 -49
  48. admin/partials/boldgrid-backup-admin-test.php +4 -3
  49. admin/partials/boldgrid-backup-admin-tools.php +7 -3
  50. admin/partials/boldgrid-backup-admin-transfers.php +5 -7
  51. admin/partials/settings/auto-backup.php +30 -52
  52. admin/partials/settings/auto-update.php +0 -435
  53. admin/partials/settings/backup-security.php +3 -8
  54. admin/partials/settings/compressor.php +0 -32
  55. admin/partials/settings/storage.php +1 -1
  56. admin/partials/tools/local-remote.php +12 -8
  57. admin/partials/transfers/destination.php +2 -4
  58. boldgrid-backup.php +1 -1
  59. coverage.xml +5000 -6446
  60. includes/class-boldgrid-backup.php +2 -13
  61. includes/config/config.plugin.php +0 -5
  62. readme.txt +4 -4
  63. vendor/autoload.php +1 -1
  64. vendor/boldgrid/library/.gitignore +1 -1
  65. vendor/boldgrid/library/README.md +1 -2
  66. vendor/boldgrid/library/phpunit.xml +1 -1
  67. vendor/boldgrid/library/src/Library/Configs.php +5 -3
  68. vendor/boldgrid/library/src/Library/Plugin/Checker.php +4 -8
  69. vendor/boldgrid/library/src/Library/Plugin/Factory.php +0 -222
  70. vendor/boldgrid/library/src/Library/Plugin/Notice.php +28 -31
  71. vendor/boldgrid/library/src/Library/Plugin/Notices.php +4 -5
  72. vendor/boldgrid/library/src/Library/Plugin/Page.php +10 -18
  73. vendor/boldgrid/library/src/Library/Plugin/Plugin.php +111 -76
  74. vendor/boldgrid/library/src/Library/Plugin/Plugins.php +5 -48
  75. vendor/boldgrid/library/src/Library/Plugin/UpdateData.php +0 -322
  76. vendor/boldgrid/library/src/Library/Start.php +3 -0
  77. vendor/boldgrid/library/src/Library/Theme/Theme.php +0 -145
  78. vendor/boldgrid/library/src/Library/Theme/Themes.php +0 -85
  79. vendor/boldgrid/library/src/Library/Theme/UpdateData.php +0 -275
  80. vendor/boldgrid/library/src/Library/Ui/Page.php +0 -38
  81. vendor/boldgrid/library/src/Library/Update.php +202 -0
  82. vendor/boldgrid/library/src/assets/css/admin.css +1 -1
  83. vendor/boldgrid/library/src/assets/css/dashboard.css +3 -5
  84. vendor/boldgrid/library/src/assets/css/page.css +0 -60
  85. vendor/boldgrid/library/tests/Library/Library/test-activity.php +25 -0
  86. vendor/boldgrid/library/tests/Library/Library/test-rating-prompt.php +47 -0
  87. vendor/boldgrid/library/tests/Library/Plugin/test-factory.php +0 -82
  88. vendor/boldgrid/library/tests/Library/Plugin/test-notice.php +365 -137
  89. vendor/boldgrid/library/tests/Library/Plugin/test-page.php +163 -60
  90. vendor/boldgrid/library/tests/Library/Plugin/test-plugin.php +141 -114
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
@@ -57,9 +57,7 @@ class Boldgrid_Backup_Admin_Archive_Browser {
57
  wp_send_json_error( __( 'Permission denied.', 'boldgrid-backup' ) );
58
  }
59
 
60
- // With Recent UI changes, sometimes this ajax call can be for one of either actions.
61
- if ( ! check_ajax_referer( 'boldgrid_backup_remote_storage_upload', 'security', false ) &&
62
- ! check_ajax_referer( 'boldgrid_backup_browse_archive', 'security', false ) ) {
63
  wp_send_json_error( __( 'Invalid nonce; security check failed.', 'boldgrid-backup' ) );
64
  }
65
  }
@@ -324,19 +322,17 @@ class Boldgrid_Backup_Admin_Archive_Browser {
324
  $importer = new Boldgrid_Backup_Admin_Db_Import( $this->core );
325
  $success = $importer->import_from_archive( $filepath, $file );
326
 
327
- if ( true === $success ) {
328
  $this->core->notice->add_user_notice(
329
  // translators: 1: Filename 2: File path.
330
- sprintf( __( 'Success! Database %1$s imported from %2$s.', 'boldgrid-backup' ), $file, $filepath ),
331
- $this->core->notice->lang['dis_success']
332
  );
333
- } elseif ( false !== $success ) {
334
- $this->core->notice->add_user_notice( $success, $this->core->notice->lang['dis_error'] );
335
  } else {
336
  $this->core->notice->add_user_notice(
337
  // translators: 1: Filename 2: File path.
338
- sprintf( __( 'Error, unable to import database %1$s from %2$s.', 'boldgrid-backup' ), $file, $filepath ),
339
- $this->core->notice->lang['dis_error']
340
  );
341
  }
342
  }
57
  wp_send_json_error( __( 'Permission denied.', 'boldgrid-backup' ) );
58
  }
59
 
60
+ if ( ! check_ajax_referer( 'boldgrid_backup_remote_storage_upload', 'security', false ) ) {
 
 
61
  wp_send_json_error( __( 'Invalid nonce; security check failed.', 'boldgrid-backup' ) );
62
  }
63
  }
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
@@ -384,14 +384,6 @@ class Boldgrid_Backup_Admin_Core {
384
  */
385
  public $db_omit;
386
 
387
- /**
388
- * Database Restoration errro
389
- *
390
- * @since 1.14.0
391
- * @var string
392
- */
393
- public $db_restore_error;
394
-
395
  /**
396
  * An instance of Boldgrid_Backup_Admin_Filelist.
397
  *
@@ -582,14 +574,6 @@ class Boldgrid_Backup_Admin_Core {
582
  */
583
  public $activity;
584
 
585
- /**
586
- * An instance of the Auto Updates class
587
- *
588
- * @since 1.14.0
589
- * @var Boldgrid_Backup_Admin_Auto_Updates
590
- */
591
- public $auto_updates;
592
-
593
  /**
594
  * Constructor.
595
  *
@@ -717,20 +701,10 @@ class Boldgrid_Backup_Admin_Core {
717
 
718
  $this->dashboard = new Boldgrid_Backup_Admin_Dashboard( $this );
719
 
720
- /**
721
- * For backwards compatibility with plugins using previous versions of the Library, this will
722
- * allow the plugins to be instantiated without using the new Factory methods.
723
- */
724
- $this->plugin = new \Boldgrid\Library\Library\Plugin\Plugin( 'boldgrid-backup', $this->configs );
725
-
726
  $this->premium_page = new Boldgrid_Backup_Admin_Premium_Features( $this );
727
 
728
- // Instantiate Boldgrid_Backup_Admin_Auto_Updates.
729
-
730
- if ( Boldgrid_Backup_Admin_Utility::is_active() ) {
731
- $this->auto_updates = new Boldgrid_Backup_Admin_Auto_Updates();
732
- }
733
-
734
  // Ensure there is a backup identifier.
735
  $this->get_backup_identifier();
736
 
@@ -1288,7 +1262,6 @@ class Boldgrid_Backup_Admin_Core {
1288
  $status = $importer->import( $db_dump_filepath );
1289
 
1290
  if ( ! empty( $status['error'] ) ) {
1291
- $this->db_restore_error = $status['error'];
1292
  do_action( 'boldgrid_backup_notice', $status['error'], 'notice notice-error is-dismissible' );
1293
  return false;
1294
  }
@@ -1567,8 +1540,6 @@ class Boldgrid_Backup_Admin_Core {
1567
  $this->logger->init( 'archive-' . time() . '.log' );
1568
  $this->logger->add( 'Backup process initialized.' );
1569
 
1570
- $this->utility->bump_memory_limit( '1G' );
1571
-
1572
  $this->pre_auto_update = 'pre_auto_update' === current_filter();
1573
 
1574
  /*
@@ -2451,7 +2422,7 @@ class Boldgrid_Backup_Admin_Core {
2451
 
2452
  // Display notice of deletion status.
2453
  if ( ! $restore_ok ) {
2454
- $error_message = $this->db_restore_error ? $this->db_restore_error : esc_html__( 'Could not restore database.', 'boldgrid-backup' );
2455
  $this->logger->add( $error_message );
2456
  return [ 'error' => $error_message ];
2457
  }
@@ -2507,6 +2478,7 @@ class Boldgrid_Backup_Admin_Core {
2507
  global $pagenow;
2508
 
2509
  // Thickbox used for Backup Site Now modal.
 
2510
  wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
2511
 
2512
  wp_enqueue_style( 'bglib-ui-css' );
@@ -2528,6 +2500,11 @@ class Boldgrid_Backup_Admin_Core {
2528
  $this->folder_exclusion->enqueue_scripts();
2529
  $this->db_omit->enqueue_scripts();
2530
 
 
 
 
 
 
2531
  // Get archive list.
2532
  $archives = $this->get_archive_list();
2533
 
@@ -2598,11 +2575,6 @@ class Boldgrid_Backup_Admin_Core {
2598
  // If there were any errors encountered during the backup, save them to the In Progress data.
2599
  if ( ! empty( $archive_info['error'] ) ) {
2600
  Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'error', $archive_info['error'] );
2601
- $this->notice->add_user_notice(
2602
- '<p>' . $archive_info['error'] . '</p>',
2603
- 'notice notice-error is-dismissible',
2604
- 'Backup Failed'
2605
- );
2606
  }
2607
 
2608
  if ( $this->is_archiving_update_protection ) {
@@ -2772,43 +2744,8 @@ class Boldgrid_Backup_Admin_Core {
2772
  BOLDGRID_BACKUP_VERSION, 'all'
2773
  );
2774
 
2775
- $settings = $this->settings->get_settings();
2776
- wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
2777
- wp_enqueue_style( 'bglib-ui-css' );
2778
-
2779
- $this->auto_rollback->enqueue_home_scripts();
2780
- $this->auto_rollback->enqueue_backup_scripts();
2781
- $this->archive_actions->enqueue_scripts();
2782
-
2783
- $this->folder_exclusion->enqueue_scripts();
2784
- $this->db_omit->enqueue_scripts();
2785
-
2786
- $in_modal = true;
2787
- $modal = include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-backup-modal.php';
2788
- $in_modal = false;
2789
-
2790
- echo '
2791
- <div class="wrap">
2792
- <div id="bglib-page-container" class="bgbkup-page-container">
2793
- <div id="bglib-page-top">
2794
- <div id="bglib-page-header" class="bglib-has-logo">
2795
- <h1>' . esc_html__( 'Total Upkeep Preflight Check', 'boldgrid-backup' ) . '</h1>
2796
- <div class="page-title-actions">
2797
- <a href="#TB_inline?width=800&amp;height=600&amp;inlineId=backup_now_content" class="thickbox page-title-action page-title-action-primary">' .
2798
- esc_html__( 'Backup Site Now', 'boldgrid-backup' ) . '
2799
- </a>
2800
- <a class="page-title-action add-new">' . esc_html__( 'Upload Backup', 'boldgrid-backup' ) . '</a>
2801
- </div>
2802
- </div>
2803
- </div>
2804
- <div id="bglib-page-content">
2805
- <div class="wp-header-end"></div>';
2806
- echo $modal; //phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
2807
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-test.php';
2808
- echo '
2809
- </div>
2810
- </div>
2811
- </div>';
2812
  }
2813
 
2814
  /**
@@ -3003,18 +2940,26 @@ class Boldgrid_Backup_Admin_Core {
3003
  * @return null
3004
  */
3005
  public function enforce_retention() {
3006
- // Get backup settings.
 
 
 
3007
  $settings = $this->settings->get_settings();
 
3008
 
3009
  $archives = $this->get_archive_list();
 
3010
 
3011
  // Remove from the list of archives any that have been flagged as being protected.
 
3012
  foreach ( $archives as $key => $archive ) {
3013
  $this->archive->init( $archive['filepath'] );
3014
  if ( '1' === $this->archive->get_attribute( 'protect' ) ) {
3015
  unset( $archives[ $key ] );
 
3016
  }
3017
  }
 
3018
  $archives = array_values( $archives );
3019
 
3020
  // Get the archives file count.
@@ -3022,12 +2967,10 @@ class Boldgrid_Backup_Admin_Core {
3022
 
3023
  // If the archive count is not beyond the set retention count, then return.
3024
  if ( empty( $settings['retention_count'] ) || $archives_count <= $settings['retention_count'] ) {
 
3025
  return;
3026
  }
3027
 
3028
- // Connect to the WordPress Filesystem API.
3029
- global $wp_filesystem;
3030
-
3031
  // Initialize $counter.
3032
  $counter = $archives_count - 1;
3033
 
@@ -3041,36 +2984,30 @@ class Boldgrid_Backup_Admin_Core {
3041
 
3042
  // Delete the specified archive file.
3043
  $deleted = $this->archive->delete( $filepath );
3044
- if ( ! $deleted ) {
3045
- // Something went wrong.
3046
- break;
3047
- }
3048
-
3049
- /**
3050
- * Take action after a backup has been deleted due to retention.
3051
- *
3052
- * @since 1.5.3
3053
- *
3054
- * @param string $filepath
3055
- */
3056
- do_action( 'boldgrid_backup_retention_deleted', $filepath );
3057
 
3058
  // Decrease the archive count.
3059
  $archives_count --;
3060
 
3061
  // Increment the counter.
3062
  $counter --;
3063
- }
3064
- }
3065
 
3066
- /**
3067
- * Add thickbox to bolgrid_backup admin pages.
3068
- *
3069
- * @since 1.14.0
3070
- */
3071
- public function add_thickbox( $hook_suffix ) {
3072
- if ( false !== strpos( $hook_suffix, 'boldgrid-backup' ) ) {
3073
- add_thickbox();
 
 
 
 
 
 
3074
  }
 
 
 
3075
  }
3076
  }
384
  */
385
  public $db_omit;
386
 
 
 
 
 
 
 
 
 
387
  /**
388
  * An instance of Boldgrid_Backup_Admin_Filelist.
389
  *
574
  */
575
  public $activity;
576
 
 
 
 
 
 
 
 
 
577
  /**
578
  * Constructor.
579
  *
701
 
702
  $this->dashboard = new Boldgrid_Backup_Admin_Dashboard( $this );
703
 
704
+ // Instantiate Boldgrid\Library\Library\Plugin\Plugin.
705
+ $this->plugin = new \Boldgrid\Library\Library\Plugin\Plugin( 'boldgrid-backup', $this->configs );
 
 
 
 
706
  $this->premium_page = new Boldgrid_Backup_Admin_Premium_Features( $this );
707
 
 
 
 
 
 
 
708
  // Ensure there is a backup identifier.
709
  $this->get_backup_identifier();
710
 
1262
  $status = $importer->import( $db_dump_filepath );
1263
 
1264
  if ( ! empty( $status['error'] ) ) {
 
1265
  do_action( 'boldgrid_backup_notice', $status['error'], 'notice notice-error is-dismissible' );
1266
  return false;
1267
  }
1540
  $this->logger->init( 'archive-' . time() . '.log' );
1541
  $this->logger->add( 'Backup process initialized.' );
1542
 
 
 
1543
  $this->pre_auto_update = 'pre_auto_update' === current_filter();
1544
 
1545
  /*
2422
 
2423
  // Display notice of deletion status.
2424
  if ( ! $restore_ok ) {
2425
+ $error_message = esc_html__( 'Could not restore database.', 'boldgrid-backup' );
2426
  $this->logger->add( $error_message );
2427
  return [ 'error' => $error_message ];
2428
  }
2478
  global $pagenow;
2479
 
2480
  // Thickbox used for Backup Site Now modal.
2481
+ add_thickbox();
2482
  wp_enqueue_style( 'boldgrid-backup-admin-new-thickbox-style' );
2483
 
2484
  wp_enqueue_style( 'bglib-ui-css' );
2500
  $this->folder_exclusion->enqueue_scripts();
2501
  $this->db_omit->enqueue_scripts();
2502
 
2503
+ // If uploading an archive file.
2504
+ if ( ! empty( $_FILES['file'] ) ) {
2505
+ $this->upload->upload_archive_file();
2506
+ }
2507
+
2508
  // Get archive list.
2509
  $archives = $this->get_archive_list();
2510
 
2575
  // If there were any errors encountered during the backup, save them to the In Progress data.
2576
  if ( ! empty( $archive_info['error'] ) ) {
2577
  Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'error', $archive_info['error'] );
 
 
 
 
 
2578
  }
2579
 
2580
  if ( $this->is_archiving_update_protection ) {
2744
  BOLDGRID_BACKUP_VERSION, 'all'
2745
  );
2746
 
2747
+ // Load template view.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2748
  include BOLDGRID_BACKUP_PATH . '/admin/partials/boldgrid-backup-admin-test.php';
 
 
 
 
2749
  }
2750
 
2751
  /**
2940
  * @return null
2941
  */
2942
  public function enforce_retention() {
2943
+ $logger = new Boldgrid_Backup_Admin_Log( $this );
2944
+ $logger->init( 'retention-local.log' );
2945
+ $logger->add( 'Beginning core::enforce_retention...' );
2946
+
2947
  $settings = $this->settings->get_settings();
2948
+ $logger->add( 'Retention count: ' . $settings['retention_count'] );
2949
 
2950
  $archives = $this->get_archive_list();
2951
+ $logger->add( 'Number of archives found: ' . count( $archives ) );
2952
 
2953
  // Remove from the list of archives any that have been flagged as being protected.
2954
+ $protected_count = 0;
2955
  foreach ( $archives as $key => $archive ) {
2956
  $this->archive->init( $archive['filepath'] );
2957
  if ( '1' === $this->archive->get_attribute( 'protect' ) ) {
2958
  unset( $archives[ $key ] );
2959
+ $protected_count++;
2960
  }
2961
  }
2962
+ $logger->add( 'Number of protected archives found: ' . $protected_count );
2963
  $archives = array_values( $archives );
2964
 
2965
  // Get the archives file count.
2967
 
2968
  // If the archive count is not beyond the set retention count, then return.
2969
  if ( empty( $settings['retention_count'] ) || $archives_count <= $settings['retention_count'] ) {
2970
+ $logger->add( 'No backups to delete at this time due to retention settings.' );
2971
  return;
2972
  }
2973
 
 
 
 
2974
  // Initialize $counter.
2975
  $counter = $archives_count - 1;
2976
 
2984
 
2985
  // Delete the specified archive file.
2986
  $deleted = $this->archive->delete( $filepath );
 
 
 
 
 
 
 
 
 
 
 
 
 
2987
 
2988
  // Decrease the archive count.
2989
  $archives_count --;
2990
 
2991
  // Increment the counter.
2992
  $counter --;
 
 
2993
 
2994
+ if ( $deleted ) {
2995
+ $logger->add( 'Deleted ' . $filepath );
2996
+
2997
+ /**
2998
+ * Take action after a backup has been deleted due to retention.
2999
+ *
3000
+ * @since 1.5.3
3001
+ *
3002
+ * @param string $filepath
3003
+ */
3004
+ do_action( 'boldgrid_backup_retention_deleted', $filepath );
3005
+ } else {
3006
+ $logger->add( 'Failed to delete ' . $filepath );
3007
+ }
3008
  }
3009
+
3010
+ $logger->add( 'Completed core::enforce_retention.' );
3011
+ $logger->add_separator();
3012
  }
3013
  }
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
@@ -67,8 +67,7 @@ class Boldgrid_Backup_Admin_Db_Dump {
67
  *
68
  * In the list below, it is important that $include_tables is processed last.
69
  */
70
- $include_views = $this->core->db_get->filter_by_type( $include_tables, 'VIEW' );
71
-
72
  $include_tables = $this->core->db_get->filter_by_type( $include_tables, 'BASE TABLE' );
73
 
74
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
@@ -107,19 +106,6 @@ class Boldgrid_Backup_Admin_Db_Dump {
107
  $settings['default-character-set'] = $wpdb->charset;
108
  }
109
 
110
- if ( ! empty( $include_views ) ) {
111
- $db_import = new Boldgrid_Backup_Admin_Db_Import();
112
- $user_has_privileges = $db_import->has_db_privileges( array( 'SHOW VIEW' ) );
113
- if ( false === $user_has_privileges ) {
114
- return array(
115
- 'error' => esc_html__(
116
- 'The database contains VIEWS, but the database user does not have the permissions needed to create a backup.',
117
- 'boldgrid-backup'
118
- ),
119
- );
120
- }
121
- }
122
-
123
  try {
124
  $dump = new IMysqldump\Mysqldump(
125
  $this->get_connection_string(),
67
  *
68
  * In the list below, it is important that $include_tables is processed last.
69
  */
70
+ $include_views = $this->core->db_get->filter_by_type( $include_tables, 'VIEW' );
 
71
  $include_tables = $this->core->db_get->filter_by_type( $include_tables, 'BASE TABLE' );
72
 
73
  Boldgrid_Backup_Admin_In_Progress_Data::set_args(
106
  $settings['default-character-set'] = $wpdb->charset;
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  try {
110
  $dump = new IMysqldump\Mysqldump(
111
  $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-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-in-progress-tmp.php CHANGED
@@ -84,22 +84,23 @@ class Boldgrid_Backup_Admin_In_Progress_Tmp {
84
  * @return array
85
  */
86
  private function get_system_zip() {
87
- $data = [];
88
-
89
- $filepath = Boldgrid_Backup_Admin_In_Progress_Data::get_arg( 'filepath' );
90
- $filename = basename( $filepath );
 
91
 
92
- $dirlist = $this->core->backup_dir->dirlist_containing( $filename );
 
93
 
94
- if ( ! empty( $dirlist[ $filename ] ) ) {
95
- $data = [
96
- 'size' => $dirlist[ $filename ]['size'],
97
- 'lastmodunix' => $dirlist[ $filename ]['lastmodunix'],
98
- 'size_format' => size_format( $dirlist[ $filename ]['size'], 2 ),
99
- ];
100
  }
101
 
102
- return $data;
 
 
 
 
103
  }
104
 
105
  /**
84
  * @return array
85
  */
86
  private function get_system_zip() {
87
+ $dir = Boldgrid_Backup_Admin_Compressor_System_Zip_Temp_Folder::get_path();
88
+ $dirlist = $this->core->wp_filesystem->dirlist( $dir );
89
+ $dirlist = is_array( $dirlist ) ? $dirlist : [];
90
+ $size = 0;
91
+ $lastmodunix = 0;
92
 
93
+ foreach ( $dirlist as $file ) {
94
+ $size += ! empty( $file['size'] ) ? $file['size'] : 0;
95
 
96
+ $lastmodunix = ! empty( $file['lastmodunix'] ) ? $file['lastmodunix'] : $lastmodunix;
 
 
 
 
 
97
  }
98
 
99
+ return [
100
+ 'size' => $size,
101
+ 'lastmodunix' => $lastmodunix,
102
+ 'size_format' => size_format( $size, 2 ),
103
+ ];
104
  }
105
 
106
  /**
admin/class-boldgrid-backup-admin-log.php CHANGED
@@ -153,6 +153,15 @@ class Boldgrid_Backup_Admin_Log {
153
  $this->add( $message );
154
  }
155
 
 
 
 
 
 
 
 
 
 
156
  /**
157
  * Delete old log files.
158
  *
@@ -199,13 +208,17 @@ class Boldgrid_Backup_Admin_Log {
199
 
200
  $this->init_signal_handler();
201
 
202
- $log_created = $this->core->wp_filesystem->touch( $this->filepath );
 
 
 
203
 
204
- if ( $log_created ) {
205
- $this->add_generic();
 
206
  }
207
 
208
- return $log_created;
209
  }
210
 
211
  /**
@@ -278,11 +291,10 @@ class Boldgrid_Backup_Admin_Log {
278
  *
279
  * @since 1.12.6
280
  *
281
- * @param int $signo The signal being handled.
282
- * @param array $signinfo Additional information about signal.
283
  */
284
- public function signal_handler( $signo, $signinfo ) {
285
- $this->add( 'Signal received: ' . $signo . ' ' . wp_json_encode( $signinfo ) );
286
 
287
  exit;
288
  }
153
  $this->add( $message );
154
  }
155
 
156
+ /**
157
+ * Add a separator in the log.
158
+ *
159
+ * @since 1.13.7
160
+ */
161
+ public function add_separator() {
162
+ $this->add( '--------------------------------------------------------------------------------' );
163
+ }
164
+
165
  /**
166
  * Delete old log files.
167
  *
208
 
209
  $this->init_signal_handler();
210
 
211
+ $log_exists = $this->core->wp_filesystem->exists( $this->filepath );
212
+
213
+ if ( ! $log_exists ) {
214
+ $log_created = $this->core->wp_filesystem->touch( $this->filepath );
215
 
216
+ if ( $log_created ) {
217
+ $this->add_generic();
218
+ }
219
  }
220
 
221
+ return $log_exists || $log_created;
222
  }
223
 
224
  /**
291
  *
292
  * @since 1.12.6
293
  *
294
+ * @param int The signal being handled.
 
295
  */
296
+ public function signal_handler( $signo ) {
297
+ $this->add( 'Signal received: ' . $signo );
298
 
299
  exit;
300
  }
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 );
@@ -609,15 +609,6 @@ class Boldgrid_Backup_Admin_Settings {
609
  }
610
  }
611
 
612
- /*
613
- * Save Compression Level Settings.
614
- *
615
- * @since 1.14.0
616
- */
617
- if ( isset( $_POST['compression_level'] ) ) {
618
- $settings['compression_level'] = $_POST['compression_level'];
619
- }
620
-
621
  /*
622
  * Save extractor settings.
623
  *
@@ -709,15 +700,6 @@ class Boldgrid_Backup_Admin_Settings {
709