Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

copy(): Copy files or folders from a container to a tar stream. copyToDi... - #109

Closed
Boran wants to merge 5 commits into
docker-php:masterfrom
Boran:file-copy2
Closed

copy(): Copy files or folders from a container to a tar stream. copyToDi...#109
Boran wants to merge 5 commits into
docker-php:masterfrom
Boran:file-copy2

Conversation

@Boran

@Boran Boran commented Mar 3, 2015

Copy link
Copy Markdown
Contributor

After over an hour trying to rebase and solve merge conflicts on #89 I'm giving up on that branch and create this new one 'file-copy2'. All changes are in one commit.

Comment thread src/Docker/Manager/ContainerManager.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to handle errors like 'permission denied' or 'file not found' (in case directory not exists). I suggest not to use fopen, it throws uncatchable warning in case of opening error.
Quick and dirty solution - mute fopen with @ and then check $output is not null.
Better solution - open file by SPL SplFileObject in try-catch block.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for SplFileObject

@Boran

Boran commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

Apparently Spl is in php 5.x, so just tried:
$fd=SplFileObject("/tmp/foo", 'w+');
and it give "Call to undefined function SplFileObject"
http://php.net/manual/en/spl.configuration.php does not indicate any run time configuration.
Using Ubuntu 14.04.
Suggestions?

@ubermuda

ubermuda commented Mar 4, 2015

Copy link
Copy Markdown
Contributor

Hey Sean, SplFileObject is actually an object, so you need to instantiate it with new, like this:

$fd = new SplFileObject('/tmp/foo', 'w+');

@Boran

Boran commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

Oops :-)

@Boran

Boran commented Mar 4, 2015

Copy link
Copy Markdown
Contributor Author

Using fopen rather than SplFileObject due to stream_copy_to_stream()

@Boran

Boran commented May 6, 2015

Copy link
Copy Markdown
Contributor Author

Hi, can this be committed please?

Comment thread src/Docker/Manager/ContainerManager.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just add an empty line before that if?

@ubermuda

ubermuda commented May 6, 2015

Copy link
Copy Markdown
Contributor

And sorry for being a coding style nazi

@ubermuda

Copy link
Copy Markdown
Contributor

Hey @Boran, sorry for the delay. Before this can be merged, indentation and CS needs to be fixed:

  • use 4 spaces for indentation
  • no new line before the closing } of an if

@Boran

Boran commented Sep 4, 2015

Copy link
Copy Markdown
Contributor Author

I've been waiting 6 months to get this small patch integrated, hardly motivating..

@hacfi

hacfi commented Sep 4, 2015

Copy link
Copy Markdown
Contributor

The failing test is not related to this PR. Looks good to me 👍

@ubermuda

ubermuda commented Sep 4, 2015

Copy link
Copy Markdown
Contributor

I've been waiting 6 months to get this small patch integrated, hardly motivating..

You are right, and I should have handled your PR earlier and in a more swift manner. That being said, there still are inconsistencies in your PR regarding to CS, and you merged master in your branch instead of rebasing your branch on master, which screws up the history.

Anyway, I made a new PR based on your commits, fixed the CS, then rebased against master and squashed the commits in #128

@ubermuda ubermuda closed this Sep 4, 2015
@Boran

Boran commented Sep 4, 2015

Copy link
Copy Markdown
Contributor Author

Oops, apologies for that I had forgotten the correct procedure. Thanks for sorting it out:)

Sean Boran

On 04 Sep 2015, at 16:32, Geoffrey Bachelet notifications@github.com wrote:

I've been waiting 6 months to get this small patch integrated, hardly motivating..

You are right, and I should have handled your PR earlier and in a more swift manner. That being said, there still are inconsistencies in your PR regarding to CS, and you merged master in your branch instead of rebasing your branch on master, which screws up the history.

Anyway, I made a new PR based on your commits, fixed the CS, then rebased against master and squashed the commits in #128


Reply to this email directly or view it on GitHub.

@ubermuda

ubermuda commented Sep 4, 2015

Copy link
Copy Markdown
Contributor

No problem. Just merged #128

@Boran
Boran deleted the file-copy2 branch September 5, 2015 06:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants