refactor(trash): Port deletion code of Trashbin to node based API - #54278
refactor(trash): Port deletion code of Trashbin to node based API#54278CarlSchwan wants to merge 1 commit into
Conversation
0291ef5 to
9114ebb
Compare
d0be8fd to
299859f
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
0e8f8b3 to
f5294e5
Compare
a044d76 to
541b45e
Compare
541b45e to
ac029d1
Compare
0e56bba to
b1d6386
Compare
b1d6386 to
0cf8b07
Compare
Instead of using a mix of View and Node based file system manipulation, use the 'new' node based API everywhere. Replace the hooks used in the admin_audit related to the deletion to new typed event that expose the deleted nodes. And remove old calculateSize to get the size of the deleted folder and instead rely on the Node::getSize information. Signed-off-by: Carl Schwan <carlschwan@kde.org>
0cf8b07 to
f4c89a6
Compare
| /** | ||
| * Event send before a node is deleted definitively. | ||
| * | ||
| * If you are doing anything with the database, prefer using BeforeAllNodeDeletedEvent instead. |
There was a problem hiding this comment.
There is no BeforeAllNodeDeletedEvent for trashbin, is there? If it’s from another namespace put the fully qualified name in the comment.
| if ($node instanceof Folder) { | ||
| $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); | ||
| } elseif ($node instanceof File) { | ||
| $size += $view->filesize('/files_trashbin/files/' . $file); | ||
| } | ||
| $size += $node->getSize(); |
There was a problem hiding this comment.
Are there tests for this size calculation that validates it did not change?
Summary
Instead of using a mix of View and Node based file system manipulation, use the 'new' node based API everywhere.
Replace the hooks used in the admin_audit related to the deletion to new typed event that expose the deleted nodes.
And remove old calculateSize to get the size of the deleted folder and instead rely on the Node::getSize information.
Checklist