-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Introduce console command to transfer ownerships of files #20571
Conversation
nice! 👍 |
3e24ada
to
5428e88
Compare
5428e88
to
6a60481
Compare
7208a13
to
89546bb
Compare
89546bb
to
0e6bfee
Compare
@rullzer still waiting for getshares to be implemented 😉 |
@DeepDiver1975 it is on the todo... and a lot closer to happening now that createShares is in ;) |
great! |
b536396
to
cdb5e18
Compare
72c699a
to
477c7fd
Compare
Looks good. Did some testing and it seems to all work. However I would very much like to have intergration tests for this... since I do assume there are corner cases where restoring shares will fail. Because it creates a duplicated share or whatever... |
if ($share->getSharedWith() === $destinationUser) { | ||
$this->shareManager->deleteShare($share); | ||
} else { | ||
$share->setShareOwner($destinationUser); |
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.
This is not correct.
The share owner might be a different user then we are migrating.
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.
So I only update the share owner in case the current owner is the user from whom we are moving away?
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.
yes. Basically we get the file from the fileid in the owners folder... so if that is not set correctly.... 💥
So you copy the files from sourceUser to destUser. I get this. But this break the chain of shares. Since the fileId changes. So assume.
Now all of a sudden the incomming share foo for user3 no longer is the same foo as user1 shared originally. |
protected function transfer(OutputInterface $output) { | ||
$view = new View(); | ||
$output->writeln("Transferring files to $this->finalTarget ..."); | ||
// $view->rename("$this->sourceUser/files", $this->finalTarget); |
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.
@rullzer rename is to be used - not copy. I use copy for testing - will fix asap
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.
Ah good!
477c7fd
to
3ab0a3f
Compare
it's a move .... |
@DeepDiver1975 Ready for review? |
411a45e
to
7e33e67
Compare
Tested, works now 👍 |
Second reviewer ? @rullzer @icewind1991 @MorrisJobke @nickvergessen |
or @LukasReschke ? |
private function restoreShares(OutputInterface $output) { | ||
$output->writeln("Restoring shares ..."); | ||
$progress = new ProgressBar($output, count($this->shares)); | ||
/** @var Folder $sourceRoot */ |
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.
This can go
Ran some tests and they passed. I would recommend to add to the docs a big warning to backup their data. I do think there will still be corner cases where things might say boom. Also it would be very nice if we could setup intergration tests for this. My nitpickings aside.. 👍 |
0508d83
to
e16dc3a
Compare
public function __construct(IUserManager $userManager, IManager $shareManager, IRootFolder $rootFolder) { | ||
$this->userManager = $userManager; | ||
$this->shareManager = $shareManager; | ||
$this->rootFolder = $rootFolder; |
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.
This is unused
e16dc3a
to
f09edde
Compare
f09edde
to
81d4042
Compare
@icewind1991 description updated - please have a look |
Code looks good 👍 |
Introduce console command to transfer ownerships of files
refs #19154
Requires Sharing 2.0 to implement getShares() and updateShare()
@schiesbn @rullzer