Deleting ticket spam in Trac
It isn't possible to delete tickets in Trac. And it's certain that one will get spammed.
I did a little Python script that deletes a ticket from the Trac database. The usage: python remove_ticket.py id
remove_ticket.py: import sqlite
import sys
trac_env = "/var/trac/skeletonz_dev/db/trac.db"
try:
id = sys.argv[1]
except:
print "Usage: remove_ticket.py id"
sys.exit()
con = sqlite.connect(trac_env)
cur = con.cursor()
cur.execute("DELETE FROM ticket WHERE id=%s", (id,))
cur.execute("DELETE FROM ticket_change WHERE ticket=%s",
(id,))
cur.execute("DELETE FROM attachment WHERE type='ticket' and id=%s",
(id,))
cur.execute("DELETE FROM ticket_custom WHERE ticket=%s", (id,))
con.commit()
print "Ticket #%s deleted" % id
|
|