Skip to content

perf: Don't fetch all the trash items when deleting a single item#61906

Open
CarlSchwan wants to merge 6 commits into
masterfrom
carl/trashitem-delete-optimization
Open

perf: Don't fetch all the trash items when deleting a single item#61906
CarlSchwan wants to merge 6 commits into
masterfrom
carl/trashitem-delete-optimization

Conversation

@CarlSchwan

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@CarlSchwan CarlSchwan self-assigned this Jul 8, 2026
@CarlSchwan CarlSchwan force-pushed the carl/trashitem-delete-optimization branch from ffe88e1 to f871721 Compare July 9, 2026 08:19
@CarlSchwan CarlSchwan marked this pull request as ready for review July 9, 2026 08:19
@CarlSchwan CarlSchwan requested a review from a team as a code owner July 9, 2026 08:19
@CarlSchwan CarlSchwan requested review from ArtificialOwl, icewind1991, leftybournes and provokateurin and removed request for a team July 9, 2026 08:19
@CarlSchwan CarlSchwan added this to the Nextcloud 35 milestone Jul 9, 2026

@provokateurin provokateurin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd prefer the reverse commit order, where you first move the code from getTrashFiles into a separate method and then use it instead of duplicating it first and then removing it.

Comment thread apps/files_trashbin/lib/Sabre/TrashRoot.php Outdated
Comment thread apps/files_trashbin/lib/Trash/LegacyTrashBackend.php Outdated
Signed-off-by: Carl Schwan <carlschwan@kde.org>
Signed-off-by: Carl Schwan <carlschwan@kde.org>
Signed-off-by: Carl Schwan <carlschwan@kde.org>
Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan force-pushed the carl/trashitem-delete-optimization branch from 5a2b87e to 96013b8 Compare July 9, 2026 09:11
@CarlSchwan

Copy link
Copy Markdown
Member Author

I'd prefer the reverse commit order, where you first move the code from getTrashFiles into a separate method and then use it instead of duplicating it first and then removing it.

Done :)

@provokateurin provokateurin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very nice!

#[\Override]
public function getTrashRootItem(IUser $user, string $name): ?ITrashItem {
foreach ($this->getBackends() as $backend) {
if (method_exists($backend, 'getTrashRootItem')) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since we force all implementations to add this method, this check is not really needed. If the implementation doesn't have the function yet, it will hard fail before this code is even reached.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The getTrashRootItem is not yet in the interface so that this is easy to backport. I would add it to the interface and remove the method_exists check as a followup

Only take one argument and instead call this with array map

Signed-off-by: Carl Schwan <carlschwan@kde.org>
Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan force-pushed the carl/trashitem-delete-optimization branch from 96013b8 to acb2934 Compare July 9, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants