aws-issues.php
3 months ago
backupbliss.php
3 months ago
dropbox-issues-notice.php
3 months ago
google-drive-issues.php
3 months ago
wasabi-issues.php
3 months ago
aws-issues.php
74 lines
| 1 | <?php |
| 2 | |
| 3 | // Namespace |
| 4 | namespace BMI\Plugin\Dashboard; |
| 5 | |
| 6 | use BMI\Plugin\Backup_Migration_Plugin as BMP; |
| 7 | use BMI\Plugin\External\BMI_External_S3 as S3; |
| 8 | |
| 9 | // Exit on direct access |
| 10 | if (!defined('ABSPATH')) exit; |
| 11 | |
| 12 | require_once BMI_INCLUDES . '/external/s3.php'; |
| 13 | $s3 = new S3('aws'); |
| 14 | |
| 15 | $s3Issue = $s3->getIssue(); |
| 16 | $timeToRetry = $s3Issue['retryAfter']; |
| 17 | |
| 18 | |
| 19 | if (!$s3Issue['issue']) return; |
| 20 | |
| 21 | switch ($s3Issue['issue']) { |
| 22 | case 'disconnected': |
| 23 | if ($s3->verifyConnection()['result'] == 'connected') { |
| 24 | $s3->deleteIssue(); |
| 25 | return; |
| 26 | } |
| 27 | $message = sprintf( |
| 28 | __('Your authentication to Amazon AWS has expired or become invalid. Please re-authenticate to restore access. If the issue persists, check your credentials and token validity. You can also disable AWS as an external storage option by clicking %shere%s.', 'backup-backup'), |
| 29 | '<a href="javascript:document.getElementById(\'bmi-error-dismiss\').click();document.getElementById(\'bmi-pro-storage-aws-toggle\').checked=false;document.querySelector(\'#storage-options .save-btn\').click(); setTimeout(()=>{window.location.reload()}, 500);">', |
| 30 | '</a>' |
| 31 | ); |
| 32 | |
| 33 | break; |
| 34 | case 'rate_limit': |
| 35 | $message = sprintf( |
| 36 | __('Uploads to AWS S3 could not be completed due to rate limiting. The plugin will retry uploading automatically after 2 minutes.', 'backup-backup') |
| 37 | ); |
| 38 | |
| 39 | break; |
| 40 | case 'forbidden': |
| 41 | $message = sprintf( |
| 42 | __('The plugin has lost the required permissions to access Amazon AWS S3. This may be due to changes in your access policies. Please verify your IAM permissions and re-authenticate. The plugin will automatically retry in %s.', 'backup-backup'), |
| 43 | $timeToRetry |
| 44 | ); |
| 45 | |
| 46 | break; |
| 47 | default: |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | if (!isset($message) || $s3Issue['dismissed']) return; |
| 52 | ?> |
| 53 | |
| 54 | |
| 55 | <div class="error-noticer" id="aws-issues"> |
| 56 | <div class="error-header"> |
| 57 | <div class="cf"> |
| 58 | <div class="left"> |
| 59 | <?php esc_html_e('We have some errors regarding most recent backup upload process.', 'backup-backup'); ?> |
| 60 | </div> |
| 61 | <div class="right hoverable"> |
| 62 | <span class="bmi-error-toggle" data-expand="<?php esc_attr_e('Expand', 'backup-backup'); ?>" data-collapse="<?php esc_attr_e('Collapse', 'backup-backup'); ?>"> |
| 63 | <?php esc_html_e('Expand', 'backup-backup'); ?> |
| 64 | </span> | |
| 65 | <span id="bmi-error-dismiss"> |
| 66 | <?php esc_html_e('Dismiss', 'backup-backup'); ?> |
| 67 | </span> |
| 68 | </div> |
| 69 | </div> |
| 70 | </div> |
| 71 | <div class="error-body"> |
| 72 | <?php echo wp_kses_post( $message ); ?> |
| 73 | </div> |
| 74 | </div> |