Code Monkey home page Code Monkey logo

osticket-plugin-archiver's Introduction

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)

  • Requires cron to be enabled and working.
  • Requires this plugin installed

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:

Open /include/class.ticket.php and add the "Signal::send" line below:

    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

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:

  • /path/to/archives/{$department}/{$user}/{$ticket_subject}_{$ticket_id}/
  • .. /attachment_filename1.ext
  • .. /attachment_filename2.ext
  • .. /data.json (everything we know about the ticket, entire thread, with all metadata retained as much as possible, including original mail headers, think Australian Government level of metadata retention)
  • .. /Ticket.pdf (export via normal PDF semantics)
  • Folder mtime set to initial ticket date.

if "Basic Archive" mode enabled, then:

  • /path/to/archives/{$ticket_subject}_{$ticket_id}.pdf (export via normal PDF semantics)

If there is interest, or pull-requests, I'll eventually (maybe) finish the advanced archive mode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.