WordPress Backup and Migrate Plugin – Backup Guard - Version 1.5.4

Version Description

  • Improvement of restore, respective alert massage added when users try to make a restore
  • Improvement of Cloud section, before trying to upload to cloud connection is checked
  • Improvement of admin side
  • Bug fixed related to backups with success with 0MB
  • Bug fixed related to conflict with some themes with admin side functionality
Download this release

Release Info

Developer BackupGuard
Plugin Icon 128x128 WordPress Backup and Migrate Plugin – Backup Guard
Version 1.5.4
Comparing to
See all releases

Code changes from version 1.5.3 to 1.5.4

BackupGuard.php CHANGED
@@ -482,6 +482,7 @@ function backup_guard_register_ajax_callbacks()
482
  add_action('wp_ajax_backup_guard_importKeyFile', 'backup_guard_import_key_file');
483
  add_action('wp_ajax_backup_guard_isFeatureAvailable', 'backup_guard_is_feature_available');
484
  add_action('wp_ajax_backup_guard_dismiss_discount_notice', 'backup_guard_dismiss_discount_notice');
 
485
  add_action('wp_ajax_backup_guard_checkPHPVersionCompatibility', 'backup_guard_check_php_version_compatibility');
486
  add_action('wp_ajax_backup_guard_setUserInfoVerificationPopupState', 'backup_guard_set_user_info_verification_popup_state');
487
  add_action('wp_ajax_backup_guard_storeSubscriberInfo', 'backup_guard_store_subscriber_info');
@@ -578,6 +579,13 @@ function backup_guard_is_feature_available()
578
  require_once(SG_PUBLIC_AJAX_PATH.'isFeatureAvailable.php');
579
  }
580
 
 
 
 
 
 
 
 
581
  function backup_guard_check_php_version_compatibility()
582
  {
583
  check_ajax_referer('backupGuardAjaxNonce', 'token');
@@ -826,6 +834,8 @@ function sgBackupAdminInit() {
826
  if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE && $isLoggedIn) {
827
  require_once(dirname(__FILE__).'/plugin-update-checker/plugin-update-checker.php');
828
  require_once(dirname(__FILE__).'/plugin-update-checker/Puc/v4/Utils.php');
 
 
829
  require_once(SG_LIB_PATH.'SGAuthClient.php');
830
 
831
  $licenseKey = SGConfig::get('SG_LICENSE_KEY');
@@ -907,8 +917,15 @@ function backupGuardloadTextDomain()
907
  }
908
  }
909
 
910
- if (backupGuardShouldShowDiscountNotice() && checkDueDateDiscount()) {
 
911
  add_action('admin_notices', 'backup_guard_discount_notice');
 
 
 
 
 
 
912
  }
913
 
914
  function backup_guard_discount_notice()
@@ -916,28 +933,191 @@ function backup_guard_discount_notice()
916
  $capabilities = backupGuardGetCapabilities();
917
  $upgradeUrl = BG_UPGRADE_URL;
918
  ?>
919
- <div class="backup-guard-discount-notice updated notice is-dismissible">
920
- <div class="sgbg-col sgbg-col1"></div>
921
- <div class="sgbg-col sgbg-col2"></div>
922
- <div class="sgbg-col sgbg-col3">
923
- <div class="sgbg-text-col-1">
924
- -50%
925
- </div>
926
- <div class="sgbg-text-col-2">
927
- <div class="sgbg-discount-text-1">Discount</div>
928
- <div class="sgbg-discount-text-2">All Backup Guard Solutions</div>
 
 
929
  </div>
930
  </div>
931
- <div class="sgbg-col sgbg-col4">
932
- <a href="https://backup-guard.com/products/backup-wordpress" target="_blank"><button class="sgbg-button">Click Here</button></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
933
  </div>
934
  </div>
935
  <style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
  .backup-guard-discount-notice.updated.notice.is-dismissible {
937
- padding: 0;
938
  border-left-color: #FFFFFF !important;
939
  background-color: #000000;
940
  height: 160px;
 
 
 
941
  }
942
  .backup-guard-discount-notice button:before {
943
  color: #ffffff !important;
@@ -1014,12 +1194,17 @@ function backup_guard_discount_notice()
1014
  border: 1px solid #FFFFFF;
1015
  color: #FFFFFF;
1016
  }
 
 
 
 
 
 
 
 
1017
  .backup-guard-discount-notice .notice-dismiss::before {
1018
- content: "x";
1019
- font-weight: 300;
1020
- font-family: Arial, sans-serif;
1021
  }
