PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.0
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.0
4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Backup / UpdateProtectionPausedNotice.php
wp-staging / Backup Last commit date
Ajax 1 day ago BackgroundProcessing 1 day ago Dto 1 day ago Entity 1 day ago Exceptions 1 day ago FileHeader 1 day ago Interfaces 1 day ago Job 1 day ago Request 1 day ago Service 1 day ago Storage 1 day ago Task 1 day ago Traits 1 day ago Utils 1 day ago AfterRestore.php 1 day ago BackupDeleter.php 1 day ago BackupDownload.php 1 day ago BackupFileIndex.php 1 day ago BackupGlitchReason.php 1 day ago BackupHeader.php 1 day ago BackupNextOffer.php 1 day ago BackupRepairer.php 1 day ago BackupRetentionHandler.php 1 day ago BackupScheduler.php 1 day ago BackupServiceProvider.php 1 day ago BackupValidator.php 1 day ago BeforeUpdateRowStatus.php 1 day ago FileHeader.php 1 day ago FileHeaderAttribute.php 1 day ago UpdateProtectionPausedNotice.php 1 day ago WithBackupIdentifier.php 1 day ago
UpdateProtectionPausedNotice.php
88 lines
1 <?php
2
3 namespace WPStaging\Backup;
4
5 use WPStaging\Backup\Service\UpdateProtectionHealth;
6 use WPStaging\Backup\Service\UpdateProtectionSettings;
7 use WPStaging\Framework\Security\Capabilities;
8 use WPStaging\Framework\Traits\PagesTrait;
9
10
11
12
13
14
15
16
17 class UpdateProtectionPausedNotice
18 {
19 use PagesTrait;
20
21
22 private $health;
23
24
25 private $settings;
26
27
28 private $capabilities;
29
30
31
32
33
34
35 public function __construct(UpdateProtectionHealth $health, UpdateProtectionSettings $settings, Capabilities $capabilities)
36 {
37 $this->health = $health;
38 $this->settings = $settings;
39 $this->capabilities = $capabilities;
40 }
41
42
43
44
45
46 public function render()
47 {
48 if (!$this->isWordPressUpdatePage() || !current_user_can($this->capabilities->manageWPSTG())) {
49 return;
50 }
51
52 if (!$this->settings->isEnabled() || !$this->health->isPaused()) {
53 return;
54 }
55
56 ?>
57 <div class="notice notice-warning wpstg-update-protection-paused">
58 <p>
59 <strong><?php esc_html_e('WP STAGING Update Protection is temporarily unavailable', 'wp-staging'); ?></strong><br>
60 <?php esc_html_e('A recovery backup couldn\'t be created. Plugin updates will continue normally until backup protection is available again.', 'wp-staging'); ?>
61 <?php echo $this->getReasonSentence(); // phpcs:ignore WPStaging.Security.EscapeOutput -- Both branches return an escaped string. ?>
62 </p>
63 <p>
64 <button type="button" class="button" data-wpstg-resume-update-protection>
65 <?php esc_html_e('Try protection again', 'wp-staging'); ?>
66 </button>
67 </p>
68 </div>
69 <?php
70 }
71
72
73
74
75 private function getReasonSentence(): string
76 {
77 if ($this->health->getReason() === UpdateProtectionHealth::REASON_DISK_SPACE) {
78 return esc_html__('There was not enough free disk space to create the backup.', 'wp-staging');
79 }
80
81 if ($this->health->getReason() === UpdateProtectionHealth::REASON_PERMISSIONS) {
82 return esc_html__('WP STAGING could not write to the backup directory.', 'wp-staging');
83 }
84
85 return '';
86 }
87 }
88