*/ 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:----TT/yILT8KQGMY/Bt4aG8+iQgSJP4FeiI0pysB7RjHI5s9OAUgP+cWFPwKDHxoP6MT7OIc7DQMmD8LnwLFZ2EvV65qvPhuHCf9boUS1X7KSNIUofRC2MiDDEUmVLeW52zjg4ANtYcvnj4NAJh2THClaBotOjLMUz0Cqc9m/IAJc9v5Uz/nMiGC+Vpmd+OpuIqhoCeJMg8OrRbF2tm03vdmP/QT/FXDoqsOXQK47Upn94vj2dtdbArSCciqrly3/cr/WvEeFWRk1cAfFsxsfnUkYTyZSM3/4/1plcOagDacCiv7D4aqqGsnv1eQf22qlQKuQBRzB35WMfVGfdoYNdvfKksONRYtduYjHuqGbNZmCtHu+4lN9unxOQ6j2A2pw3+rmZYIgozeKCb7642a+ZOpdx/ZAlGeKv7obwikQkMD0NPW4+vOrHMKaSqjOldiMrsbE/ikvDwnZBrXWiTj2j/1lzalZVUjngq6fZih3y11lHWm29vPG+Idb21TK8Aay9SW9/fWHvjce7YHpBdGDxjCT0rMeB/+TOdJ2eo97AQ72EtAARnqr7meyO1HFsSNDzZMTPl3drQef8AhJM3BqgruT870IRamXTr+cjxIjdpt4IJxB41kHNLJg2QVDTbsOMDqGkaKNFksDr/vyycrDs3XAZGctt8huBjNKU12Yf/DgI=----ATTACHMENT:----NjYwNzMxNDcyOTM2NzMxNCA0MzMwNjQxNDI4MjQ0OTQzIDk0MDkzMjY2OTkyNzg3NTc=