PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / trunk
JetBackup – Backup, Restore & Migrate vtrunk
3.1.23.6 3.1.23.5 3.1.23.3 3.1.22.4 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 / Queue / QueueItemRestore.php
backup / src / JetBackup / Queue Last commit date
.htaccess 1 year ago Progress.php 1 year ago Queue.php 7 months ago QueueItem.php 1 month ago QueueItemBackup.php 6 months ago QueueItemDownload.php 1 year ago QueueItemExport.php 1 year ago QueueItemExtract.php 1 year ago QueueItemReindex.php 1 year ago QueueItemRestore.php 6 days ago QueueItemRetentionCleanup.php 1 year ago QueueItemSystem.php 1 year ago aQueueItem.php 1 year ago index.html 1 year ago web.config 1 year ago
QueueItemRestore.php
99 lines
1 <?php
2
3 namespace JetBackup\Queue;
4
5 if (!defined('__JETBACKUP__')) die('Direct access is not allowed');
6
7 class QueueItemRestore extends aQueueItem {
8
9 const SNAPSHOT_ID = 'snapshot_id';
10 const SNAPSHOT_PATH = 'snapshot_path';
11 const QUEUE_GROUP_ID = 'queue_group_id';
12 const RESTORE_URL = 'restore_url';
13 const OPTIONS = 'options';
14 const EXCLUDE_DATABASE = 'exclude_database';
15 const INCLUDE_DATABASE = 'include_database';
16 const EXCLUDE = 'exclude';
17 const INCLUDE = 'include';
18 const ADMIN_USER = 'admin_user';
19 const INITIATOR_USER_ID = 'initiator_user_id';
20 const FILE_MANAGER = 'file_manager';
21
22 // General restore
23 const OPTION_RESTORE_DATABASE_ENTIRE = 1 << 0; // import full db dump, no includes/excludes
24 const OPTION_RESTORE_FILES_ENTIRE = 1 << 1; // restore full homedir path, no includes/excludes
25
26 // Multisite Restore Types
27 const OPTION_MULTISITE_ENTIRE_NETWORK = 1 << 2;
28 const OPTION_MULTISITE_SPECIFIC_SITE = 1 << 3;
29
30 // Restore Methods
31 const OPTION_MULTISITE_AS_DOMAIN = 1 << 4;
32 const OPTION_MULTISITE_STAND_ALONE = 1 << 5;
33
34 // Database Restore Options
35
36 const OPTION_RESTORE_DATABASE_EXCLUDE = 1 << 6; // restore tables, without excluded listed
37 const OPTION_RESTORE_DATABASE_SKIP = 1 << 7; // DO NOT restore database (skip the step)
38 const OPTION_RESTORE_DATABASE_INCLUDE = 1 << 8; // restore only selected db tables
39
40 // Files Restore Options
41 const OPTION_RESTORE_FILES_EXCLUDE = 1 << 9; // restore homedir, without excluded listed
42 const OPTION_RESTORE_FILES_SKIP = 1 << 10; // DO NOT restore database (skip the step)
43 const OPTION_RESTORE_FILES_INCLUDE = 1 << 11; // restore only selected files/folders
44
45 public function setSnapshotId(int $_id): void { $this->set(self::SNAPSHOT_ID, $_id); }
46 public function getSnapshotId(): int { return (int) $this->get(self::SNAPSHOT_ID, 0); }
47
48 public function setSnapshotPath(string $path): void { $this->set(self::SNAPSHOT_PATH, $path); }
49 public function getSnapshotPath(): string { return $this->get(self::SNAPSHOT_PATH); }
50
51 public function setQueueGroupId(string $id): void { $this->set(self::QUEUE_GROUP_ID, $id); }
52 public function getQueueGroupId(): string { return $this->get(self::QUEUE_GROUP_ID); }
53
54 public function setRestoreURL(string $url): void { $this->set(self::RESTORE_URL, $url); }
55 public function getRestoreURL(): string { return $this->get(self::RESTORE_URL); }
56
57 public function setOptions(int $options): void { $this->set(self::OPTIONS, $options); }
58 public function getOptions(): int { return $this->get(self::OPTIONS, 0); }
59
60 public function setExcludes(array $exclude): void { $this->set(self::EXCLUDE, $exclude); }
61 public function getExcludes(): array { return $this->get(self::EXCLUDE, []); }
62 public function setIncludes(array $include): void { $this->set(self::INCLUDE, $include); }
63 public function getIncludes(): array { return $this->get(self::INCLUDE, []); }
64
65 public function setAdminUser(string $user): void { $this->set(self::ADMIN_USER, $user); }
66 public function getAdminUser(): string { return $this->get(self::ADMIN_USER); }
67
68 // WP user id of whoever queued the restore (captured at queue time; 0 if unknown, e.g. CLI).
69 public function setInitiatorUserId(int $id): void { $this->set(self::INITIATOR_USER_ID, $id); }
70 public function getInitiatorUserId(): int { return (int) $this->get(self::INITIATOR_USER_ID, 0); }
71
72 public function setExcludedDatabases(array $exclude): void { $this->set(self::EXCLUDE_DATABASE, $exclude); }
73 public function getExcludedDatabases(): array { return $this->get(self::EXCLUDE_DATABASE, []); }
74
75 public function setIncludedDatabases(array $include): void { $this->set(self::INCLUDE_DATABASE, $include); }
76 public function getIncludedDatabases(): array { return $this->get(self::INCLUDE_DATABASE, []); }
77
78 public function setFileManager(array $files): void { $this->set(self::FILE_MANAGER, $files); }
79 public function getFileManager(): array { return $this->get(self::FILE_MANAGER, []); }
80
81 public function isOption(int $option): bool { return ($this->getOptions() & $option); }
82 public function isRestoreDatabase(): bool { return !$this->isOption(self::OPTION_RESTORE_DATABASE_SKIP); }
83 public function isRestoreHomedir(): bool { return !$this->isOption(self::OPTION_RESTORE_FILES_SKIP); }
84
85 public function getDisplay(): array {
86 return [
87 self::SNAPSHOT_ID => $this->getSnapshotId(),
88 self::SNAPSHOT_PATH => $this->getSnapshotPath(),
89 self::QUEUE_GROUP_ID => $this->getQueueGroupId(),
90 self::RESTORE_URL => $this->getRestoreURL(),
91 self::OPTIONS => $this->getOptions(),
92 self::EXCLUDE => $this->getExcludes(),
93 self::EXCLUDE_DATABASE => $this->getExcludedDatabases(),
94 self::INCLUDE_DATABASE => $this->getIncludedDatabases(),
95 self::FILE_MANAGER => $this->getFileManager(),
96 self::INITIATOR_USER_ID => $this->getInitiatorUserId(),
97 ];
98 }
99 }