Putting 4.2.0 on top of 4.0.17
[usit-rt.git] / etc / upgrade / 4.0.9 / content
CommitLineData
af59614d
MKG
1use strict;
2use warnings;
3
4our @Initial = (
01e3b242 5 sub {
af59614d 6 RT->Logger->debug(
01e3b242
MKG
7 'Going to update empty Queue Lifecycle column to "default"');
8
9 my $queues = RT::Queues->new( RT->SystemUser );
10 $queues->FindAllRows;
11 $queues->Limit(
12 FIELD => 'Lifecycle',
13 OPERATOR => 'IS',
14 VALUE => 'NULL',
15 );
16
17 $queues->Limit(
18 FIELD => 'Lifecycle',
19 VALUE => '',
20 ENTRYAGGREGATOR => 'OR',
21 );
22
23 $queues->Limit(
24 FIELD => 'Lifecycle',
25 VALUE => 0,
26 ENTRYAGGREGATOR => 'OR',
27 );
28
29 while ( my $q = $queues->Next ) {
30 $q->SetLifecycle('default');
31 }
32 },
33 sub {
34 use strict;
35 my $groups = RT::Groups->new(RT->SystemUser);
36 $groups->Limit( FIELD => 'Domain',
37 OPERATOR => '=',
af59614d
MKG
38 VALUE => 'Personal',
39 CASESENSITIVE => 0,
01e3b242
MKG
40 );
41 $groups->LimitToDeleted;
42 while ( my $group = $groups->Next ) {
43 my $members = $group->MembersObj();
44 while ( my $member = $members->Next ) {
45 my ( $ok, $msg ) = $group->DeleteMember( $member->MemberId );
46 if ( !$ok ) {
af59614d 47 RT->Logger->warn( "Unable to remove group member "
01e3b242
MKG
48 . $member->id . ": "
49 . $msg );
50 }
51 }
52 $group->PrincipalObj->Delete;
53 $group->RT::Record::Delete();
54 }
55 },
56);