| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | private function downloadFiles(DedicatedServer $dedicatedServer, $path): string |
||
| 35 | { |
||
| 36 | $this->gdaemonFiles->setConfig($dedicatedServer->gdaemonSettings()); |
||
| 37 | |||
| 38 | $tmpDir = OsHelper::makeTempDirectory(); |
||
| 39 | |||
| 40 | $zipFilePath = OsHelper::tempFile(); |
||
| 41 | $zip = new ZipArchive(); |
||
| 42 | $zip->open($zipFilePath, ZipArchive::CREATE); |
||
| 43 | |||
| 44 | foreach ($this->gdaemonFiles->listFiles($path) as $fileName) { |
||
| 45 | $fullPath = $path . '/' . $fileName; |
||
| 46 | $destination = $tmpDir . '/' . $fileName; |
||
| 47 | |||
| 48 | $this->gdaemonFiles->get($fullPath, $destination); |
||
| 49 | |||
| 50 | $zip->addFile($destination, "daemon_logs/". $fileName); |
||
| 51 | } |
||
| 52 | |||
| 53 | $zip->close(); |
||
| 54 | |||
| 55 | return $zipFilePath; |
||
| 56 | } |
||
| 58 |