On 12/30/06, Mathew Snyder <[EMAIL PROTECTED]> wrote:
I'm rewriting a script that will eliminate all spam users accrued over the
course of a day.  Presently, it is using the least efficient way of executing
the wipeout by performing a system call to rtx-shredder.  I would prefer to run
the wipeout by way of the Shredder API.  I'm guessing along the lines of this:

# load plugin by preformatted string
my $pluginString = "'Users=status,any;email,$email;replace_relations,Nobody'";
my $plugin = new RTx::Shredder::Plugin;
my( $status, $msg ) = $plugin->LoadByString( $pluginString );
unless( $status ) {
    print STDERR "Couldn't load plugin: $msg\n";
    exit(1);
    }
}

Another question is in regards to the sql dump.  I've looked at rtx-shredder and
have seen referrence to the SetFile method but haven't seen anything about the
DumpSQl method that is mentioned in Shredder.pm.  Is this automatically
accounted for when if I use my ($fname, $fh) = $shredder-SetFile;?

The portion of my script this relates to is below.

<snip>
foreach my $email (sort(@emails)){
        print $email . "\n";
}

print "\nDelete the email addresses from the RT database [y/N]: ";
chomp($ans = <STDIN>);

if ($ans =~ m/^(y|yes)$/i){
        my $email;
        foreach $email (@emails){
#       system "/usr/local/rt-3.6.1/local/sbin/rtx-shredder --force --plugin \
'Users=status,any;email,$email;replace_relations,Nobody'";
        # load plugin by preformatted string
                my $pluginString = \
"'Users=status,any;email,$email;replace_relations,Nobody'";
                my $plugin = new RTx::Shredder::Plugin;
                my( $status, $msg ) = $plugin->LoadByString( $pluginString );
                unless( $status ) {
                        print STDERR "Couldn't load plugin: $msg\n";
                        exit(1);
                }
        }
}
else{
        exit;
}
</snip>

One problem I can already see with the above snippet is that Shredder is called
seperately for each email address.  How do I set this up to run as one
continuous execution for the entire array of addresses?
You can use $shredder->PutObject and put sever users' objects into
shredder and then $shredder->WipeoutAll.


Any and all help will be greatly appreciated.

Mathew
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com



--
Best regards, Ruslan.
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com

Reply via email to