Skip to content

Commit

Permalink
Fix(Task/Ext/Archive/ZipTask): Preseves directories' permissions in zip
Browse files Browse the repository at this point in the history
Fix phingofficial#1817 Stores directories's original permissions
as `ZipArchive::OPSYS_UNIX` `ExternalAttribute`.
  • Loading branch information
leagris committed Apr 27, 2024
1 parent dc73953 commit 0fa2312
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Phing/Task/Ext/Archive/ZipTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ private function addFilesetsToArchive($zip)
if ($f->isDirectory()) {
if ($pathInZip != '.') {
$zip->addEmptyDir($pathInZip);
$dirAttrName = $pathInZip . '/';
$dirAttrs = (int) fileperms($f->getPath()) << 16;
$zip->setExternalAttributesName($dirAttrName, \ZipArchive::OPSYS_UNIX, $dirAttrs);
}
} else {
$zip->addFile($f->getAbsolutePath(), $pathInZip);
Expand Down

0 comments on commit 0fa2312

Please sign in to comment.