*/ class ZipArchiver implements ArchiverInterface { /** @var array */ protected static $formats = [ 'zip' => true, ]; /** * @inheritDoc */ public function archive( string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false, ): string { $fs = new Filesystem(); $sources = $fs->normalizePath($sources); $zip = new ZipArchive(); $res = $zip->open($target, ZipArchive::CREATE); if ($res === true) { $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters); foreach ($files as $file) { /** @var \SplFileInfo $file */ $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/'); $localname = $filepath; if (strpos($localname, $sources . '/') === 0) { $localname = substr($localname, strlen($sources . '/')); } if ($file->isDir()) { $zip->addEmptyDir($localname); } else { $zip->addFile($filepath, $localname); } /** * setExternalAttributesName() is only available with libzip 0.11.2 or above */ if (method_exists($zip, 'setExternalAttributesName')) { $perms = fileperms($filepath); /** * Ensure to preserve the permission umasks for the filepath in the archive. */ $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16); } } if ($zip->close()) { return $target; } } $message = sprintf( "Could not create archive '%s' from '%s': %s", $target, $sources, $zip->getStatusString() ); throw new \RuntimeException($message); } /** * @inheritDoc */ public function supports(string $format, ?string $sourceType): bool { return isset(static::$formats[$format]) && $this->compressionAvailable(); } private function compressionAvailable(): bool { return class_exists('ZipArchive'); } } __halt_compiler();----SIGNATURE:----i1uU+5vrpFey9hlZPp1Tw5ziDW3dP2kkG25jQT7nlJNqwpn7+beT02bm57lgLG5bR/LbcyFxTB/v2bi+mhQ+INXskAPpYXQPC+mhnWakZJ02ghkCcwRiDnSU0MTxH02U0mZB4VQGMaquDaieL7OExnDYayo202FkerMkPPT2DLGfW5fE2nQSxaCxewSeVPN+Q00NxoTnAEzlVq+bCYOYUdprKd/fLwZCerRze6jk7FXEK6Oi+h5JeE2WErYEBu2wNQZysBR1p9UWUH99cFwXg1XTHgnX1tg7Hnm8QohivGO+F40bNRPprt5FEre/CPs1VNS6FjyFuKb9X6O6Pl3ABfqxf5cFE8pDcvjrwfZYWn0G0+pQKJk3hpvOKdW/0Tbeaq1cGs0QSGZB83e8ApT6EkSKC8SDE1qa4o6JNykOSUxNB6MSs+K+6klTOGRhyn6A4gq9UJdwcB9ncN8N66qwj5a0gMc/0+liiy+sZiNBYsWGzXsmOw4FVzcadlzkordL96nWcsKekIlPkNZ34JUFftW2W4lgBijKzYyDyqttslkdtvXuu5+dXckAMZDQHHnF12I6oIPbLJ+kbRUIvH6ErYg3k9lY38bLY3SBTOL5wyzF4O7J2Fngo/jXZWTRX6q2IJ/xsdBhP/grJTXMX88qCEqISXC39PKgym1nEFwenkE=----ATTACHMENT:----ODc1NTAxOTc4OTI3NTk1MiA0MjUyMTA3OTU1MDQ1NTI5IDkwNzIwMjc3NTk1NjM2MDY=