Skip to content

Remove shares of the root folder#25075

Merged
PVince81 merged 1 commit into
masterfrom
fix_23265
Jun 16, 2016
Merged

Remove shares of the root folder#25075
PVince81 merged 1 commit into
masterfrom
fix_23265

Conversation

@rullzer

@rullzer rullzer commented Jun 13, 2016

Copy link
Copy Markdown
Contributor

Fixes #23265

(A possibly costly) repair job to remove cyclic shares.

CC: @nickvergessen @PVince81 @icewind1991

@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @DeepDiver1975, @PVince81 and @nickvergessen to be potential reviewers

@rullzer

rullzer commented Jun 13, 2016

Copy link
Copy Markdown
Contributor Author

To test insert a cyclic share... see the tests on how to do that...

Comment thread lib/private/Repair/RemoveRootShares.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.

make sure share type is file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

file or folder then... but 'other shares' should never set the file_source... but ok

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.

you did it on the count, but missed it here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah right...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@rullzer

rullzer commented Jun 13, 2016

Copy link
Copy Markdown
Contributor Author

@nickvergessen @icewind1991 fixed

Comment thread lib/private/Repair/RemoveRootShares.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.

Needs to use $qb->expr()->literal(), otherwise columns file and folder are not found.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Fixes #23265

(A possibly costly) repair job to remove cyclic shares.

$qb->select('fileid')
->from('filecache')
->where($qb->expr()->eq('path', $qb->expr()->literal('files')));

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 it also happen that the real root is shared ? The one with path "".
However that was even possible to happen in the first place...

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.

Question 2: what happens if there's an external storage with a path "files" on it ? Would it be excluded ?
I didn't see where you check that it's indeed the user's home storage and not an external one (with the included nightmare of storage id, not being able to rely on "home::"). Maybe oc_mounts can be used for that ?

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.

Well this is just a easy and simplified test. On real deletion we make sure to only take the real roots into account.

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.

Indeed, thanks 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

exactly as suggested by @nickvergessen this is just a very simple quick tests. That should tell us if there is potentially something to fix. For probabaly 99% of the isntallations out there this will be false so they don't have to do the expensive repair step.

@PVince81

Copy link
Copy Markdown
Contributor

Tested with moving a share in the DB to point at the "files" entry. The repair job deleted that share properly 👍

See my question above.

private function removeRootShares(IOutput $output) {
$function = function(IUser $user) use ($output) {
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
$fileId = $userFolder->getId();

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.

See here @PVince81

@nickvergessen

Copy link
Copy Markdown
Contributor

👍

@PVince81
PVince81 merged commit 1251df3 into master Jun 16, 2016
@PVince81
PVince81 deleted the fix_23265 branch June 16, 2016 07:27
@PVince81

Copy link
Copy Markdown
Contributor

@owncloud/sharing should be backport this to 9.0 ?

@DeepDiver1975 @dragotin

@rullzer

rullzer commented Jun 16, 2016

Copy link
Copy Markdown
Contributor Author

@owncloud/sharing should be backport this to 9.0 ?

Yes should be backported.

@PVince81

Copy link
Copy Markdown
Contributor

Will do (there are some complications due to IRepairStep incompatibilities)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cleanup toplevel shares (cyclic shares)

5 participants