Further RTx::Shredder Errors

From this

RTx::Shredder::Init( force => 1 );
my $shredder = new RTx::Shredder(RT::SystemUser);
if ($ans =~ m/^(y|yes)$/i){

my ($fname, $fh) = $shredder->SetFile( FromStorage => 0, FileName =>

�/usr/local/rt-3.6.1/var/data/RTx-Shredder/Shredder-Users_XXXX.sql� );
my $email;
foreach $email (@emails){
my $user = new RT::User(RT::SystemUser);
$user->LoadByEmail($email);
next unless $user->id;
$shredder->PutObject(Object => $user);
}
$shredder->WipeoutAll;

system "/usr/local/rt-3.6.1/local/sbin/rtx-shredder --force

–plugin ‘Users=status,any;email,$email;replace_relations,Nobody’“;
system(”/usr/local/rt-3.6.1/local/sbin/rtx-shredder",“–force”,“–plugin”,“Users=status,any;email,$email;replace_relations,Nobody”);
}

I get this

[Wed Feb 21 08:44:20 2007] [crit]: Couldn’t wipeout object: Couldn’t find
resolver for dependency ‘RT::User-240410 (depends on,resolvable dependency)
RT::Attachment-270285’ at /usr/local/rt-3.6.1/local/lib/RTx/Shredder.pm line
393. (/usr/local/rt-3.6.1/lib/RT.pm:317)
Couldn’t wipeout object: Couldn’t find resolver for dependency ‘RT::User-240410
(depends on,resolvable dependency) RT::Attachment-270285’ at
/usr/local/rt-3.6.1/local/lib/RTx/Shredder.pm line 393.

Can someone shed some light on why this is failing?

Also, the above, commented-out line regarding SetFile produces this

Unrecognized character \xE2 at ./delete_spam_users.pl line 91

I don’t know what the \xE2 is as I couldn’t find anything on Google about it.

Mathew

I’m looking through the code for Shredder.pm trying to figure this out. I see a
PutResolver method as well as ApplyResolver method. However, I’m coming up
short on how to tell it what to use as the dependency resolver. Using the CLI I
would run
rtx-shredder --force --plugin
‘Users=status,any;email,address;replace_relations,Nobody’

How do I fit this in using the API?

Mathew

Mathew Snyder wrote:

I think I’m making progress. This is what I now have

RTx::Shredder::Init( force => 1 );
my $shredder = new RTx::Shredder(RT::SystemUser);
my $resolver = new RTx::Shredder::Plugin::Users(RT::SystemUser);
if ($ans =~ m/^(y|yes)$/i){
my ($fname, $fh) = $shredder->SetFile( FromStorage => 0, FileName =>
’/usr/local/rt-3.6.1/var/data/RTx-Shredder/Shredder-Users_XXXX.sql’ );
my $email;
foreach $email (@emails){
my $user = new RT::User(RT::SystemUser);
$user->LoadByEmail($email);
next unless $user->id;
$resolver->SetResolver(Shredder => 10);
$shredder->PutObject(Object => $user);
}
$shredder->WipeoutAll;
}else{
exit;
}

Now, instead of getting an error regarding resolvers, I am getting

[crit]: Odd number of elements in anonymous hash at
/usr/local/rt-3.6.1/local/lib/RTx/Shredder/Plugin/Base.pm line 23.
(/usr/local/rt-3.6.1/lib/RT.pm:317)
Odd number of elements in anonymous hash at
/usr/local/rt-3.6.1/local/lib/RTx/Shredder/Plugin/Base.pm line 23.

Looking at some of the code in there I think I should be using $resolver to
establish the “replace_relations” bit and then fitting that into the $shredder
somehow. Any thoughts?

Mathew

Mathew Snyder wrote:

Look into the User plugin, it sets resolver for these dependencies.On 2/22/07, Mathew Snyder theillien@yahoo.com wrote:

I think I’m making progress. This is what I now have

RTx::Shredder::Init( force => 1 );
my $shredder = new RTx::Shredder(RT::SystemUser);
my $resolver = new RTx::Shredder::Plugin::Users(RT::SystemUser);
if ($ans =~ m/^(y|yes)$/i){
my ($fname, $fh) = $shredder->SetFile( FromStorage => 0, FileName =>
‘/usr/local/rt-3.6.1/var/data/RTx-Shredder/Shredder-Users_XXXX.sql’ );
my $email;
foreach $email (@emails){
my $user = new RT::User(RT::SystemUser);
$user->LoadByEmail($email);
next unless $user->id;
$resolver->SetResolver(Shredder => 10);
$shredder->PutObject(Object => $user);
}
$shredder->WipeoutAll;
}else{
exit;
}

Now, instead of getting an error regarding resolvers, I am getting

[crit]: Odd number of elements in anonymous hash at
/usr/local/rt-3.6.1/local/lib/RTx/Shredder/Plugin/Base.pm line 23.
(/usr/local/rt-3.6.1/lib/RT.pm:317)
Odd number of elements in anonymous hash at
/usr/local/rt-3.6.1/local/lib/RTx/Shredder/Plugin/Base.pm line 23.

Looking at some of the code in there I think I should be using $resolver to
establish the “replace_relations” bit and then fitting that into the $shredder
somehow. Any thoughts?

Mathew

Mathew Snyder wrote:

From this

RTx::Shredder::Init( force => 1 );
my $shredder = new RTx::Shredder(RT::SystemUser);
if ($ans =~ m/^(y|yes)$/i){

my ($fname, $fh) = $shredder->SetFile( FromStorage => 0, FileName =>

‘/usr/local/rt-3.6.1/var/data/RTx-Shredder/Shredder-Users_XXXX.sql’ );
my $email;
foreach $email (@emails){
my $user = new RT::User(RT::SystemUser);
$user->LoadByEmail($email);
next unless $user->id;
$shredder->PutObject(Object => $user);
}
$shredder->WipeoutAll;

system "/usr/local/rt-3.6.1/local/sbin/rtx-shredder --force

–plugin ‘Users=status,any;email,$email;replace_relations,Nobody’";

system(“/usr/local/rt-3.6.1/local/sbin/rtx-shredder”,“–force”,“–plugin”,“Users=status,any;email,$email;replace_relations,Nobody”);
}

I get this

[Wed Feb 21 08:44:20 2007] [crit]: Couldn’t wipeout object: Couldn’t find
resolver for dependency ‘RT::User-240410 (depends on,resolvable dependency)
RT::Attachment-270285’ at /usr/local/rt-3.6.1/local/lib/RTx/Shredder.pm line
393. (/usr/local/rt-3.6.1/lib/RT.pm:317)
Couldn’t wipeout object: Couldn’t find resolver for dependency ‘RT::User-240410
(depends on,resolvable dependency) RT::Attachment-270285’ at
/usr/local/rt-3.6.1/local/lib/RTx/Shredder.pm line 393.

Can someone shed some light on why this is failing?

Also, the above, commented-out line regarding SetFile produces this

Unrecognized character \xE2 at ./delete_spam_users.pl line 91

I don’t know what the \xE2 is as I couldn’t find anything on Google about it.

Mathew


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

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


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

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

Best regards, Ruslan.

I’m not seeing what you mean. Under the Shredder/Plugin directory is
Users.pm which holds the SetResolver method. This calls the PutResolver
method (I don’t know where the PutResolver method is found). However,
User.pm which is in the Shredder directory (Not in the Shredder/Plugin
directory) has nothing I recognize as relating to this. How should I be
using User.pm?

Mathew

Ruslan Zakirov wrote:

I have been looking at this and still haven’t figured out what I need to change
to make it work. Ruslan mentioned the User plugin. There’s a Users plugin but
no singular. the User.pm file under the Shredder directory has no method for
setting the resolver as far as I can tell. User.pm under the Plugin directory
has the SetResolver method though. I used it but I guess I haven’t used it
correctly.

Can someone help me out please?

Mathew

Mathew Snyder wrote: