I foolish left enabled the TICKET_CREATE permission on the default
anonymous user on my Trac installation and noticed one day that I had
400 spam tickets.  Trac doesn't provide a way to delete tickets, only
resolve them, and in v.0.10 trac-admin seems to be missing the
ability to 'ticket remove id#', so I opted for deleting the tickets
directly in the database.  

1. figure out which tickets to delete. Say it's everything above
id=100
2. find your database. Usually it's trac.db in the 'db' folder inside
your Trac installation. 
3. use sqlite at the command line: sqlite trac.db.  you may need to
do this as root if you're running in a *nix environment: sudo sqlite
trac.db.  For safety's sake, you may want to first make a copy, say
as trac-copy.db, and edit that. 
3. check to see that you can read the tables: use the .tables command
and you should see:
attachment     milestone      revision       ticket_change
auth_cookie    node_change    session        ticket_custom
component      permission     system         version      
enum           report         ticket         wiki      
4. if you get an error message like "database is encrypted or not a
database", you are likely using the wrong version of sqlite.  Try
again with sqlite3. 
5. do a check on the tickets table to see if sqlite thinks there are
the same number of records there as you do: select count(id) from
ticket;
You should get back the number of records. "395". 
6. Now delete the offending records: delete from ticket where id>100;
If you forget the "where" part, *all* of the tickets will be deleted.
That's why we're working on a copy of the database. :-)
Do another count to see that the number went down. Say there are only
100 records now. Do a check to see if the 100th record contains the
contents you expected:
select * from ticket where id=100;
7. If all went well, exit sqlite, rename trac.db to trac.db.old and
rename the trac-copy.db to trac.db.  Start up your trac server and
check out the list of tickets!

Hope this helps someone. 

cheers
S


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Trac Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to