.htaccess
9 months ago
ChunkedDownload.php
9 months ago
ChunkedUpload.php
9 months ago
DirIterator.php
9 months ago
FTP.php
9 months ago
FTPClient.php
9 months ago
index.html
9 months ago
web.config
9 months ago
ChunkedUpload.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | namespace JetBackup\Destination\Vendors\FTP; |
| 4 | |
| 5 | use JetBackup\Destination\Integration\DestinationChunkedUpload; |
| 6 | use JetBackup\Exception\IOException; |
| 7 | use JetBackup\Web\File\FileChunk; |
| 8 | |
| 9 | if (!defined( '__JETBACKUP__')) die('Direct access is not allowed'); |
| 10 | |
| 11 | class ChunkedUpload implements DestinationChunkedUpload { |
| 12 | |
| 13 | private FTP $_client; |
| 14 | private string $_destination; |
| 15 | |
| 16 | public function __construct(FTP $client, $destination) { |
| 17 | $this->_client = $client; |
| 18 | $this->_destination = $destination; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * @return object |
| 23 | */ |
| 24 | public function prepare():object { return new \stdClass(); } |
| 25 | public function setData(object $data):void {} |
| 26 | |
| 27 | /** |
| 28 | * @return int |
| 29 | * @throws IOException |
| 30 | */ |
| 31 | public function getOffset():int { |
| 32 | return $this->_client->_client('getFileSize', $this->_destination); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * @return int|null |
| 37 | */ |
| 38 | public function getChunkSize():?int { return null; } |
| 39 | |
| 40 | /** |
| 41 | * @param FileChunk $chunk |
| 42 | * |
| 43 | * @return void |
| 44 | * @throws IOException |
| 45 | */ |
| 46 | public function upload(FileChunk $chunk):void { |
| 47 | $this->_client->_client('uploadChunk', $chunk, $this->_destination); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @return void |
| 52 | */ |
| 53 | public function finalize():void {} |
| 54 | } |