PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / trunk
JetBackup – Backup, Restore & Migrate vtrunk
3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 1.6.11 1.6.12 1.6.13 1.6.15 1.6.5.1 1.6.8.8 1.6.9 1.6.9.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7.5 2.0.8.7 2.0.9.11 2.0.9.14 2.0.9.15 2.0.9.6 2.0.9.7 2.0.9.9 3.1.10.7 3.1.11.1 3.1.12.3 3.1.13.4 3.1.14.17 3.1.15.4 3.1.16.1 3.1.17.5 3.1.18.10 3.1.18.8 3.1.18.9 3.1.19.8 3.1.20.3 3.1.21.3 3.1.7.9 3.1.9.2 trunk 1.1.90 1.1.91 1.2.0 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2
backup / src / JetBackup / Settings / Integrations.php
backup / src / JetBackup / Settings Last commit date
.htaccess 1 year ago Automation.php 10 months ago General.php 3 months ago Integrations.php 4 months ago Logging.php 4 months ago Maintenance.php 4 months ago Notifications.php 4 months ago Performance.php 3 months ago Restore.php 1 year ago Security.php 1 day ago Settings.php 4 months ago Updates.php 4 months ago index.html 1 year ago web.config 1 year ago
Integrations.php
75 lines
1 <?php
2
3 namespace JetBackup\Settings;
4
5 use JetBackup\Exception\AjaxException;
6 use JetBackup\Exception\DBException;
7 use SleekDB\Exceptions\InvalidArgumentException;
8 use SleekDB\Exceptions\IOException;
9
10 if (!defined( '__JETBACKUP__')) die('Direct access is not allowed');
11
12 class Integrations extends Settings {
13
14 const SECTION = 'integrations';
15 const ELEMENTOR = 'Elementor';
16 const SUPERCACHE = 'Supercache';
17 const WOOCOMMERCE = 'Woocommerce';
18 const AUTOPTIMIZE = 'Autoptimize';
19 const W3TOTALCACHE = 'W3TotalCache';
20
21 const INTEGRATIONS = 'integrations';
22 const INTEGRATION_DEFAULTS = [
23 self::ELEMENTOR,
24 self::SUPERCACHE,
25 self::WOOCOMMERCE,
26 self::W3TOTALCACHE,
27 self::AUTOPTIMIZE,
28 ];
29 /**
30 * @throws DBException
31 * @throws IOException
32 * @throws InvalidArgumentException
33 */
34 public function __construct() {
35 parent::__construct(self::SECTION);
36 }
37
38 public function getInegrations(): array {
39 return $this->get(self::INTEGRATIONS, self::INTEGRATION_DEFAULTS);
40 }
41
42 public function setIntegrations(array $values) : void {
43 $this->set(self::INTEGRATIONS, $values);
44 }
45 /**
46 * @return bool[]
47 */
48 public function getDisplay():array {
49 return [self::INTEGRATIONS => $this->getInegrations()];
50 }
51
52 /**
53 * @return bool[]
54 */
55 public function getDisplayCLI():array {
56 return [self::INTEGRATIONS => $this->getInegrations()];
57 }
58
59 /**
60 * @return void
61 * @throws AjaxException
62 */
63 public function validateFields():void {
64
65 $changedFields = self::getChangedFields($this->getData(), (new Integrations())->getData());
66
67 if(in_array(self::INTEGRATIONS, $changedFields)) {
68 $missing = array_diff($this->getInegrations(), self::INTEGRATION_DEFAULTS);
69
70 if (!empty($missing)) {
71 throw new AjaxException("The following integrations are not supported: " . implode(', ', $missing));
72 }
73 }
74 }
75 }