Enables PDF Archiving of tickets before they delete, and a basic auto-delete of old tickets via schedule.
Install as a normal plugin (extract/checkout into /include/plugins/archiver
), don't change core at all, enable the plugin via the admin screen and tick the box Auto-purge old closed tickets
. Configure it as you need for your environment.
How old is too old? If you specify an max-age for closed tickets, the plugin will delete them for you when the maximum age you specify is reached.
We store when it last ran the purge, and depending on your settings, will run it again provided cron is called often enough. EG: If you want it to run every 12 hours, but only run cron every 24, not much we can do about that.
How many tickets do we purge every time we run? Depending on how you've configured it, this can be high (command-line mode for this) or low (for auto-cron), if you have a high-volume of tickets and auto-cron, you will need to set this to run as often as possible.
Uncomment line ~45 of this plugin's config.php to allow using it without the ticket-delete MOD (see below). Line 45 is the one that adds the error message 'The signal is not being sent from class.tickets.php'. That checks to make sure you've followed the next step properly.
Open /include/class.ticket.php
and add the "Signal::send" line shown below (inside the delete function found around line: ~2700):
function delete($comments='') {
global $ost, $thisstaff;
Signal::send('ticket.before.delete', $this); // Archiver plugin: Added to archive tickets before deleting them.
Alternatively, you can copy the file provided from the subfolders (osticket-$VERSION) into /include/ and overwrite the core file. If you change to a version not provided, or update etc, then use the above method instead and open an issue so I can make a new version.
Admin options allow you to specify how old tickets have to be before purge
Admin option defines where to dump old tickets
After each update, go into the plugin settings and push Save, this will check that the Signal
is still there, otherwise it will need to be added again.
I haven't found a way of detecting the upgrade without doing it on bootstrap, which is bad from a performance perspective.
if "Advanced Archive" mode enabled, then:
if "Basic Archive" mode enabled, then:
If there is interest, or pull-requests, I'll eventually (maybe) finish the advanced archive mode.