1022
-
1023
  @media (max-width: 1810px) {
1024
  .sgbg-text-col-1 {
1025
  font-size: 80px;
482
  add_action('wp_ajax_backup_guard_importKeyFile', 'backup_guard_import_key_file');
483
  add_action('wp_ajax_backup_guard_isFeatureAvailable', 'backup_guard_is_feature_available');
484
  add_action('wp_ajax_backup_guard_dismiss_discount_notice', 'backup_guard_dismiss_discount_notice');
485
+ add_action('wp_ajax_backup_guard_checkFreeMigration', 'backup_guard_check_free_migration');
486
  add_action('wp_ajax_backup_guard_checkPHPVersionCompatibility', 'backup_guard_check_php_version_compatibility');
487
  add_action('wp_ajax_backup_guard_setUserInfoVerificationPopupState', 'backup_guard_set_user_info_verification_popup_state');
488
  add_action('wp_ajax_backup_guard_storeSubscriberInfo', 'backup_guard_store_subscriber_info');
579
  require_once(SG_PUBLIC_AJAX_PATH.'isFeatureAvailable.php');
580
  }
581
 
582
+ function backup_guard_check_free_migration()
583
+ {
584
+ check_ajax_referer('backupGuardAjaxNonce', 'token');
585
+ require_once(SG_PUBLIC_AJAX_PATH.'checkFreeMigration.php');
586
+ die;
587
+ }
588
+
589
  function backup_guard_check_php_version_compatibility()
590
  {
591
  check_ajax_referer('backupGuardAjaxNonce', 'token');
834
  if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE && $isLoggedIn) {
835
  require_once(dirname(__FILE__).'/plugin-update-checker/plugin-update-checker.php');
836
  require_once(dirname(__FILE__).'/plugin-update-checker/Puc/v4/Utils.php');
837
+ require_once(dirname(__FILE__).'/plugin-update-checker/Puc/v4/UpdateChecker.php');
838
+ require_once(dirname(__FILE__).'/plugin-update-checker/Puc/v4/Scheduler.php');
839
  require_once(SG_LIB_PATH.'SGAuthClient.php');
840
 
841
  $licenseKey = SGConfig::get('SG_LICENSE_KEY');
917
  }
918
  }
919
 
920
+ $pluginCapabilities = backupGuardGetCapabilities();
921
+ if (backupGuardShouldShowDiscountNotice() && checkDueDateDiscount() && $pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE) {
922
  add_action('admin_notices', 'backup_guard_discount_notice');
923
+ add_action('admin_enqueue_scripts', 'sgbgChristmasCSS');
924
+ }
925
+
926
+ function sgbgChristmasCSS($hook)
927
+ {
928
+ wp_enqueue_style('backup-guard-less', plugin_dir_url(__FILE__).'public/css/bgstyle.less.css');
929
  }
930
 
931
  function backup_guard_discount_notice()
933
  $capabilities = backupGuardGetCapabilities();
934
  $upgradeUrl = BG_UPGRADE_URL;
935
  ?>
936
+ <div style="visibility: hidden;height: 0;">
937
+ <div id="sg-christmas-popup-content-wrapper">
938
+ <div class="sgbg-christmas-close-popup"></div>
939
+ <div class="sg-christmas-text-image1"></div>
940
+ <p class="sg-christmas-p">
941
+ <span class="sg-christmas-percent-span"><b>Save 50%</b></span>
942
+ <span>for all our products during the Christmas</span>
943
+ </p>
944
+ <div class="sg-christmas-btn-wrapper">
945
+ <a href="<?php echo BG_UPGRADE_URL; ?>" target="_blank">
946
+ <button class="sg-christmas-button">Click Here</button>
947
+ </a>
948
  </div>
949
  </div>
950
+ </div>
951
+ <div class="sg-wrapper-less">
952
+ <div class="backup-guard-discount-notice updated notice is-dismissible sg-wrapper-less">
953
+ <div class="col-lg-3 col-md-4 col-sm-4">
954
+ <div class="sg-christmas-logo"></div>
955
+ </div>
956
+ <div class="col-lg-4 col-md-4 col-sm-4">
957
+ <div class="sg-christmas-text-image"></div>
958
+ </div>
959
+ <div class="col-lg-4 col-md-4 col-sm-4">
960
+ <div class="sg-christmas-txt">
961
+ <div class="sg-christmas-percent"><p>Save 50% </p></div>
962
+ <p>for all our products during the Christmas</p>
963
+ <a href="<?php echo BG_UPGRADE_URL; ?>" target="_blank">
964
+ <button class="sg-christmas-banner-button">Click Here</button>
965
+ </a>
966
+ </div>
967
+ </div>
968
+ <div class="col-lg-3 col-md-0"></div>
969
+ <!-- <a href="--><?php //echo SG_BACKUP_SITE_PRICING_URL; ?><!--" target="_blank">-->
970
+ <!-- <div class="sgbg-banner-content">-->
971
+ <!-- </div>-->
972
+ <!-- </a>-->
973
+ <!-- <div class="sgbg-col sgbg-col1"></div>-->
974
+ <!-- <div class="sgbg-col sgbg-col2"></div>-->
975
+ <!-- <div class="sgbg-col sgbg-col3">-->
976
+ <!-- <div class="sgbg-text-col-1">-->
977
+ <!-- -50%-->
978
+ <!-- </div>-->
979
+ <!-- <div class="sgbg-text-col-2">-->
980
+ <!-- <div class="sgbg-discount-text-1">Discount</div>-->
981
+ <!-- <div class="sgbg-discount-text-2">All Backup Guard Solutions</div>-->
982
+ <!-- </div>-->
983
+ <!-- </div>-->
984
+ <!-- <div class="sgbg-col sgbg-col4">-->
985
+ <!-- <a href="https://backup-guard.com/products/backup-wordpress" target="_blank"><button class="sgbg-button">Click Here</button></a>-->
986
+ <!-- </div>-->
987
  </div>
988
  </div>
989
  <style>
