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 #1817 Stores directories's original permissions
as `ZipArchive::OPSYS_UNIX` `ExternalAttribute`.
  • Loading branch information
leagris committed Apr 27, 2024
1 parent 5ce8dfe commit 81b1b0b
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 81b1b0b

Please sign in to comment.