*/ 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:----Yk2A2gYw3N9kJOp1g9Z35+Dvpzk84YYIXFlB0OFIluY9jsIPY/7bCnqaQ/dEqD8p9Ol8ESHnFs1ZRvlXXYpi+j17Ge54kmm5LrBGtFVDLOvsmWCdK4WbWODpt/q4mMpalpDg8Y83DGSUQNBLxxHYdtuBM6zyya1cg2CpbVmWcTFHplZ6CpDt0MjDpR+wNwbrkN9W+1r6W+BkXMSnt/cWcydXw/NFhljkldn3xCHnVuHZQfDKX6cYTv2wbOvb3szrKUDKcBsyiAU/NNIEq8wdlCngdJz3Ib9VjuK4zhjAfYO1pdf7DhKuemD/Lk3nn7zlAH7w+RoJmlPQMYDfSrQbFPYQj1JZkyJuL4+whDbpVHb2+NbXQo+fN/5KIGmLV73v7xSyeO0vguXT3ztNf/5N0H0yV9UaGhrZZCGQ0t6YQ+m5CdDQJIf0VwNxH3aRHApavcKrnVQvEtj3IrLtHJQ5eF4eZ5Yhl+VX3A/zgPg9LqZ15TDHUuwxEOYGAnqxVEXfA1bEJCIkR4lJvzs4UOVAOxKv/vShBtO1rMdgH5cwj5MqGJxkIEPfZpoj1cCa4/HHkTMIeCFRI2W3eOVc4F7W5uoNecjef7IBUu7oI1DmcidS0I26rNu6P8GTllcUZFBoqdENqRJoSTQyW/Ee8niaA+uGw0y6Az8hHQDfb3MMWBM=----ATTACHMENT:----NzY2MDk5ODA4NTU3MTE4NyAzODE4ODIxNzI5NzI0NSA1NjM4MTYxNDA3ODUxMzgz