[rt-users] Simple RT script makes Mysql Server go away
Todd Chapman
todd at chaka.net
Mon Sep 28 15:23:53 EDT 2009
All,
I am customizing RT to add an attribute to transactions that meet
certain criteria. The script below is meant to update all the existing
transactions but after a while the Mysal server goes away. Is there
anything obvious about the script causing this? Thanks!
#!/opt/perl/bin/perl
use strict;
use warnings;
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;
use RT::Transactions;;
RT::LoadConfig();
RT::Init();
my $last = 1;
for my $id ( (500_000, 1_000_000, 1_500_000, 2_000_000, 2_500_000,
3_000_000, 3_500_000, 4_000_000, 4_500_000,
5_000_000, 5_500_000, 6_000_000, 6_500_000, 7_000_000,
7_500_000, 8_000_000, 8_500_000, 9_000_000,
9_500_000, 10_000_000) ) {
my $transactions = RT::Transactions->new( $RT::SystemUser );
$transactions->Limit( FIELD => 'ObjectType', VALUE => "RT::Ticket" );
$transactions->Limit( FIELD => 'Type', VALUE => "EmailRecord" );
$transactions->Limit( FIELD => 'id', VALUE => $last, OPERATOR => ">=" );
$transactions->Limit( FIELD => 'id', VALUE => $id, OPERATOR =>
"<", ENTRYAGGREGATOR => "AND" );
while (my $trans = $transactions->Next) {
my $ticket = $trans->Object;
if ( $ticket->RequestorIsExternal ) {
$trans->SetAttribute( Name => "ExternalEmail", Content => 1);
}
}
$last = $id;
}
More information about the rt-users
mailing list