Skip to content
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

WebP files are not deleted when attachment is deleted #10

Open
sun opened this issue Aug 16, 2019 · 1 comment
Open

WebP files are not deleted when attachment is deleted #10

sun opened this issue Aug 16, 2019 · 1 comment

Comments

@sun
Copy link

sun commented Aug 16, 2019

Problem

  • Website still consumes a very large amount of disk space after deleting media.

Cause

  • When deleting an attachment using WP-CLI (wp post delete --force 1234) then WordPress Core deletes its files from the uploads folder, but the webp files generated by Optimus remain in the filesystem.

Goal

  • Ensure webp derivatives are in sync with actual image attachments.
  • Free up disk space during cleanups to e.g. restart a site from scratch, or speed up website backup time.

Proposed solution

  1. React to the attachment delete hook.
  2. Check whether webp derivatives of registered image sizes exist in the filesystem.
  3. Delete the existing webp image files.

Notes

  • After fixing the basic integration behavior, a future PR could introduce a new WP-CLI command wp optimus webp delete-orphans similar to Feature request: add sync-missing command to wp client. #7 that allows to clean up an existing filesystem (i.e., considering all the sites that have obsolete webp image files currently).
@sun
Copy link
Author

sun commented Aug 16, 2019

@svenba svenba changed the title [bug] webp files are not deleted when attachment is deleted WebP files are not deleted when attachment is deleted Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant