NAME

RTx::Shredder - Cleanup RT database

SYNOPSIS

CLI

rtx-shredder --force --plugin Tickets=queue,general;status,deleted

API

Same action as in CLI example, but from perl script:

use RTx::Shredder;
RTx::Shredder::Init( force => 1 );
my $deleted = RT::Tickets->new( $RT::SystemUser );
$deleted->{'allow_deleted_search'} = 1;
$deleted->LimitQueue( VALUE => 'general' );
$deleted->LimitStatus( VALUE => 'deleted' );
while( my $t = $deleted->Next ) {
    $t->Wipeout;
}

DESCRIPTION

RTx::Shredder is extention to RT API which allow you to delete data from RT database.

Command line tools(CLI)

rtx-shredder script that is shipped with the distribution allow you to delete objects from command line or with system tasks scheduler(cron or other).

Web based interface(WebUI)

Shredder's WebUI integrates into RT's WebUI and you can find it under Configuration->Tools->Shredder tab. This interface is similar to CLI and give you the same functionality, but it's available from browser.

API

RTx::Shredder modules is extension to RT API which add(push) methods into base RT classes. API is not well documented yet, but you can find usage examples in rtx-shredder script code and in t/* files.

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 have big mail loops you may hit it. You can change 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, ObjectCustomFieldValue, Principal, ACE, Group, GroupMember, CachedGroupMember.

NOTES

Database transactions support

Database 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

TESTING

Read more about testing in t/utils.pl.

BUGS AND HOW TO CONTRIBUTE

I need your feedback in all cases: if you use it or not, is it works for you or not.

Documentation

Many bugs in the docs: insanity, spelling, gramar and so on. Patches are wellcome.

Todo

Please, see Todo file, it has some technical notes about what I plan to do, when I'll do it, also it describes some problems code has.

Repository

You can find repository of this project at https://opensvn.csie.org/rtx_shredder

AUTHOR

Ruslan U. Zakirov <Ruslan.Zakirov@gmail.com>

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

rtx-shredder, rtx-validator