Search code examples
trac

Deleting trac tickets created since a certain date until today


i left my trac create ticket open, and cheked it out several weeks later and it was filled with junk people filled in to give their companies links for seo. I want to ge rid of every ticket created since a certain date until today.

Thank you very much for your help


Solution

  • You can remove a ticket using the trac-admin command. To delete (for example) tickets 100-140, try using a script like this:

    #!/bin/bash
    
    ticket=100
    end_ticket=140
    
    while [ $ticket -le $end_ticket ]; do
        trac-admin /path/to/env ticket remove $ticket
        ticket=$(( $ticket + 1 ))
    done
    

    You can also delete tickets directly out of the database, but that's a lot more error-prone.

    Unfortunately, you need shell access to the server hosting your Trac instance to use the trac-admin command. If you don't have access, this becomes much trickier.