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) |
|
78 | |||
79 | /** |
||
80 | * Check for required loaded libraries or extensions. |
||
81 | * |
||
82 | * @throws \phpbu\App\Backup\Sync\Exception |
||
83 | */ |
||
84 | 8 | protected function checkRequirements() |
|
90 | |||
91 | /** |
||
92 | * Return implemented (*)TP protocol name. |
||
93 | * |
||
94 | * @return string |
||
95 | */ |
||
96 | 1 | protected function getProtocolName() |
|
100 | |||
101 | /** |
||
102 | * (non-PHPDoc) |
||
103 | * |
||
104 | * @see \phpbu\App\Backup\Sync::sync() |
||
105 | * @param \phpbu\App\Backup\Target $target |
||
106 | * @param \phpbu\App\Result $result |
||
107 | * @throws \phpbu\App\Backup\Sync\Exception |
||
108 | */ |
||
109 | 4 | public function sync(Target $target, Result $result) |
|
136 | |||
137 | /** |
||
138 | * Create a sftp handle. |
||
139 | * |
||
140 | * @return \phpseclib\Net\SFTP |
||
141 | * @throws \phpbu\App\Backup\Sync\Exception |
||
142 | */ |
||
143 | protected function createClient() : phpseclib\Net\SFTP |
||
168 | |||
169 | /** |
||
170 | * If a relative path is configured, determine absolute path and update local remote. |
||
171 | * |
||
172 | * @throws \phpbu\App\Backup\Sync\Exception |
||
173 | */ |
||
174 | 4 | protected function validateRemotePath() |
|
181 | |||
182 | /** |
||
183 | * Return a phpseclib authentication thingy. |
||
184 | * |
||
185 | * @return \phpseclib\Crypt\RSA|string |
||
186 | */ |
||
187 | private function getAuth() |
||
200 | |||
201 | /** |
||
202 | * Return list of remote directories to travers. |
||
203 | * |
||
204 | * @return array |
||
205 | */ |
||
206 | 4 | private function getRemoteDirectoryList() : array |
|
210 | |||
211 | /** |
||
212 | * Creates collector for SFTP |
||
213 | * |
||
214 | * @param \phpbu\App\Backup\Target $target |
||
215 | * @return \phpbu\App\Backup\Collector |
||
216 | * @throws \phpbu\App\Backup\Sync\Exception |
||
217 | */ |
||
218 | 1 | protected function createCollector(Target $target): Collector |
|
222 | } |
||
223 |