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 / Destination / DestinationWrapper.php
backup / src / JetBackup / Destination Last commit date
Integration 1 year ago Vendors 2 months ago .htaccess 1 year ago Destination.php 2 months ago DestinationDiskUsage.php 1 year ago DestinationFile.php 1 year ago DestinationWrapper.php 1 year ago ScanDirIterator.php 1 year ago ScanDirIteratorFile.php 9 months ago Tree.php 1 year ago index.html 1 year ago web.config 1 year ago
DestinationWrapper.php
94 lines
1 <?php
2
3 namespace JetBackup\Destination;
4
5 use JetBackup\Data\ArrayData;
6 use JetBackup\Exception\DBException;
7 use JetBackup\Log\LogController;
8 use SleekDB\Exceptions\InvalidArgumentException;
9 use SleekDB\Exceptions\IOException;
10
11 if (!defined( '__JETBACKUP__')) die('Direct access is not allowed');
12
13 abstract class DestinationWrapper implements \JetBackup\Destination\Integration\Destination {
14
15 private ?string $_destination_name;
16 private int $_destination_id;
17 private LogController $_log_controller;
18 private ArrayData $_options;
19 private int $_chunk_size;
20 private string $_path;
21
22 public function __construct(int $chunk_size, string $path, ?LogController $logController=null, ?string $name=null, int $id=0) {
23 $this->_destination_name = $name;
24 $this->_destination_id = $id;
25 $this->_log_controller = $logController ?: new LogController();
26 $this->_options = new ArrayData();
27 $this->_chunk_size = $chunk_size;
28 $this->_path = $path;
29 }
30
31 /**
32 * @return string
33 */
34 public function getName():string { return $this->_destination_name; }
35
36 /**
37 * @return int
38 */
39 public function getId():int { return $this->_destination_id; }
40
41 /**
42 * @return string
43 */
44 public function getPath():string { return preg_replace("#/+#", '/', $this->_path); }
45
46 /**
47 * @param string $path
48 *
49 * @return string
50 */
51 public function getRealPath(string $path): string { return preg_replace("#/+#", '/', $this->getPath() . '/' . $path); }
52
53 /**
54 * @param string $path
55 *
56 * @return string
57 */
58 public function removeRealPath(string $path):string { return preg_replace("#^" . preg_quote($this->getPath()) . "#", "", $path); }
59
60 /**
61 * @return LogController
62 */
63 public function getLogController():LogController { return $this->_log_controller; }
64
65 /**
66 * @return int
67 */
68 public function getChunkSize():int { return $this->_chunk_size; }
69
70 /**
71 * @return ArrayData
72 */
73 public function getOptions():ArrayData { return $this->_options; }
74
75 public function setSerializedData( string $data ) {
76 $this->setData((object) json_decode($data));
77 }
78
79 public function getSerializedData(): string {
80 return json_encode($this->getData());
81 }
82
83 /**
84 * @throws InvalidArgumentException
85 * @throws IOException
86 * @throws DBException
87 */
88 public function save():void {
89 if(!$this->getId()) return;
90 $destination = new Destination($this->getId());
91 if(!$destination->getId()) return;
92 $destination->updateSerializedData($this->getSerializedData());
93 }
94 }