Hi!

I try to ask again, because on my producton system it takes a very long
time to limit users (7 Minutes !!! per user :-(( ).

I try to search for users with no connections to any ticket and no
connection to any attachments to delete them later.

I can't use rt-shredder directly ;-)

I try this:

...
my $user  = RT::User->new($RT::SystemUser);
my $users = RT::Users->new($RT::SystemUser);
my $tix   = RT::Tickets->new($RT::SystemUser);


$users->FindAllRows ;

while (my $uid = $users->next ) {
 my $tickets   = RT::Tickets->new($RT::SystemUser);
 $user->Load($uid);
 $tickets->FromSQL('
    Type = "ticket" AND
    Watcher ="'.$user->EmailAddress.'"');

  Delete_User if ! $tickets->Count();
...



But it takes much time (about 7 minutes per user )
in my system for every user.

~500.000 tickets
~ 61.100 users

Is there a better method to limit the user with no tickets and no
attachments or what am I doing wrong?

Cheers,
  Björn

--------
Final RT training for 2012 in Atlanta, GA - October 23 & 24
  http://bestpractical.com/training

We're hiring! http://bestpractical.com/jobs

Reply via email to