PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / 3.1.18.8
JetBackup – Backup, Restore & Migrate v3.1.18.8
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 / Progress.php
backup / src / JetBackup / Queue Last commit date
.htaccess 5 months ago Progress.php 5 months ago Queue.php 5 months ago QueueItem.php 5 months ago QueueItemBackup.php 5 months ago QueueItemDownload.php 5 months ago QueueItemExport.php 5 months ago QueueItemExtract.php 5 months ago QueueItemReindex.php 5 months ago QueueItemRestore.php 5 months ago QueueItemRetentionCleanup.php 5 months ago QueueItemSystem.php 5 months ago aQueueItem.php 5 months ago index.html 5 months ago web.config 5 months ago
Progress.php
67 lines
1 <?php
2
3 namespace JetBackup\Queue;
4
5 use JetBackup\Data\ArrayData;
6
7 if (!defined( '__JETBACKUP__')) die('Direct access is not allowed');
8
9 class Progress extends ArrayData {
10
11 const MESSAGE = 'message';
12 const TOTAL_ITEMS = 'total_items';
13 const CURRENT_ITEM = 'current_item';
14 const SUB_MESSAGE = 'sub_message';
15 const TOTAL_SUB_ITEMS = 'total_sub_items';
16 const CURRENT_SUB_ITEM = 'current_sub_item';
17 const PERCENTAGE = 'percentage';
18 const SUB_PERCENTAGE = 'sub_percentage';
19
20 public function __construct(array $data=[]) {
21 $this->setData($data);
22 }
23
24 public function setMessage(string $message):void { $this->set(self::MESSAGE, $message); }
25 public function getMessage():string { return $this->get(self::MESSAGE); }
26
27 public function setTotalItems(int $items):void { $this->set(self::TOTAL_ITEMS, $items); }
28 public function getTotalItems():int { return $this->get(self::TOTAL_ITEMS, 1); }
29
30 public function setCurrentItem(int $current):void { $this->set(self::CURRENT_ITEM, $current); }
31 public function getCurrentItem():int { return $this->get(self::CURRENT_ITEM, 0); }
32
33 public function setSubMessage(string $message):void { $this->set(self::SUB_MESSAGE, $message); }
34 public function getSubMessage():string { return $this->get(self::SUB_MESSAGE); }
35
36 public function setTotalSubItems(int $items):void { $this->set(self::TOTAL_SUB_ITEMS, $items); }
37 public function getTotalSubItems():int { return $this->get(self::TOTAL_SUB_ITEMS, 0); }
38
39 public function setCurrentSubItem(int $current):void { $this->set(self::CURRENT_SUB_ITEM, $current); }
40 public function getCurrentSubItem():int { return $this->get(self::CURRENT_SUB_ITEM, 0); }
41
42 public function increaseCurrentItem():void { $this->setCurrentItem($this->getCurrentItem() + 1); }
43 public function increaseCurrentSubItem():void { $this->setCurrentSubItem($this->getCurrentSubItem() + 1); }
44
45 public function getPercentage():int { return $this->getTotalItems() > 0 ? min(100, floor(($this->getCurrentItem() / $this->getTotalItems()) * 100)) : 0; }
46 public function getSubPercentage():int { return $this->getTotalSubItems() > 0 ? min(100, floor(($this->getCurrentSubItem() / $this->getTotalSubItems()) * 100)) : 0; }
47
48 public function resetSub() {
49 $this->setSubMessage('');
50 $this->setTotalSubItems(0);
51 $this->setCurrentSubItem(0);
52 }
53
54 public function getDisplay() {
55 return [
56 self::MESSAGE => $this->getMessage(),
57 self::TOTAL_ITEMS => $this->getTotalItems(),
58 self::CURRENT_ITEM => $this->getCurrentItem(),
59 self::PERCENTAGE => $this->getPercentage(),
60 self::SUB_MESSAGE => $this->getSubMessage(),
61 self::TOTAL_SUB_ITEMS => $this->getTotalSubItems(),
62 self::CURRENT_SUB_ITEM => $this->getCurrentSubItem(),
63 self::SUB_PERCENTAGE => $this->getSubPercentage(),
64 ];
65 }
66 }
67