NAME
RTx::Shredder - Cleanup RT database
SYNOPSIS
rtx-shredder --force --sqldump unshred.sql 2005-01-01
use RTx::Shredder;
RTx::Shredder::Init( force => 1 );
my $deleted = RT::Tickets->new( $RT::SystemUser );
$deleted->{'allow_deleted_search'} = 1;
$deleted->LimitStatus( VALUE => 'deleted' );
while( my $t = $deleted->Next ) {
$t->Wipeout;
}
DESCRIPTION
RTx::Shredder is extention to RT API which allow to delete data from database.
USAGE
RTx::Shredder is extension to RT API which add(push) methods into base RT classes. If you are looking for end-user command line tool then see also rtx-shredder
script that is shipped with the distribution.
CONFIGURATION
$RT::DependenciesLimit
Shredder stops with error if object has more then $RT::DependenciesLimit
dependencies. By default this value is 1000. For example: ticket has 1000 transactions or transaction has 1000 attachments. This is protection from bugs in shredder code, but sometimes when you for example when you have big mail loops you may hit it. You can chage default value, in RT_SiteConfig.pm
add Set( $DependenciesLimit, new_limit );
METHODS
Dependencies
Dependencies method implementend in each RT class which Shredder can delete. Now Shredder support wipe out of Ticket, Transaction, Attachment, TicketCustomFieldValue, Principal, ACE, Group, GroupMember, CachedGroupMember.
NOTES
You should patch RT
RTx-Shredder distribution contains patch that should be applied to RT. Please read README file to learn more about this patch.
Transactions support
Transactions unsupported yet, so it's only save when all other interactions with RT DB are stopped. For example if you are going to wipe ticket that was deleted an year ago then it's probably ok to run shredder on it, but if you're going to delete some actively used object then it's better to stop http server.
Foreign keys
This two keys don't allow delete Tickets because of bug in MySQL ALTER TABLE Tickets ADD FOREIGN KEY (EffectiveId) REFERENCES Tickets(id); ALTER TABLE CachedGroupMembers ADD FOREIGN KEY (Via) REFERENCES CachedGroupMembers(id);
http://bugs.mysql.com/bug.php?id=4042
BUGS
*.in files
When you install this distribution also useless *.in file are installed, this shouldn't happen in future. I didn't find good solution yet.
Documentation
Many bugs in small docs: insanity, spelling, gramar and so on. Patches are wellcome.
AUTHOR
Ruslan U. Zakirov <cubic@wildgate.miee.ru>
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the Perl distribution.
SEE ALSO
perl(1), rtx-shredder