-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
refactor: Commands and background jobs for the trashbin #54876
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
base: master
Are you sure you want to change the base?
Conversation
- Use modern node and SetupManager API - Avoid passing the user by id and instead use IUser Signed-off-by: Carl Schwan <[email protected]>
bf64f65 to
63de669
Compare
| private LoggerInterface $logger, | ||
| private ?IUserManager $userManager = null, | ||
| private ?Expiration $expiration = null, | ||
| readonly private LoggerInterface $logger, |
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.
| readonly private LoggerInterface $logger, | |
| private readonly LoggerInterface $logger, |
Same for the others
| /** @var Folder $folder */ | ||
| $folder = $this->rootFolder->getUserFolder($user->getUID())->getParent()->get('files_trashbin'); | ||
| return $folder; | ||
| } catch (NotFoundException|NotPermittedException) { |
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.
Should it be caught? If you let it bubble up it will get logged. But I’m not sure whether it should get logged. NotFound would just mean the user trashbin was not used yes.
NotPermitted maybe we should log.
| } elseif (!empty($users)) { | ||
| foreach ($users as $user) { | ||
| if ($this->userManager->userExists($user)) { | ||
| $userObject = $this->userManager->get($user); |
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 would rather rename $users and $user to $userIds and $userId as it would be even less confusing. But that's a nitpick.
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.
Use strong type in the constructor?
| $setupManager = Server::get(SetupManager::class); | ||
| $rootFolder = Server::get(IRootFolder::class); |
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.
Why can't we use DI?
Summary
Originally tried to optimize a bit the number of query but the new code is doing exactly as many DB request as before :( Still a nice cleanup
Checklist