Clean up image styles when module is uninstalled

Created on 8 April 2024, 7 months ago

Problem/Motivation

Generated image styles should be cleaned up when the module is uninstalled.

Proposed resolution

Add enforced module dependencies to the generated image styles to make sure they are automatically deleted when the module is being uninstalled.

πŸ“Œ Task
Status

Active

Version

1.3

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dieterholvoet
  • Status changed to Needs review 7 months ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So I may actually be a -1 for this idea even though I do get it.

    But what about the scenario of you're just using this module for generating image styles. Then you may not install it permanently or on production. Would be more work but would be more in favor of a setting value that deletes them for you.

  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    This should probably not be the default behavior. The image styles might be used in other config as well, which could become problematic.

    Not sure if we could allow users to choose before they uninstall? Maybe we could set a message explaining the generated image styles for the module are not automatically removed, and link to a page where they can remove the generated image styles first?

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    Allowing users to choose before uninstalling seems like something hard to implement, since uninstalling can happen in multiple ways: through the UI, through drush pm-uninstall, through drush cim. If you're not comfortable with making this the default behaviour, we could just add a section to the documentation to remind people to manually clean up these image styles after uninstallation. Or we could add a new button to /admin/config/media/image-styles/generate that deletes all generated image styles.

  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    Having a button to delete the generated styles would help! I have no problem adding something like that to the settings page and documenting it. The message could be a nice reminder for people uninstalling via the UI, but it is a nice to have.

  • Merge request !29Resolve #3439434 "Delete button" β†’ (Open) created by dieterholvoet
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I created a new MR adding a button to delete generated image styles and updating README.md. Could you take care of updating the project description?

Production build 0.71.5 2024