990
+ .sg-christmas-txt {
991
+ color: #ffffff;
992
+ font-size: 25px;
993
+ margin-top: 10px;
994
+ text-align: left;
995
+ }
996
+ .sg-christmas-button {
997
+ background-image: url("<?php echo SG_IMAGE_URL ?>christmas-button.png");
998
+ width: 242px;
999
+ height: 79px;
1000
+ border: none;
1001
+ box-shadow: none;
1002
+ background-color: rgba(0, 0, 0, 0);
1003
+ margin: 0 auto !important;
1004
+ font-size: 25px;
1005
+ cursor: pointer;
1006
+ color: #ffffff !important;
1007
+ }
1008
+ .sg-christmas-banner-button {
1009
+ background-image: url("<?php echo SG_IMAGE_URL ?>christmas-banner-btn.png");
1010
+ width: 149px;
1011
+ height: 80px;
1012
+ border: none;
1013
+ box-shadow: none;
1014
+ background-color: rgba(0, 0, 0, 0);
1015
+ margin: 0 auto !important;
1016
+ font-size: 20px !important;
1017
+ cursor: pointer;
1018
+ color: #ffffff !important;
1019
+ background-repeat: no-repeat;
1020
+ background-position: center center;
1021
+ }
1022
+ .sg-christmas-button:focus {
1023
+ border: 2px solid #0095FE !important;
1024
+ outline: none;
1025
+ }
1026
+ .sg-christmas-button:hover {
1027
+ font-size: 20px;
1028
+ }
1029
+ .sg-christmas-banner-button:hover {
1030
+ font-size: 15px !important;
1031
+ }
1032
+ .sg-christmas-txt a:focus {
1033
+ box-shadow: none;
1034
+ outline: none;
1035
+ border: none;
1036
+ }
1037
+ .sg-christmas-banner-button:focus {
1038
+ outline: none !important;
1039
+ }
1040
+ .sg-christmas-logo {
1041
+ height: 125px;
1042
+ width: 318px;
1043
+ background-image: url("<?php echo SG_IMAGE_URL ?>christmas-logo.png");
1044
+ background-repeat: no-repeat;
1045
+ margin-top: 11px;
1046
+ position: absolute;
1047
+ top: -3px;
1048
+ left: 13px;
1049
+ }
1050
+ .sg-christmas-text-image {
1051
+ height: 145px;
1052
+ background-image: url("<?php echo SG_IMAGE_URL ?>christmas-text.png");
1053
+ background-size: contain;
1054
+ background-repeat: no-repeat;
1055
+ background-position: center;
1056
+ }
1057
+ .sg-christmas-percent {
1058
+ margin: 15px 0 5px 0;
1059
+ }
1060
+ .sg-christmas-percent p {
1061
+ font-size: 40px;
1062
+ }
1063
+ .sg-christmas-txt p {
1064
+ margin: 0 !important;
1065
+ padding: 0 !important;
1066
+ line-height: 1 !important;
1067
+ }
1068
+ #sg-christmas-popup-content-wrapper {
1069
+ position: relative;
1070
+ width: 640px;
1071
+ height: 538px;
1072
+ max-width: 100%;
1073
+ max-height: 100%;
1074
+ background-image: url("<?php echo SG_IMAGE_URL ?>plugin-christmas-popup.png");
1075
+ background-repeat: no-repeat;
1076
+ background-size: 100% 100%;
1077
+ background-position: top center;
1078
+ box-sizing: border-box;
1079
+ padding-top: 183px;
1080
+ }
1081
+ .sg-christmas-p {
1082
+ text-align: center;
1083
+ color: #FFFFff;
1084
+ font-size: 25px;
1085
+ margin-top: 0;
1086
+ margin-bottom: 40px;
1087
+ }
1088
+ #sg-christmas-popup-content-wrapper .sg-christmas-p {
1089
+ margin-top: 108px;
1090
+ }
1091
+ .sg-christmas-percent-span {
1092
+ display: block;
1093
+ }
1094
+ .sg-christmas-btn-wrapper {
1095
+ text-align: center;
1096
+ }
1097
+ .sgbg-banner-content {
1098
+ height: 160px;
1099
+ background-image: url("<?php echo SG_IMAGE_URL ?>halloween.png");
1100
+ background-size: cover;
1101
+ background-repeat: no-repeat;
1102
+ }
1103
+ .sgbg-christmas-close-popup {
1104
+ position: absolute;
1105
+ top: 43px;
1106
+ right: 16px;
1107
+ background-size: contain;
1108
+ width: 20px;
1109
+ height: 21px;
1110
+ background-repeat: no-repeat;
1111
+ background-image: url("<?php echo SG_IMAGE_URL ?>christmas-close.png");
1112
+ cursor: pointer;
1113
+ }
1114
  .backup-guard-discount-notice.updated.notice.is-dismissible {
 
1115
  border-left-color: #FFFFFF !important;
1116
  background-color: #000000;
1117
  height: 160px;
1118
+ padding: 5px 0;
1119
+ background-image: url("<?php echo SG_IMAGE_URL ?>christmas-bg.png");
1120
+ background-size: 100% 100%;
1121
  }
1122
  .backup-guard-discount-notice button:before {
1123
  color: #ffffff !important;
1194
  border: 1px solid #FFFFFF;
1195
  color: #FFFFFF;
1196
  }
1197
+ .backup-guard-discount-notice .notice-dismiss {
1198
+ background-image: url("<?php echo SG_IMAGE_URL ?>christmas-close.png");
1199
+ position: absolute;
1200
+ top: 8px;
1201
+ right: 8px;
1202
+ background-size: contain;
1203
+ background-repeat: no-repeat;
1204
+ }
1205
  .backup-guard-discount-notice .notice-dismiss::before {
1206
+ display: none;
 
 
1207
  }
 
