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 / JetBackupLinux / QueueItem.php
backup / src / JetBackup / JetBackupLinux Last commit date
.htaccess 1 year ago JetBackupLinux.php 1 month ago JetBackupLinuxObject.php 1 year ago Query.php 1 year ago QueueItem.php 1 year ago index.html 1 year ago web.config 1 year ago
QueueItem.php
178 lines
1 <?php
2 /*
3 *
4 * JetBackup @ package
5 * Created By Idan Ben-Ezra
6 *
7 * Copyrights @ JetApps
8 * https://www.jetapps.com
9 *
10 **/
11 namespace JetBackup\JetBackupLinux;
12
13 use JetBackup\Exception\JetBackupLinuxException;
14
15 defined( '__JETBACKUP__' ) or die( 'Restricted access' );
16
17 class QueueItem extends JetBackupLinuxObject {
18
19 const ITEM_NAME = 'QueueItem';
20
21 const OWNER = 'owner';
22 const OWNER_NAME = 'owner_name';
23 const CREATED = 'created';
24 const LOG_FILE = 'file';
25 const STARTED = 'started';
26 const ENDED = 'ended';
27 const TYPE = 'type';
28 const GROUP_ID = 'group_id';
29 const PROGRESS_ID = 'progress_id';
30 const PROGRESS = 'progress';
31 const PRIORITY = 'priority';
32 const RETRIED = 'retried';
33 const STATUS = 'status';
34 const MESSAGE = 'message';
35 const DATA = 'data';
36 const EXECUTION_TIME = 'execution_time';
37
38 const TYPE_BACKUP = 1<<0;
39 const TYPE_RESTORE = 1<<1;
40 const TYPE_DOWNLOAD = 1<<2;
41 const TYPE_REINDEX = 1<<3;
42 const TYPE_CLONE = 1<<4;
43 const TYPE_SECURITY = 1<<5;
44 const TYPE_INTEGRITY_CHECK = 1<<6;
45 const TYPE_SNAPSHOT_DELETE = 1<<7;
46
47 const TYPES_ALL =
48 self::TYPE_BACKUP |
49 self::TYPE_RESTORE |
50 self::TYPE_DOWNLOAD |
51 self::TYPE_REINDEX |
52 self::TYPE_CLONE |
53 self::TYPE_SECURITY |
54 self::TYPE_INTEGRITY_CHECK |
55 self::TYPE_SNAPSHOT_DELETE;
56
57 public function __construct(?string $_id=null) {
58 parent::__construct(self::ITEM_NAME);
59 if($_id) $this->load($_id);
60 }
61
62 /**
63 * @return Query
64 * @throws JetBackupLinuxException
65 */
66 public static function query():Query {
67 return Query::api('listQueueItems');
68 }
69
70 /**
71 * @return string
72 */
73 public function getLogFile():string { return $this->get(self::LOG_FILE); }
74
75 /**
76 * @return string
77 */
78 public function getGroupId():string { return $this->get(self::GROUP_ID); }
79
80 /**
81 * @return string
82 */
83 public function getProgressId():string { return $this->get(self::PROGRESS_ID); }
84
85 /**
86 * @return array
87 */
88 public function getProgress():array { return $this->get(self::PROGRESS, []); }
89
90 /**
91 * @return string
92 */
93 public function getOwner():string { return $this->get(self::OWNER); }
94
95 /**
96 * @return string
97 */
98 public function getExecutionTime():string { return $this->get(self::EXECUTION_TIME); }
99
100 /**
101 * @return string
102 */
103 public function getOwnerName():string { return $this->get(self::OWNER_NAME); }
104
105 /**
106 * @return int
107 */
108 public function getPriority():int { return $this->get(self::PRIORITY, 0); }
109
110 /**
111 * @return int
112 */
113 public function getActionType():int { return $this->get(self::TYPE, 0); }
114
115 /**
116 * @return bool
117 */
118 public function isRetried():bool { return !!$this->get(self::RETRIED, false); }
119
120 /**
121 * @return int
122 */
123 public function getStatus():int { return $this->get(self::STATUS, 0); }
124
125 /**
126 * @return string
127 */
128 public function getMessage():string { return $this->get(self::MESSAGE); }
129
130 /**
131 * @return int
132 */
133 public function getCreated():int { return $this->get(self::CREATED, 0); }
134
135 /**
136 * @return int
137 */
138 public function getStarted():int { return $this->get(self::STARTED, 0); }
139
140 /**
141 * @return int
142 */
143 public function getEnded():int { return $this->get(self::ENDED, 0); }
144
145 /**
146 * @return string
147 */
148 public function getItemData():string { return $this->get(self::DATA); }
149
150 // don't do anything, this API call isn't supporting modify, create and delete
151 public function save():void {}
152 public function delete():void {}
153
154 /**
155 * @return array
156 */
157 public function getDisplay():array {
158
159 return [
160 self::ID_FIELD => $this->getId(),
161 self::OWNER => $this->getOwner(),
162 self::OWNER_NAME => $this->getOwnerName(),
163 self::CREATED => $this->getCreated(),
164 self::STARTED => $this->getStarted(),
165 self::ENDED => $this->getEnded(),
166 self::EXECUTION_TIME=> $this->getExecutionTime(),
167 self::TYPE => $this->getActionType(),
168 self::GROUP_ID => $this->getGroupId(),
169 self::PRIORITY => $this->getPriority(),
170 self::STATUS => $this->getStatus(),
171 self::MESSAGE => $this->getMessage(),
172 self::PROGRESS_ID => $this->getProgressId(),
173 self::PROGRESS => $this->getProgress(),
174 self::LOG_FILE => $this->getLogFile(),
175 self::DATA => $this->getItemData(),
176 ];
177 }
178 }