| @@ 50-58 (lines=9) @@ | ||
| 47 | /** |
|
| 48 | * @inheritdoc |
|
| 49 | */ |
|
| 50 | public function fetchFrom($remoteFile, $localFile) |
|
| 51 | { |
|
| 52 | $sftp = "ssh2.sftp://$this->sftp"; |
|
| 53 | $data = file_get_contents($sftp . $remoteFile); |
|
| 54 | if (!$data) { |
|
| 55 | throw new \Exception('File can`t be loaded from server'); |
|
| 56 | } |
|
| 57 | file_put_contents($localFile, $data); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * @inheritdoc |
|
| @@ 63-70 (lines=8) @@ | ||
| 60 | /** |
|
| 61 | * @inheritdoc |
|
| 62 | */ |
|
| 63 | public function sendTo($localFile, $remoteFile) |
|
| 64 | { |
|
| 65 | $sftp = "ssh2.sftp://$this->sftp"; |
|
| 66 | $data = file_get_contents($localFile); |
|
| 67 | if (!file_put_contents($sftp . $remoteFile, $data)) { |
|
| 68 | throw new \Exception('File could not be uploaded to server'); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * @inheritdoc |
|