Ticket purger considered harmful [was: Re: [rt-users] A small script]

Phil Homewood pdh at snapgear.com
Wed Sep 3 20:01:02 EDT 2003


Mitchell Henderson wrote:
> A couple days ago I got 16000 Tickets created from SoBig and other
> things.  I couldn't find a script to basicly batch erase a bunch of
> tickets so I wrote one.

There's a delete_dead_tickets script for RT2 floating around,
but I'm not sure if anyone has ported it to RT3 yet.

> Figured someone else might have this problem
> so I'll share the script.  It's very messy and i'm not 100% positive
> this is the right way to do it but it works for me, use at your own risk.

I'm 100% positive it will destroy your database, actually:

> t = db.execute("SELECT id FROM Tickets WHERE status='dead';")
> ids = db.fetchall()

"ids" is a list of Ticket ids....

>         db.execute("DELETE FROM Attachments where id=" + str(int(ids[i][0])))

... but you're deleting Attachments whose Attachment ids match a list
of Ticket ids. That's Not Good.
-- 
Phil Homewood, Systems Janitor, http://www.SnapGear.com
pdh at snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances



More information about the rt-users mailing list