Skip to content

Delete unused image files uploaded via settings #2683

@Sabr1n4W

Description

@Sabr1n4W

Problem
Currently image files that were uploaded inside the settings (e.g. favicon, logo, bbb logo) are not always deleted if they are not needed anymore (e.g. when the favicon is exchanged with a new one)

This can result in a lot of image files not beeing deleted if they are exchanged often.

To Reproduce
Steps to reproduce the behavior:

  1. Upload a new favicon file
  2. Check storage to see file
  3. Change favicon setting again
  4. See previous favicon file not being deleted

Expected behavior
Image files should be deleted if they are not needed anymore.

Additional context
Deleting the files can sometimes be difficult because it can be hard to determine which image files should be deleted and which image files are still needed / currently in use (randomised filename, link instead of file, ...)

Possible solution
Several possible solutions where discussed for this.

The most promising solution discussed was saving the image files with a fixed name (e.g. favicon.) and extending this filename with a random string when loading the file inside the blade view.

Even though this solution was the most promising solution discussed it contains several problems that would need to be fixed when implementing this. (Those are mostly also present whis other possible solutions)

Some of these problems are:

  • Defining when the file should be deleted and when not (easiest approach would be to only delete if a new file was provided (image file would not be deleted if a new favicon is provided via a link))
  • Migration from current behaviour to new one

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendPull requests that update Php code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions