Script URL: www.hesk.com
Version of script: 3.1.2
What terms did you try when SEARCHING for a solution: cleanup
Write your message below:
Is there a cleanup function in HESK? So we could purge old tickets and their comments from the database? Our building service has been using HESK since 2013, and have handled many many thousands of tickets. The database seems to been good normalised and does not use that much space and performance is good, the attachments folder is where alot of space is used.
It would be great if I could run a cleanup function that delete tickets and their comments/attachments from the system that is older than a couple of year.
Thanks in advance.
(SOLVED) Cleanup function?
Moderator: mkoch227
(SOLVED) Cleanup function?
Last edited by shadedk on Thu Aug 20, 2020 9:28 pm, edited 2 times in total.
Re: Cleanup function?
The only built-in "cleanup" function would be to:
1. list all the tickets you want to be deleted, For example, order tickets by submitted date (you may need to add Submitted to the list in Admin panel > Settings > Ticket list) and display 1000 or so per page.
2. select them all and use the bulk actions (below the list of tickets on the right side where the "Execute" button is) to delete them
That said, it might be better (and easier) to just delete old attachments. I made this utility in the past, you might find it useful:
https://www.hesk.com/extras/attachments-cleanup.zip
How to use:
1. create a new sub-folder in your Hesk folder. Something hard to guess, like "tools_8gW7Gjal904Ad"
2. open file attachments-cleanup.php in a powerful plain text editor (like Notepad++) an set available options.
2.1. I strongly recommend you leave $set_test_mode set to 1 before a live run
3. upload attached files to the sub-folder
4. BACKUP EXISTING FILES AND DATABASE
5. open attachments-cleanup.php in your browser (e.g., example.com/hesk/tools_8gW7Gjal904Ad/attachments-cleanup.php )
1. list all the tickets you want to be deleted, For example, order tickets by submitted date (you may need to add Submitted to the list in Admin panel > Settings > Ticket list) and display 1000 or so per page.
2. select them all and use the bulk actions (below the list of tickets on the right side where the "Execute" button is) to delete them
That said, it might be better (and easier) to just delete old attachments. I made this utility in the past, you might find it useful:
https://www.hesk.com/extras/attachments-cleanup.zip
How to use:
1. create a new sub-folder in your Hesk folder. Something hard to guess, like "tools_8gW7Gjal904Ad"
2. open file attachments-cleanup.php in a powerful plain text editor (like Notepad++) an set available options.
2.1. I strongly recommend you leave $set_test_mode set to 1 before a live run
3. upload attached files to the sub-folder
4. BACKUP EXISTING FILES AND DATABASE
5. open attachments-cleanup.php in your browser (e.g., example.com/hesk/tools_8gW7Gjal904Ad/attachments-cleanup.php )
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Cleanup function?
Thank you for quick answer
About solution 1, if I bulk delete some old tickets does that also delete the attachments?

About solution 1, if I bulk delete some old tickets does that also delete the attachments?
Re: Cleanup function?
Yes, it does. Attachments, replies, and tickets.
However, if you want keep old tickets for statistics/reporting purposes, you will be better off just deleting the attachments. The MySQL database will not be a bottleneck.
However, if you want keep old tickets for statistics/reporting purposes, you will be better off just deleting the attachments. The MySQL database will not be a bottleneck.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools