How to remove a Trac Spam Ticket
This page describes how to remove spam. We do not just use the Trac facilities but want to completely remove the spam in a sustainable manner. Leaving it lurking around for instance in the mailing list archives would just be what those jerks want. Note that this document assumes that all tickets starting from a certain revision are removed, i.e. that no valid ticket has been added since the spam was posted.
Removing the database entry
Login as fawkes on maxwell. Then login to the database using:
psql -h localhost -U fawkestrac
Take the password from the trac.ini config file. Then issue the following commands. Replace SPAM_ID with the ID of the first spam message, anything following that number will be removed. If there has been useful tickets after the spam ticket adapt the SQL otherwise accordingly and omit the ALTER SEQUENCE command. Note that this will leave "holes" in the ID number space of tickets.
DELETE FROM ticket WHERE id >= SPAM_ID; DELETE FROM ticket_custom WHERE ticket >= SPAM_ID; DELETE FROM ticket_change WHERE ticket >= SPAM_ID; VACUUM ticket; VACUUM ticket_custom; VACUUM ticket_change; ALTER SEQUENCE ticket_id_seq RESTART WITH (SPAM_ID - 1);
This removes the entries and the next ticket will again get the ticket ID which was spam before.
Removing the mailing list posting
Login as root to lechuck. Then follow this procedure (cf. Mailman docs):
cd /var/lib/mailman/archives/private vi fawkes-trac.mbox/fawkes-trac.mbox
Go to the end of the file and search backward for "^From ". Remove the mails which correspond to spam entries. Then do
mv fawkes-trac /tmp cd ~mailman bin/arch fawkes-trac
The spam is now removed from the mailing list archive.

