Prune Ticket Attachments

Pruning ticket attachments automatically deletes and purges ticket attachments following a set length of inactivity after closure of a ticket. This provides security benefits by only storing files for the shortest amount of time necessary and helps reduce disk storage requirements for file attachments.

Attachment pruning removes file attachments from the configured storage location for attachments (local disk or an Amazon S3™-compatible storage provider). After removal of attachments, when viewing a ticket, both admins and clients can view a list of attachment filenames. The system will annotate the filenames with a notice indicating their removal due to inactivity in the ticket.

You cannot recover pruned ticket attachments.

One-Time Pruning

You can perform a one-time on-demand prune of ticket attachments using the tools at Utilities > System > System Cleanup.

To do this:

  1. Go to Utilities > System > System Cleanup.
  2. For Prune Ticket Attachments, select the desired date to prune tickets from.
  3. Click Delete.

The system prunes attachments in batches of 1,000 ticket attachments per batch. If the number of attachments to prune for the time period you select exceeds this, you will receive a notice that the system successfully pruned the first 1,000 but that there are additional attachments remaining. In this scenario, you must repeat the process until the system no longer advises you there are remaining attachments.

Automatic Pruning

You can also configure WHMCS to perform automated ticket attachment pruning.

To do this:

  1. Go to Configuration () > System Settings > Automation Settings.
  2. If the system requests it, confirm your admin password.
  3. For Prune Ticket Attachments under Support Ticket Settings, choose the number of months to retain attachments following closure of a ticket. The minimum is one month.
  4. Click Save Changes.

The system cron performs automatic ticket pruning every hour.

Batch Processing

If you enable automatic attachment pruning and the number of attachments to prune exceeds 1,000 (the number in each pruning batch), it may take several runs to remove all of the attachments that match the selected criteria.

For large installations with a high volume of ticket attachments, you can run the ticket attachment pruning task more frequently than hourly. To do this, configure the following cron command:

php crons/cron.php -vvv do --AutoPruneTicketAttachments

You can configure this command to run as frequently as you wish, but we recommend no more than every five minutes.

Last modified: June 5, 2024