Requests | Blesta


Allow Ticket Attachments to be Physically Deleted when a Ticket is Deleted/Trashed

turner2f shared this idea 3 years ago
Under Consideration

Allow Ticket Attachments to be Physically Deleted when a Ticket is Deleted/Trashed.

Otherwise, we will continue to have useless files that WERE part of tickets that no longer exist.

Which leads to wasted space on the server.

Comments (1)


I concur. The worst part about not cleaning up these attachments is the database data is gone that was associated with them and therefore, there is no reliable automatic way to even identify which attachments in the folder are orphaned and which are still attached to currently existing tickets.

1). There should be a routine that marks the files (by appending or renaming them) as "to delete" or move them to a sub-folder called "trash" within the current uploads directory. This routine should run each time a ticket is trashed.

2). A cron task should be created that checks for deleted files and purges said folder.

Lastly, There should be some type of "integrity" check that checks the database of tickets and marks ANY file within the attachments folder as "to delete" or moves those to a sub-folder called trash. In this way, it can cleanup the "expanding" nature of how the code operates currently and ensure that only tickets that are currently in existence are consuming disk space.