Skip to content

Conversation

@MorrisJobke
Copy link
Member

Tested and works fine here 👍

This will help user to selectively move the folders
specified using --path option, instead of moving
entire folder under files directory.

Signed-off-by: Sujith H <sharidasan@owncloud.com>

Update the integration test for transfer-ownership

Update the integration test for transfer-ownership
as the new option --path is introduced in the command.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@mention-bot
Copy link

@MorrisJobke, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen, @rullzer and @LukasReschke to be potential reviewers.

Filesystem::initMountPoints($this->sourceUser);
Filesystem::initMountPoints($this->destinationUser);

if (strlen($this->inputPath) >= 1) {
Copy link
Member

Choose a reason for hiding this comment

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

if($this->inputPath) would be better, otherwise single character paths can lead to unexpected results

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't get this. It checks if the path is greater equal than.

$self = $this;
$this->walkFiles($view, "$this->sourceUser/files",
$walkPath = "$this->sourceUser/files";
if ( strlen($this->inputPath) > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

just if($this->inputPath) would be cleaner

Copy link
Member

Choose a reason for hiding this comment

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

but that fails directory '0'

Copy link
Member

Choose a reason for hiding this comment

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

==='' then

'path',
null,
InputOption::VALUE_REQUIRED,
'selectively provide the path to transfer. For example --path="folder_name"'
Copy link
Member

Choose a reason for hiding this comment

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

It seems to expect absolute path /$user/files/path, the cli help should reflect that

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really - see line 139.

$this->walkFiles($view, "$this->sourceUser/files",
$walkPath = "$this->sourceUser/files";
if ( strlen($this->inputPath) > 0) {
if ($this->inputPath !== "$this->sourceUser/files") {
Copy link
Member

Choose a reason for hiding this comment

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

This if only makes the code more complex imo

$view->rename("$this->sourceUser/files", $this->finalTarget);
// because the files folder is moved away we need to recreate it
$view->mkdir("$this->sourceUser/files");
$sourcePath = (strlen($this->inputPath) > 0) ? $this->inputPath : "$this->sourceUser/files";
Copy link
Member

Choose a reason for hiding this comment

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

Simply setting $this->inputPath to a default value of $this->sourceUser/files would remove the need for endless if statements like this one

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@MorrisJobke
Copy link
Member Author

@icewind1991 I addressed all the comments you had and refactored out most of the if statements.

I tested it with and without the path option and it works fine 👍

Copy link
Member

@icewind1991 icewind1991 left a comment

Choose a reason for hiding this comment

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

Much better

@MorrisJobke MorrisJobke merged commit d2654c8 into master Mar 23, 2017
@MorrisJobke MorrisJobke deleted the downstream-27343 branch March 23, 2017 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants