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 / Queue / QueueItemRestore.php
backup / src / JetBackup / Queue Last commit date
.htaccess 1 year ago Progress.php 1 year ago Queue.php 5 months ago QueueItem.php 1 day ago QueueItemBackup.php 5 months ago QueueItemDownload.php 1 year ago QueueItemExport.php 1 year ago QueueItemExtract.php 1 year ago QueueItemReindex.php 1 year ago QueueItemRestore.php 1 year 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
93 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 FILE_MANAGER = 'file_manager';
20
21 // General restore
22 const OPTION_RESTORE_DATABASE_ENTIRE = 1 << 0; // import full db dump, no includes/excludes
23 const OPTION_RESTORE_FILES_ENTIRE = 1 << 1; // restore full homedir path, no includes/excludes
24
25 // Multisite Restore Types
26 const OPTION_MULTISITE_ENTIRE_NETWORK = 1 << 2;
27 const OPTION_MULTISITE_SPECIFIC_SITE = 1 << 3;
28
29 // Restore Methods
30 const OPTION_MULTISITE_AS_DOMAIN = 1 << 4;
31 const OPTION_MULTISITE_STAND_ALONE = 1 << 5;
32
33 // Database Restore Options
34
35 const OPTION_RESTORE_DATABASE_EXCLUDE = 1 << 6; // restore tables, without excluded listed
36 const OPTION_RESTORE_DATABASE_SKIP = 1 << 7; // DO NOT restore database (skip the step)
37 const OPTION_RESTORE_DATABASE_INCLUDE = 1 << 8; // restore only selected db tables
38
39 // Files Restore Options
40 const OPTION_RESTORE_FILES_EXCLUDE = 1 << 9; // restore homedir, without excluded listed
41 const OPTION_RESTORE_FILES_SKIP = 1 << 10; // DO NOT restore database (skip the step)
42 const OPTION_RESTORE_FILES_INCLUDE = 1 << 11; // restore only selected files/folders
43
44 public function setSnapshotId(int $_id): void { $this->set(self::SNAPSHOT_ID, $_id); }
45 public function getSnapshotId(): int { return (int) $this->get(self::SNAPSHOT_ID, 0); }
46
47 public function setSnapshotPath(string $path): void { $this->set(self::SNAPSHOT_PATH, $path); }
48 public function getSnapshotPath(): string { return $this->get(self::SNAPSHOT_PATH); }
49
50 public function setQueueGroupId(string $id): void { $this->set(self::QUEUE_GROUP_ID, $id); }
51 public function getQueueGroupId(): string { return $this->get(self::QUEUE_GROUP_ID); }
52
53 public function setRestoreURL(string $url): void { $this->set(self::RESTORE_URL, $url); }
54 public function getRestoreURL(): string { return $this->get(self::RESTORE_URL); }
55
56 public function setOptions(int $options): void { $this->set(self::OPTIONS, $options); }
57 public function getOptions(): int { return $this->get(self::OPTIONS, 0); }
58
59 public function setExcludes(array $exclude): void { $this->set(self::EXCLUDE, $exclude); }
60 public function getExcludes(): array { return $this->get(self::EXCLUDE, []); }
61 public function setIncludes(array $include): void { $this->set(self::INCLUDE, $include); }
62 public function getIncludes(): array { return $this->get(self::INCLUDE, []); }
63
64 public function setAdminUser(string $user): void { $this->set(self::ADMIN_USER, $user); }
65 public function getAdminUser(): string { return $this->get(self::ADMIN_USER); }
66
67 public function setExcludedDatabases(array $exclude): void { $this->set(self::EXCLUDE_DATABASE, $exclude); }
68 public function getExcludedDatabases(): array { return $this->get(self::EXCLUDE_DATABASE, []); }
69
70 public function setIncludedDatabases(array $include): void { $this->set(self::INCLUDE_DATABASE, $include); }
71 public function getIncludedDatabases(): array { return $this->get(self::INCLUDE_DATABASE, []); }
72
73 public function setFileManager(array $files): void { $this->set(self::FILE_MANAGER, $files); }
74 public function getFileManager(): array { return $this->get(self::FILE_MANAGER, []); }
75
76 public function isOption(int $option): bool { return ($this->getOptions() & $option); }
77 public function isRestoreDatabase(): bool { return !$this->isOption(self::OPTION_RESTORE_DATABASE_SKIP); }
78 public function isRestoreHomedir(): bool { return !$this->isOption(self::OPTION_RESTORE_FILES_SKIP); }
79
80 public function getDisplay(): array {
81 return [
82 self::SNAPSHOT_ID => $this->getSnapshotId(),
83 self::SNAPSHOT_PATH => $this->getSnapshotPath(),
84 self::QUEUE_GROUP_ID => $this->getQueueGroupId(),
85 self::RESTORE_URL => $this->getRestoreURL(),
86 self::OPTIONS => $this->getOptions(),
87 self::EXCLUDE => $this->getExcludes(),
88 self::EXCLUDE_DATABASE => $this->getExcludedDatabases(),
89 self::INCLUDE_DATABASE => $this->getIncludedDatabases(),
90 self::FILE_MANAGER => $this->getFileManager(),
91 ];
92 }
93 }