Skip to content

Comments

Preview trash cleanup#5852

Merged
MorrisJobke merged 2 commits intomasterfrom
preview_trash_cleanup
Jul 27, 2017
Merged

Preview trash cleanup#5852
MorrisJobke merged 2 commits intomasterfrom
preview_trash_cleanup

Conversation

@rullzer
Copy link
Member

@rullzer rullzer commented Jul 24, 2017

Fixes #5558

By not deleting via the view but via the node api we ensure the correct events are fired and thus we can cleanup the previews.

To test:

  1. Upload a file with preview (some image)
  2. Check the appdata_*/preview/ folder to see your file has a preview generated
  3. Delete the file
  4. Go to trash
  5. Delete the file from the trash
  6. Previews should be gone from the system

@MorrisJobke
Copy link
Member

CI is okay. Let me review this.

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Tested and works 👍

@MorrisJobke
Copy link
Member

@rullzer What about a cleanup repair step (that can run in live mode) to remove previews of non-existing files?

@MorrisJobke MorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jul 27, 2017
@MorrisJobke MorrisJobke merged commit dc58206 into master Jul 27, 2017
@MorrisJobke MorrisJobke deleted the preview_trash_cleanup branch July 27, 2017 15:24
@MorrisJobke
Copy link
Member

@rullzer 🏓 backport is pending

@MorrisJobke
Copy link
Member

@rullzer 🏓

@rullzer
Copy link
Member Author

rullzer commented Aug 15, 2017

Backport in #6114

@fdoumet
Copy link

fdoumet commented Aug 13, 2018

Looks like this is broken again in 14.0.0 Beta 3. Can we reopen?

@rullzer
Copy link
Member Author

rullzer commented Aug 13, 2018

@fdoumet yes we changed the way it works. There is now a background job doing the cleanup so it is asynchronous. This means it is less likely to run into timeouts.

@fdoumet
Copy link

fdoumet commented Aug 13, 2018

From this line in BackgroundCleanupJob:

$qb->expr()->castColumn('a.name', IQueryBuilder::PARAM_INT), 'b.fileid'

it looks like only previews with a fileId as a name will get cleaned. Other previews with names such as 128-128-max.jpg will not get deleted. Is that accurate?

@rullzer
Copy link
Member Author

rullzer commented Aug 13, 2018

No. It looks for folder names. The folder names of the previews are fileids

@Powerbless
Copy link

Thank you! How can i easyly add the Changes to my nextcloud?

@nickvergessen
Copy link
Member

Updating to any of the recent Nextcloud versions (15, 16 or 17) will automatically bring the fix.

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

Labels

4. to release Ready to be released and/or waiting for tests to finish bug feature: previews and thumbnails feature: trashbin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After deleting an (image) file, the preview files remain forever

6 participants