clonemeagain / osticket-plugin-archiver

Plugin for osTicket which can automatically archive tickets before delete, and allows for auto-pruning of old tickets
GNU General Public License v2.0
18 stars 14 forks source link
archive osticket plugin

osTicket plugin: Archiver

Enables PDF Archiving of tickets before they delete, and a basic auto-delete of old tickets via schedule.

Enable automatic Deleting of old tickets (no Modifications required)

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.

Max Age Setting

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.

Purge Frequency Setting

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.

Purge Number Setting

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.

To Install as MOD and enable Archiving during any ticket delete:

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.

Important: Update Requirement for Archive Mod

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.

Archive Mode & structure (plan):

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.