[Jifty-commit] r4000 - in apps/CASPlus/trunk: lib/CASPlus

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Aug 29 12:49:38 EDT 2007


Author: sterling
Date: Wed Aug 29 12:49:38 2007
New Revision: 4000

Modified:
   apps/CASPlus/trunk/   (props changed)
   apps/CASPlus/trunk/lib/CASPlus/ProfileRelationshipMixin.pm

Log:
 r8966 at riddle:  andrew | 2007-08-25 19:36:17 -0500
 Switching profile relationships to use the remove_relationship() helper.


Modified: apps/CASPlus/trunk/lib/CASPlus/ProfileRelationshipMixin.pm
==============================================================================
--- apps/CASPlus/trunk/lib/CASPlus/ProfileRelationshipMixin.pm	(original)
+++ apps/CASPlus/trunk/lib/CASPlus/ProfileRelationshipMixin.pm	Wed Aug 29 12:49:38 2007
@@ -132,47 +132,12 @@
         my ($child, $relationship, $parent) 
             = @{ delete $self->{__delete_relationship} };
 
-        # Create abbreviated names for the IDs in the cache path
-        my $cid = $self->child->unique_id;
-        my $rid = $relationship->id;
-        my $pid = $self->parent->unique_id;
-
-        # Build the cache path matcher
-        my $cache_path = ":$cid:\@$rid:$pid:";
-
-        # Load the cache paths that are affected
-        my $cache_paths = CASPlus::Model::RoleMemberPathCacheCollection->new;
-        $cache_paths->limit(
-            column   => 'cache_path',
-            operator => 'MATCHES',
-            value    => $cache_path,
+        # Remove the relationship
+        CASPlus::Util::Relationship->remove_relationship(
+            child        => $child,
+            relationship => $relationship,
+            parent       => $parent,
         );
-
-        # Delete them, these are all removed
-        while (my $path_cache = $cache_paths->next) {
-            $path_cache->delete;
-        }
-
-        # Load the role memberships that now have an empty cache path
-        my $role_members = CASPlus::Model::RoleMemberCollection->new;
-        $cache_paths = $role_members->join(
-            column1 => 'id',
-            table2  => 'CASPlus::Model::RoleMemberPathCache',
-            column2 => 'role_member',
-        );
-        $role_members->group_by({
-            column => 'id',
-        });
-        $cache_paths->limit(
-            'column'   => 'cache_path',
-            'function' => 'COUNT',
-            'value'    => 0,
-        );
-
-        # Delete these role memberships, they no longer hold
-        while (my $role_member = $role_members->next) {
-            $role_member->delete;
-        }
     }
 
     # Delete wasn't carried out, but still clear the cached info


More information about the Jifty-commit mailing list