BackupGuard
5 years ago
Dropbox
5 years ago
Request
5 years ago
SGArchive.php
5 years ago
SGAuthClient.php
5 years ago
SGCallback.php
5 years ago
SGCdrEntry.php
9 years ago
SGCharsetHandler.php
7 years ago
SGDBState.php
8 years ago
SGEntry.php
9 years ago
SGFileEntry.php
5 years ago
SGFileState.php
5 years ago
SGMigrateState.php
8 years ago
SGMysqldump.php
5 years ago
SGReloadHandler.php
5 years ago
SGReloader.php
5 years ago
SGReloaderState.php
9 years ago
SGReviewManager.php
6 years ago
SGState.php
5 years ago
SGStatsRequests.php
5 years ago
SGUploadHandler.php
5 years ago
SGUploadState.php
5 years ago
SGUploadHandler.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | namespace BackupGuard\Upload; |
| 4 | |
| 5 | require_once(SG_LIB_PATH . 'SGArchive.php'); |
| 6 | |
| 7 | use SGArchive; |
| 8 | |
| 9 | class Handler |
| 10 | { |
| 11 | private $data = null; |
| 12 | private $fileName = ""; |
| 13 | private $tmpFileName = ""; |
| 14 | |
| 15 | public function __construct($data) |
| 16 | { |
| 17 | $this->data = $data; |
| 18 | $this->import(); |
| 19 | } |
| 20 | |
| 21 | private function import() |
| 22 | { |
| 23 | $this->fileName = $this->data['files']['name'][0]; |
| 24 | $this->tmpFileName = $this->data['files']['tmp_name'][0]; |
| 25 | |
| 26 | if (substr($this->fileName, -5) != '.sgbp') { |
| 27 | $this->fileName .= '.sgbp'; |
| 28 | } |
| 29 | |
| 30 | $dirPath = $this->getDestinationDirPath(); |
| 31 | $file = $dirPath . $this->fileName; |
| 32 | |
| 33 | $data = file_get_contents($this->tmpFileName); |
| 34 | file_put_contents($file, $data, FILE_APPEND); |
| 35 | } |
| 36 | |
| 37 | private function getDestinationDirPath() |
| 38 | { |
| 39 | return SG_BACKUP_DIRECTORY; |
| 40 | } |
| 41 | |
| 42 | private function getDestinationDirUrl() |
| 43 | { |
| 44 | return SG_BACKUP_DIRECTORY_URL; |
| 45 | } |
| 46 | } |
| 47 |