-
Notifications
You must be signed in to change notification settings - Fork 304
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
Bugfix/CopyDir recursive destination check #126
Merged
burzum
merged 5 commits into
consolidation:master
from
boedah:bugfix/CopyDir-recursive-destination-check
Mar 15, 2015
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
046b95b
add cli/CopyDirRecursiveCept
boedah 2b70f13
add cli/CopyDirOverwritesFilesCept
boedah 4163278
build CliGuy
boedah 4bcc7ec
CopyDir: check for destination (remove @-operator)
boedah a3e75bb
CopyDir: create destination recursively
boedah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
some existing file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Just a file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
some_destination existing file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
$I = new CliGuy($scenario); | ||
$I->wantTo('overwrite a file with CopyDir task'); | ||
$I->amInPath(codecept_data_dir() . 'sandbox'); | ||
$I->seeDirFound('some'); | ||
$I->seeFileFound('existing_file', 'some'); | ||
$I->taskCopyDir(['some' => 'some_destination']) | ||
->run(); | ||
$I->seeFileFound('existing_file', 'some_destination/deeply'); | ||
$I->openFile('some_destination/deeply/existing_file'); | ||
$I->seeInThisFile('some existing file'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
$I = new CliGuy($scenario); | ||
$I->wantTo('copy dir recursively with CopyDir task'); | ||
$I->amInPath(codecept_data_dir() . 'sandbox'); | ||
$I->seeDirFound('some/deeply/nested'); | ||
$I->seeFileFound('structu.re', 'some/deeply/nested'); | ||
$I->taskCopyDir(['some/deeply' => 'some_destination/deeply']) | ||
->run(); | ||
$I->seeDirFound('some_destination/deeply/nested'); | ||
$I->seeFileFound('structu.re', 'some_destination/deeply/nested'); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't 777 a little too much? I think 775 or 755 would be better.
Or check the parent folders permission and inherit them?
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.
I did not want to change existing behavior, and 0777 is the default (http://php.net/manual/de/function.mkdir.php).
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.
It's not like that standard php is secure at all. I think especially in the case of dealing with assets that are usually going into a public webroot it is critical to not set them to 777. This will make it very easy to add malicious files and code into files.
I would propose to set the default to 755 and give the user the option to change it:
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.
permissions
option is not very descriptive, could you propose something better?I agree to provide better option for that, and maybe 755 is a good idea for making it standard.
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.
dirPermissions(), folderPermissions()? chmod()?