[Rt-commit] rt branch, 4.0/remove-disabled-personal-groups, created. rt-4.0.8rc1-1-gdb2d5aa
Alex Vandiver
alexmv at bestpractical.com
Mon Oct 22 23:34:02 EDT 2012
The branch, 4.0/remove-disabled-personal-groups has been created
at db2d5aa187b8a12eed8f6ebb55c0e1831591ea93 (commit)
- Log -----------------------------------------------------------------
commit db2d5aa187b8a12eed8f6ebb55c0e1831591ea93
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Oct 22 13:29:24 2012 -0400
Remove even deleted Personal groups
These escaped the 3.9.2 upgrade step because RT::Groups assumes Disabled
= 0 on searches unless explicitly told otherwise.
diff --git a/etc/upgrade/4.0.9/content b/etc/upgrade/4.0.9/content
new file mode 100644
index 0000000..4042f01
--- /dev/null
+++ b/etc/upgrade/4.0.9/content
@@ -0,0 +1,25 @@
+ at Initial = (
+ sub {
+ use strict;
+ my $groups = RT::Groups->new(RT->SystemUser);
+ $groups->Limit( FIELD => 'Domain',
+ OPERATOR => '=',
+ VALUE => 'Personal'
+ );
+ $groups->LimitToDeleted;
+ while ( my $group = $groups->Next ) {
+ my $members = $group->MembersObj();
+ while ( my $member = $members->Next ) {
+ my ( $ok, $msg ) = $group->DeleteMember( $member->MemberId );
+ if ( !$ok ) {
+ $RT::Logger->warn( "Unable to remove group member "
+ . $member->id . ": "
+ . $msg );
+ }
+ }
+ $group->PrincipalObj->Delete;
+ $group->RT::Record::Delete();
+ }
+ },
+);
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list