1 | <?php |
||
23 | class Sftp extends Xtp |
||
24 | { |
||
25 | /** |
||
26 | * @var phpseclib\Net\SFTP |
||
27 | */ |
||
28 | protected $sftp; |
||
29 | |||
30 | /** |
||
31 | * Remote path where to put the backup |
||
32 | * |
||
33 | * @var Path |
||
34 | */ |
||
35 | protected $remotePath; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | protected $time; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $privateKey; |
||
46 | |||
47 | /** |
||
48 | * (non-PHPDoc) |
||
49 | * |
||
50 | * @see \phpbu\App\Backup\Sync::setup() |
||
51 | * @param array $config |
||
52 | * @throws \phpbu\App\Backup\Sync\Exception |
||
53 | * @throws \phpbu\App\Exception |
||
54 | */ |
||
55 | 12 | public function setup(array $config) |
|
76 | |||
77 | /** |
||
78 | * Check for required loaded libraries or extensions. |
||
79 | * |
||
80 | * @throws \phpbu\App\Backup\Sync\Exception |
||
81 | */ |
||
82 | 8 | protected function checkRequirements() |
|
88 | |||
89 | /** |
||
90 | * Return implemented (*)TP protocol name. |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 1 | protected function getProtocolName() |
|
98 | |||
99 | /** |
||
100 | * (non-PHPDoc) |
||
101 | * |
||
102 | * @see \phpbu\App\Backup\Sync::sync() |
||
103 | * @param \phpbu\App\Backup\Target $target |
||
104 | * @param \phpbu\App\Result $result |
||
105 | * @throws \phpbu\App\Backup\Sync\Exception |
||
106 | */ |
||
107 | 4 | public function sync(Target $target, Result $result) |
|
134 | |||
135 | /** |
||
136 | * Create a sftp handle. |
||
137 | * |
||
138 | * @return \phpseclib\Net\SFTP |
||
139 | * @throws \phpbu\App\Backup\Sync\Exception |
||
140 | */ |
||
141 | protected function createClient() : phpseclib\Net\SFTP |
||
166 | |||
167 | /** |
||
168 | * If a relative path is configured, determine absolute path and update local remote. |
||
169 | * |
||
170 | * @throws \phpbu\App\Backup\Sync\Exception |
||
171 | */ |
||
172 | 4 | protected function validateRemotePath() |
|
179 | |||
180 | /** |
||
181 | * Return a phpseclib authentication thingy. |
||
182 | * |
||
183 | * @return \phpseclib\Crypt\RSA|string |
||
184 | */ |
||
185 | private function getAuth() |
||
198 | |||
199 | /** |
||
200 | * Return list of remote directories to travers. |
||
201 | * |
||
202 | * @return array |
||
203 | */ |
||
204 | 4 | private function getRemoteDirectoryList() : array |
|
208 | |||
209 | /** |
||
210 | * Creates collector for SFTP |
||
211 | * |
||
212 | * @param \phpbu\App\Backup\Target $target |
||
213 | * @return \phpbu\App\Backup\Collector |
||
214 | * @throws \phpbu\App\Backup\Sync\Exception |
||
215 | */ |
||
216 | 1 | protected function createCollector(Target $target): Collector |
|
220 | } |
||
221 |