Inheritance: implements Countabl\Countable
Example #1
0
 public static function createForManifest(Manifest $manifest, string $pathToZip) : Zip
 {
     $zip = new static($pathToZip);
     $zip->open();
     foreach ($manifest->files() as $file) {
         $zip->add($file, self::determineNameOfFileInZip($file, $pathToZip));
     }
     $zip->close();
     return $zip;
 }
Example #2
0
 protected function createZipContainingEveryFileInManifest(Manifest $manifest)
 {
     consoleOutput()->info("Zipping {$manifest->count()} files...");
     $pathToZip = $this->temporaryDirectory->path(config('laravel-backup.backup.destination.filename_prefix') . Carbon::now()->format('Y-m-d-H-i-s') . '.zip');
     $zip = Zip::createForManifest($manifest, $pathToZip);
     consoleOutput()->info("Created zip containing {$zip->count()} files. Size is {$zip->humanReadableSize()}");
     event(new BackupZipWasCreated($pathToZip));
     return $pathToZip;
 }