-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
taskPack modified to correctly set file permissions in ZIP files (ins… #888
Conversation
…tead of default 0666)
@@ -245,11 +245,21 @@ protected function addItemsToZip($zip, $items) | |||
if (!$zip->addFile($file->getRealpath(), "{$placementLocation}/{$relativePathname}")) { | |||
return Result::error($this, "Could not add directory $filesystemLocation to the archive; error adding {$file->getRealpath()}."); | |||
} | |||
if (stripos(PHP_OS, 'WIN') !== 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 space after closing parenthesis; found 21
@@ -245,11 +245,21 @@ protected function addItemsToZip($zip, $items) | |||
if (!$zip->addFile($file->getRealpath(), "{$placementLocation}/{$relativePathname}")) { | |||
return Result::error($this, "Could not add directory $filesystemLocation to the archive; error adding {$file->getRealpath()}."); | |||
} | |||
if (stripos(PHP_OS, 'WIN') !== 0) | |||
{ | |||
$zip->setExternalAttributesName("{$placementLocation}/{$relativePathname}", \ZipArchive::OPSYS_UNIX, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Opening parenthesis of a multi-line function call must be the last content on the line
- Only one argument is allowed per line in a multi-line function call
if (stripos(PHP_OS, 'WIN') !== 0) | ||
{ | ||
$zip->setExternalAttributesName("{$placementLocation}/{$relativePathname}", \ZipArchive::OPSYS_UNIX, | ||
$file->getPerms() << 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Multi-line function call not indented correctly; expected 24 spaces but found 28
- Closing parenthesis of a multi-line function call must be on a line by itself
} | ||
} elseif (is_file($filesystemLocation)) { | ||
if (!$zip->addFile($filesystemLocation, $placementLocation)) { | ||
return Result::error($this, "Could not add file $filesystemLocation to the archive."); | ||
} | ||
if (stripos(PHP_OS, 'WIN') !== 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 space after closing parenthesis; found 17
} | ||
} elseif (is_file($filesystemLocation)) { | ||
if (!$zip->addFile($filesystemLocation, $placementLocation)) { | ||
return Result::error($this, "Could not add file $filesystemLocation to the archive."); | ||
} | ||
if (stripos(PHP_OS, 'WIN') !== 0) | ||
{ | ||
$zip->setExternalAttributesName($placementLocation, \ZipArchive::OPSYS_UNIX, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Opening parenthesis of a multi-line function call must be the last content on the line
- Only one argument is allowed per line in a multi-line function call
if (stripos(PHP_OS, 'WIN') !== 0) | ||
{ | ||
$zip->setExternalAttributesName($placementLocation, \ZipArchive::OPSYS_UNIX, | ||
fileperms($filesystemLocation) << 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Multi-line function call not indented correctly; expected 20 spaces but found 24
- Closing parenthesis of a multi-line function call must be on a line by itself
It seems it also sets the permission 0666 for files on Windows systems as well, I'm using Windows 10 and when I use robo to create an archive and upload it to a linux web server it shows the files have a permission of 0666. Is there any fix for windows systems to retain the permissions? |
I may be wrong, but on Windows you will have to specify permissions explictly as there is nothing to inspect. |
Continuation here appreciated, if anyone has time to take over here. |
I submitted a pull request with fixes #897 |
Continued in #897 |
…tead of default 0666)
Overview
This pull request:
Summary
taskPack modified to correctly set file permissions in ZIP files
Description
Without these changes, on any Unix/Linux system, created ZIP files extracts with all files having permissions 0666 and there is no way to change it. This fix adds code to automatically set permissions in archive same to permissions of original files.