1208
  @media (max-width: 1810px) {
1209
  .sgbg-text-col-1 {
1210
  font-size: 80px;
README.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://backup-guard.com/products/backup-wordpress
6
  Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
7
  Requires at least: 3.8
8
  Tested up to: 5.6
9
- Stable tag: 1.5.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -107,8 +107,8 @@ The documentation can be found here: <a href="https://backup-guard.com/products
107
  = How to install? =
108
 
109
  <ul>
110
- <li>Install <strong>Free</strong> version: <a href="https://backup-guard.com/products/backup-wordpress/doc/install-backupguard-free">here</a></li>
111
- <li>Install <strong>Pro</strong> version: <a href="https://backup-guard.com/products/backup-wordpress/doc/install-backupguard-pro">here</a></li>
112
  </ul>
113
 
114
  = Does Backup Guard provide migration with the free version? =
@@ -167,6 +167,13 @@ When you are facing an issue of any kind with any of our products, the first thi
167
  6. Site backup customization
168
 
169
  == Changelog ==
 
 
 
 
 
 
 
170
  = 1.5.3 =
171
  * Bug fixed related to jQuery version to support WordPress upcoming version 5.6
172
 
6
  Tags: backup, wordpress backup plugin, backup plugin, database backup, migrate, back up
7
  Requires at least: 3.8
8
  Tested up to: 5.6
9
+ Stable tag: 1.5.4
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
107
  = How to install? =
108
 
109
  <ul>
110
+ <li>Install <strong>Free</strong> version: <a href="https://help.backup-guard.com/en/article/install-backupguard-free-wvg8x0/">here</a></li>
111
+ <li>Install <strong>Pro</strong> version: <a href="https://help.backup-guard.com/en/article/install-backupguard-pro-1sph8ue/">here</a></li>
112
  </ul>
113
 
114
  = Does Backup Guard provide migration with the free version? =
167
  6. Site backup customization
168
 
169
  == Changelog ==
170
+ = 1.5.4 =
171
+ * Improvement of restore, respective alert massage added when users try to make a restore
172
+ * Improvement of Cloud section, before trying to upload to cloud connection is checked
173
+ * Improvement of admin side
174
+ * Bug fixed related to backups with success with 0MB
175
+ * Bug fixed related to conflict with some themes with admin side functionality
176
+
177
  = 1.5.3 =
178
  * Bug fixed related to jQuery version to support WordPress upcoming version 5.6
179
 
backup.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Backup
5
  * Plugin URI: https://backup-guard.com/products/backup-wordpress
6
  * Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
7
- * Version: 1.5.3
8
  * Author: BackupGuard
9
  * Author URI: https://backup-guard.com/products/backup-wordpress
10
  * License: GPL-2.0+
@@ -16,7 +16,7 @@ if (function_exists('activate_backup_guard')) {
16
  }
17
 
18
  if (!defined('SG_BACKUP_GUARD_VERSION')) {
19
- define('SG_BACKUP_GUARD_VERSION', '1.5.3');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
4
  * Plugin Name: Backup
5
  * Plugin URI: https://backup-guard.com/products/backup-wordpress
6
  * Description: Backup Guard is the most complete site backup and restore plugin. We offer the easiest way to backup, restore or migrate your site. You can backup your files, database or both.
7
+ * Version: 1.5.4
8
  * Author: BackupGuard
9
  * Author URI: https://backup-guard.com/products/backup-wordpress
10
  * License: GPL-2.0+
16
  }
17
 
18
  if (!defined('SG_BACKUP_GUARD_VERSION')) {
19
+ define('SG_BACKUP_GUARD_VERSION', '1.5.4');
20
  }
21
 
22
  if (!defined('SG_BACKUP_GUARD_MAIN_FILE')) {
com/config/config.php CHANGED
@@ -115,6 +115,9 @@ define('SG_REPORT_FILE_NAME', 'report.txt');
115
  //2GB in bytes
116
  define('SG_ARCHIVE_MAX_SIZE_32', 2000000000);
117
 
 
 
 
118
  // Backup methods
119
  define('SG_BACKUP_METHOD_MIGRATE', 1);
120
  define('SG_BACKUP_METHOD_STANDARD', 2);
115
  //2GB in bytes
116
  define('SG_ARCHIVE_MAX_SIZE_32', 2000000000);
117
 
118
+ // Valid Archive minimum file size
119
+ define('SG_BACKUP_VALID_ARCHIVE_SIZE', 500);
120
+
121
  // Backup methods
122
  define('SG_BACKUP_METHOD_MIGRATE', 1);
123
  define('SG_BACKUP_METHOD_STANDARD', 2);
com/core/backup/SGBackup.php CHANGED
@@ -463,13 +463,20 @@ class SGBackup implements SGIBackupDelegate
463
  {
464
  //check list of storages to upload if any
465
  $uploadToStorages = count($this->pendingStorageUploads)?true:false;
466
-
467
  if (SGBoot::isFeatureAvailable('STORAGE') && $uploadToStorages)
468
  {
469
  while (count($this->pendingStorageUploads))
470
  {
 
471
  $storageId = $this->pendingStorageUploads[0];
472
 
 
 
 
 
 
 
 
473
  if ($this->state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
474
  // Create action for upload
475
  $this->actionId = SGBackupStorage::queueBackupForUpload($this->fileName, $storageId, $this->options);
@@ -479,7 +486,7 @@ class SGBackup implements SGIBackupDelegate
479
  $this->actionId = $this->state->getActionId();
480
  }
481
 
482
- $sgBackupStorage = SGBackupStorage::getInstance();
483
  $sgBackupStorage->setDelegate($this);
484
  $sgBackupStorage->setState($this->state);
485
  $sgBackupStorage->setToken($this->token);
463
  {
464
  //check list of storages to upload if any
465
  $uploadToStorages = count($this->pendingStorageUploads)?true:false;
 
466
  if (SGBoot::isFeatureAvailable('STORAGE') && $uploadToStorages)
467
  {
468
  while (count($this->pendingStorageUploads))
469
  {
470
+ $sgBackupStorage = SGBackupStorage::getInstance();
471
  $storageId = $this->pendingStorageUploads[0];
472
 
473
+ $storageInfo = $sgBackupStorage->getStorageInfoById($storageId);
474
+ if (empty($storageInfo['isConnected'])) {
475
+ SGBackupLog::write($storageInfo['storageName'].' stopped');
476
+ array_shift($this->pendingStorageUploads);
477
+ continue;
478
+ }
479
+
480
  if ($this->state->getAction() == SG_STATE_ACTION_PREPARING_STATE_FILE) {
481
  // Create action for upload
482
  $this->actionId = SGBackupStorage::queueBackupForUpload($this->fileName, $storageId, $this->options);
486
  $this->actionId = $this->state->getActionId();
487
  }
488
 
489
+
490
  $sgBackupStorage->setDelegate($this);
491
  $sgBackupStorage->setState($this->state);
492
  $sgBackupStorage->setToken($this->token);
com/core/backup/SGBackupStorage.php CHANGED
@@ -198,8 +198,24 @@ class SGBackupStorage implements SGIStorageDelegate
198
 
199
  private function storageObjectById($storageId, &$storageName = '')
200
  {
201
- $storageClassName = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  $storageId = (int)$storageId;
 
 
203
  switch ($storageId) {
204
  case SG_STORAGE_FTP:
205
  if (SGBoot::isFeatureAvailable('FTP')) {
@@ -212,7 +228,11 @@ class SGBackupStorage implements SGIStorageDelegate
212
  else {
213
  $storageName = 'SFTP';
214
  }
 
215
 
 
 
 
216
  $storageClassName = "SGFTPManager";
217
  }
218
  break;
@@ -221,38 +241,65 @@ class SGBackupStorage implements SGIStorageDelegate
221
  $storageName = 'Dropbox';
222
  $storageClassName = "SGDropboxStorage";
223
  }
 
 
 
 
 
224
  break;
225
  case SG_STORAGE_GOOGLE_DRIVE:
226
  if (SGBoot::isFeatureAvailable('GOOGLE_DRIVE')) {
227
  $storageName = 'Google Drive';
228
  $storageClassName = "SGGoogleDriveStorage";
229
  }
 
 
 
 
 
230
  break;
231
  case SG_STORAGE_AMAZON:
232
  if (SGBoot::isFeatureAvailable('AMAZON')) {
233
  $storageName = 'Amazon S3';
234
  $storageClassName = "SGAmazonStorage";
235
  }
 
 
 
 
 
236
  break;
237
  case SG_STORAGE_ONE_DRIVE:
238
  if (SGBoot::isFeatureAvailable('ONE_DRIVE')) {
239
  $storageName = 'One Drive';
240
  $storageClassName = "SGOneDriveStorage";
241
  }
 
 
 
 
 
242
  break;
243
  case SG_STORAGE_BACKUP_GUARD:
244
  if (SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD) {
245
  $storageName = 'BackupGuard';
246
  $storageClassName = "BackupGuard\Storage";
247
  }
 
 
 
 
 
248
  break;
249
  }
250
 
251
- if (!$storageClassName) {
252
- throw new SGExceptionNotFound('Unknown storage');
253
- }
 
 
254
 
255
- return new $storageClassName();
256
  }
257
 
258
  public function shouldUploadNextChunk()
198
 
199
  private function storageObjectById($storageId, &$storageName = '')
200
  {
201
+ $res = $this->getStorageInfoById($storageId);
202
+ $storageName = $res['storageName'];
203
+ $storageClassName = $res['storageClassName'];
204
+
205
+ if (!$storageClassName) {
206
+ throw new SGExceptionNotFound('Unknown storage');
207
+ }
208
+
209
+ return new $storageClassName();
210
+ }
211
+
212
+ public function getStorageInfoById($storageId)
213
+ {
214
+ $storageName = '';
215
+ $storageClassName = '';
216
  $storageId = (int)$storageId;
217
+ $isConnected = true;
218
+
219
  switch ($storageId) {
220
  case SG_STORAGE_FTP:
221
  if (SGBoot::isFeatureAvailable('FTP')) {
228
  else {
229
  $storageName = 'SFTP';
230
  }
231
+ $isFtpConnected = SGConfig::get('SG_STORAGE_FTP_CONNECTED');
232
 
233
+ if (empty($isFtpConnected)) {
234
+ $isConnected = false;
235
+ }
236
  $storageClassName = "SGFTPManager";
237
  }
238
  break;
241
  $storageName = 'Dropbox';
242
  $storageClassName = "SGDropboxStorage";
243
  }
244
+ $isDropboxConnected = SGConfig::get('SG_DROPBOX_ACCESS_TOKEN');
245
+
246
+ if (empty($isDropboxConnected)) {
247
+ $isConnected = false;
248
+ }
249
  break;
250
  case SG_STORAGE_GOOGLE_DRIVE:
251
  if (SGBoot::isFeatureAvailable('GOOGLE_DRIVE')) {
252
  $storageName = 'Google Drive';
253
  $storageClassName = "SGGoogleDriveStorage";
254
  }
255
+ $isGdriveConnected = SGConfig::get('SG_GOOGLE_DRIVE_REFRESH_TOKEN');
256
+
257
+ if (empty($isGdriveConnected)) {
258
+ $isConnected = false;
259
+ }
260
  break;
261
  case SG_STORAGE_AMAZON:
262
  if (SGBoot::isFeatureAvailable('AMAZON')) {
263
  $storageName = 'Amazon S3';
264
  $storageClassName = "SGAmazonStorage";
265
  }
266
+ $isAmazonConnected = SGConfig::get('SG_STORAGE_AMAZON_CONNECTED');
267
+
268
+ if (empty($isAmazonConnected)) {
269
+ $isConnected = false;
270
+ }
271
  break;
272
  case SG_STORAGE_ONE_DRIVE:
273
  if (SGBoot::isFeatureAvailable('ONE_DRIVE')) {
274
  $storageName = 'One Drive';
275
  $storageClassName = "SGOneDriveStorage";
276
  }
277
+ $isOneDriveConnected = SGConfig::get('SG_ONE_DRIVE_REFRESH_TOKEN');
278
+
279
+ if (empty($isOneDriveConnected)) {
280
+ $isConnected = false;
281
+ }
282
  break;
283
  case SG_STORAGE_BACKUP_GUARD:
284
  if (SGBoot::isFeatureAvailable('BACKUP_GUARD') && SG_SHOW_BACKUPGUARD_CLOUD) {
285
  $storageName = 'BackupGuard';
286
  $storageClassName = "BackupGuard\Storage";
287
  }
288
+ $isBackupGuardConnected = SGConfig::get('SG_BACKUPGUARD_CLOUD_ACCOUNT')?unserialize(SGConfig::get('SG_BACKUPGUARD_CLOUD_ACCOUNT')):'';
289
+
290
+ if (empty($isBackupGuardConnected)) {
291
+ $isConnected = false;
292
+ }
293
  break;
294
  }
295
 
296
+ $res = array(
297
+ 'storageName' => $storageName,
298
+ 'storageClassName' => $storageClassName,
299
+ 'isConnected' => $isConnected,
300
+ );
301
 
302
+ return $res;
303
  }
304
 
305
  public function shouldUploadNextChunk()
public/ajax/checkFreeMigration.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/../boot.php');
3
+ require_once(SG_LIB_PATH.'SGArchive.php');
4
+ $pluginCapabilities = backupGuardGetCapabilities();
5
+
6
+ if ($pluginCapabilities != BACKUP_GUARD_CAPABILITIES_FREE) {
7
+ return '';
8
+ }
9
+ $backupName = $_POST['bname'];
10
+
11
+ $path = SG_BACKUP_DIRECTORY.$backupName.'/'.$backupName.'.sgbp';
12
+
13
+ $sgArchive = new SGArchive($path, 'r');
14
+ $headers = $sgArchive->getArchiveHeaders();
15
+
16
+ $siteUrl = $headers['siteUrl'];
17
+ $dbPrefix = $headers['dbPrefix'];
18
+
19
+ if ($siteUrl != SG_SITE_URL) {
20
+ printf("The source url (%s) doesn’t match the current url (%s). This is considered as migration and it is not available in the free plugin. <a href='%s' target='_blank'>Upgrade now</a>", $siteUrl, SG_SITE_URL, BG_UPGRADE_URL);
21
+ }
22
+ else if ($dbPrefix != SG_ENV_DB_PREFIX) {
23
+ printf("The source db prefix (%s) doesn’t match the current db prefix (%s). This is considered as migration and it is not available in the free plugin.
24
+ You can change the current db prefix manually or upgrade to one of our PRO versions. <a href='%s' target='_blank'>Upgrade now</a>", $dbPrefix, SG_ENV_DB_PREFIX, BG_UPGRADE_URL);
25
+ }
public/ajax/dismissDiscountNotice.php CHANGED
@@ -2,4 +2,4 @@
2
 
3
  require_once(dirname(__FILE__).'/../boot.php');
4
 
5
- SGConfig::set('SG_HIDE_DISCOUNT_NOTICE', 1);
2
 
3
  require_once(dirname(__FILE__).'/../boot.php');
4
 
5
+ SGConfig::set('SG_HIDE_CHRISTMAS_NOTICE', 1);
public/backups.php CHANGED
@@ -105,12 +105,12 @@ This will provide us with an opportunity to make the experience so much better f
105
  <span class="sg-backup-migrate sg-backup-buttons-content"></span>
106
  <span class="sg-backup-buttons-text sg-backup-buttons-content"><?php _backupGuardT('Migrate')?></span>
107
  </a>
108
- <?php if (!(defined('SG_USER_MODE') && SG_USER_MODE)): ?>
109
  <a href="javascript:void(0)" id="sg-import" class="btn btn-primary sg-margin-left-12 pull-left sg-backup-action-buttons" data-toggle="modal" data-modal-name="import" data-remote="modalImport">
110
  <span class="sg-backup-import sg-backup-buttons-content"></span>
111
  <span class="sg-backup-buttons-text sg-backup-buttons-content"><?php _backupGuardT('Import')?><span>
112
  </a>
113
- <?php endif; ?>
114
  <?php if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE): ?>
115
  <a href="<?php echo BACKUP_GUARD_WORDPRESS_SUPPORT_URL; ?>" target="_blank">
116
  <button type="button" id="sg-report-problem-button" class="btn btn btn-primary sg-margin-left-12 pull-right sg-backup-action-buttons sg-button-red pull-right">
@@ -205,7 +205,10 @@ This will provide us with an opportunity to make the experience so much better f
205
  <?php endif;?>
206
  </ul>
207
  </div>
208
- <?php if(file_exists(SG_BACKUP_DIRECTORY.$backup['name'].'/'.$backup['name'].'.sgbp')):?>
 
 
 
209
  <a href="javascript:void(0)" title="<?php _backupGuardT('Restore')?>" class="sg-restore-button btn-xs" data-toggle="modal" data-modal-name="manual-restore" data-remote="modalManualRestore" data-sgbp-params="<?php echo htmlspecialchars($backup['name']) ?>">
210
 
211
  </a>
105
  <span class="sg-backup-migrate sg-backup-buttons-content"></span>
106
  <span class="sg-backup-buttons-text sg-backup-buttons-content"><?php _backupGuardT('Migrate')?></span>
107
  </a>
108
+ <?php if (!(defined('SG_USER_MODE') && SG_USER_MODE)): ?>
109
  <a href="javascript:void(0)" id="sg-import" class="btn btn-primary sg-margin-left-12 pull-left sg-backup-action-buttons" data-toggle="modal" data-modal-name="import" data-remote="modalImport">
110
  <span class="sg-backup-import sg-backup-buttons-content"></span>
111
  <span class="sg-backup-buttons-text sg-backup-buttons-content"><?php _backupGuardT('Import')?><span>
112
  </a>
113
+ <?php endif; ?>
114
  <?php if ($pluginCapabilities == BACKUP_GUARD_CAPABILITIES_FREE): ?>
115
  <a href="<?php echo BACKUP_GUARD_WORDPRESS_SUPPORT_URL; ?>" target="_blank">
116
  <button type="button" id="sg-report-problem-button" class="btn btn btn-primary sg-margin-left-12 pull-right sg-backup-action-buttons sg-button-red pull-right">
205
  <?php endif;?>
206
  </ul>
207
  </div>
208
+ <?php
209
+ $path = SG_BACKUP_DIRECTORY.$backup['name'].'/'.$backup['name'].'.sgbp';
210
+ ?>
211
+ <?php if(file_exists($path) && ($backup['status'] != SG_ACTION_STATUS_ERROR) && (filesize($path) > SG_BACKUP_VALID_ARCHIVE_SIZE)):?>
212
  <a href="javascript:void(0)" title="<?php _backupGuardT('Restore')?>" class="sg-restore-button btn-xs" data-toggle="modal" data-modal-name="manual-restore" data-remote="modalManualRestore" data-sgbp-params="<?php echo htmlspecialchars($backup['name']) ?>">
213
 
214
  </a>
public/img/christmas-banner-btn.png ADDED
Binary file
public/img/christmas-bg.png ADDED
Binary file
public/img/christmas-button.png ADDED
Binary file
public/img/christmas-close.png ADDED
Binary file
public/img/christmas-logo.png ADDED
Binary file
public/img/christmas-text.png ADDED
Binary file
public/img/plugin-christmas-popup.png ADDED
Binary file
public/include/functions.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  function backupGuardShouldShowDiscountNotice()
4
  {
5
- if (SGConfig::get("SG_HIDE_DISCOUNT_NOTICE")) {
6
  return false;
7
  }
8
 
@@ -12,7 +12,7 @@ function backupGuardShouldShowDiscountNotice()
12
  function checkDueDateDiscount()
13
  {
14
  $startDate = '2019-11-27';
15
- $endDate = '2019-12-02';
16
 
17
  $timezone = 'Asia/Yerevan';
18
  $timeDate = new DateTime('now', new DateTimeZone($timezone));
@@ -224,7 +224,7 @@ function backupGuardShouldUpdate()
224
 
225
  if ($currentVersion !== $oldVersion) {
226
  SGConfig::set('SG_BACKUP_GUARD_VERSION', $currentVersion, true);
227
- SGConfig::set('SG_HIDE_DISCOUNT_NOTICE', '0', true);
228
  SGBoot::didUpdatePluginVersion();
229
  return SG_FORCE_DB_TABLES_RESET;
230
  }
2
 
3
  function backupGuardShouldShowDiscountNotice()
4
  {
5
+ if (SGConfig::get("SG_HIDE_CHRISTMAS_NOTICE")) {
6
  return false;
7
  }
8
 
12
  function checkDueDateDiscount()
13
  {
14
  $startDate = '2019-11-27';
15
+ $endDate = '2021-01-02';
16
 
17
  $timezone = 'Asia/Yerevan';
18
  $timeDate = new DateTime('now', new DateTimeZone($timezone));
224
 
225
  if ($currentVersion !== $oldVersion) {
226
  SGConfig::set('SG_BACKUP_GUARD_VERSION', $currentVersion, true);
227
+ SGConfig::set('SG_HIDE_CHRISTMAS_NOTICE', '0', true);
228
  SGBoot::didUpdatePluginVersion();
229
  return SG_FORCE_DB_TABLES_RESET;
230
  }
public/js/popup.js CHANGED
@@ -1492,27 +1492,41 @@ SGPopup.openSGPopup = function() {
1492
  }
1493
  };
1494
 
1495
- var hiddenDivId = 'sg-backup-review-wrapper';
1496
- var popupConfigObj = new PopupConfig();
1497
- popupConfigObj.magicCall('setContentPadding', 0);
1498
- popupConfigObj.magicCall('setContentBorderRadius', 4);
1499
- popupConfigObj.magicCall('setContentBorderRadiusType', 'px');
1500
- popupConfigObj.magicCall('setContentBorderWidth', 5);
1501
- popupConfigObj.magicCall('setContentBorderColor', '#506274');
1502
- popupConfigObj.magicCall('setShadowSpread', 1);
1503
- popupConfigObj.magicCall('setContentShadowBlur', 4);
1504
- popupConfigObj.magicCall('setContentShadowColor', '#cccccc');
1505
- popupConfigObj.magicCall('setMinWidth', 400);
1506
- popupConfigObj.magicCall('setSrcElement', hiddenDivId);
1507
- popupConfigObj.magicCall('setOverlayColor', 'black');
1508
- popupConfigObj.magicCall('setOverlayOpacity', 40);
1509
- var config = popupConfigObj.combineConfigObj();
1510
-
1511
  jQuery(document).ready(function() {
 
1512
  if (!jQuery('#'+hiddenDivId).length) {
1513
  return false;
1514
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1515
  var popup = new SGPopup(config);
1516
- window.backupGuardReviewPopup = popup;
1517
  popup.open();
 
 
 
 
 
 
 
 
 
 
 
1518
  });
1492
  }
1493
  };
1494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1495
  jQuery(document).ready(function() {
1496
+ var hiddenDivId = 'sg-christmas-popup-content-wrapper';
1497
  if (!jQuery('#'+hiddenDivId).length) {
1498
  return false;
1499
  }
1500
+
1501
+ var popupConfigObj = new PopupConfig();
1502
+ popupConfigObj.magicCall('setContentPadding', 0);
1503
+ popupConfigObj.magicCall('setContentBorderRadius', 4);
1504
+ popupConfigObj.magicCall('setContentBorderRadiusType', 'px');
1505
+ popupConfigObj.magicCall('setContentBorderWidth', 0);
1506
+ popupConfigObj.magicCall('setOverlayColor', 'white');
1507
+ popupConfigObj.magicCall('setContentBorderColor', '#506274');
1508
+ popupConfigObj.magicCall('setShadowSpread', 1);
1509
+ popupConfigObj.magicCall('setContentShadowBlur', 4);
1510
+ popupConfigObj.magicCall('setContentBackgroundColor', 'rgba(1,1,1,0)');
1511
+ popupConfigObj.magicCall('setContentShadowColor', '');
1512
+ popupConfigObj.magicCall('setMinWidth', 400);
1513
+ popupConfigObj.magicCall('setSrcElement', hiddenDivId);
1514
+ popupConfigObj.magicCall('setOverlayColor', 'black');
1515
+ popupConfigObj.magicCall('setOverlayOpacity', 40);
1516
+ var config = popupConfigObj.combineConfigObj();
1517
+
1518
  var popup = new SGPopup(config);
1519
+ window.backupGuardHalloweenPopup = popup;
1520
  popup.open();
1521
+
1522
+ jQuery('.sgbg-christmas-close-popup').bind('click', function () {
1523
+ window.backupGuardHalloweenPopup.close();
1524
+ jQuery('.backup-guard-discount-notice').remove();
1525
+ var sgNoticeClosedHandler = new sgRequestHandler('dismiss_discount_notice', {token: BG_BACKUP_STRINGS.nonce});
1526
+ sgNoticeClosedHandler.run();
1527
+ });
1528
+
1529
+ jQuery('#sg-halloween-popup-content-wrapper').bind('click', function () {
1530
+ window.open('https://backup-guard.com/products/backup-wordpress#pricing')
1531
+ });
1532
  });
public/js/sgbackup.js CHANGED
@@ -646,8 +646,24 @@ sgBackup.initManualBackupTooltips = function(){
646
  jQuery('a[data-toggle=tooltip]').tooltip();
647
  };
648
 
649
- sgBackup.startRestore = function(bname) {
 
 
650
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  jQuery('.alert').remove();
652
  var type = jQuery('input[type=radio][name=restoreType]:checked').val();
653
  var restoreFilesType = jQuery('input[type=radio][name=restoreFilesType]:checked').val() || "0";
646
  jQuery('a[data-toggle=tooltip]').tooltip();
647
  };
648
 
649
+ sgBackup.startRestore = function(bname)
650
+ {
651
+ var checkIsItMigration = new sgRequestHandler('checkFreeMigration',{bname: bname, token: BG_BACKUP_STRINGS.nonce});
652
 
653
+ checkIsItMigration.callback = function(response) {
654
+ if (response) {
655
+ jQuery('.modal-body.sg-modal-body').html(response);
656
+ return false;
657
+ }
658
+
659
+ sgBackup.startRestoreAction(bname);
660
+ };
661
+ checkIsItMigration.dataType = '';
662
+ checkIsItMigration.run();
663
+ };
664
+
665
+ sgBackup.startRestoreAction = function (bname)
666
+ {
667
  jQuery('.alert').remove();
668
  var type = jQuery('input[type=radio][name=restoreType]:checked').val();
669
  var restoreFilesType = jQuery('input[type=radio][name=restoreFilesType]:checked').val() || "0";