[vhffs-dev] [1982] removed Vhffs::Functions::hash_groupname()

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1982
Author:   gradator
Date:     2012-01-31 20:27:45 +0100 (Tue, 31 Jan 2012)
Log Message:
-----------
removed Vhffs::Functions::hash_groupname()

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Functions.pm
    trunk/vhffs-api/src/Vhffs/Robots/Group.pm
    trunk/vhffs-api/src/Vhffs/Robots.pm

Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm	2012-01-30 23:56:07 UTC (rev 1981)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm	2012-01-31 19:27:45 UTC (rev 1982)
@@ -359,21 +359,6 @@
     return( $path );
 }
 
-
-sub hash_groupname
-{
-    my ( $chain , $path , $main );
-    $chain = shift;
-    $main = shift;
-        
-    return undef if( ! defined $main->get_config->get_datadir );
-
-    $path = $main->get_config->get_datadir. "/groups/" . substr( $chain , 0 , 1 ) . "/" . substr( $chain , 1 , 1 ) . "/" . $chain;    
-
-    return( $path );
-}
-
-
 sub valid_mail
 {
 	my $mail = shift;

Modified: trunk/vhffs-api/src/Vhffs/Robots/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Group.pm	2012-01-30 23:56:07 UTC (rev 1981)
+++ trunk/vhffs-api/src/Vhffs/Robots/Group.pm	2012-01-31 19:27:45 UTC (rev 1982)
@@ -47,19 +47,20 @@
 	return undef unless ( defined $main && defined $group );
 
 	my $user = Vhffs::User::get_by_uid( $main , $group->get_owner_uid );
-	my $hash = Vhffs::Functions::hash_groupname( $group->get_groupname , $main );	
+	my $dir = $group->get_dir;
 	$group->add_history('Ok, Robots is going to create the directory');
-	Vhffs::Functions::create_dir( $hash );
+	Vhffs::Functions::create_dir( $dir );
+	chown( $group->get_owner_uid , $group->get_gid , $dir );
+	chmod( 02770 , $dir );
 	$group->add_history('Ok, Robots finished the creation of the directory');
-	chown( $group->get_owner_uid , $group->get_gid , $hash );
-	chmod( 02770 , $hash );
 	add_user( $user , $group , $main );
 	$group->set_status( Vhffs::Constants::ACTIVATED );
 	$group->commit;
-	return $hash;
+	return $dir;
 }
 
 
+# TODO : remove system()
 sub delete_groupdir
 {
 	my $main = shift;
@@ -68,13 +69,10 @@
 	return undef unless ( defined $main && defined $group );
 
 	my $dir = $group->get_dir;
-	Vhffs::Robots::archive_targz( $group, $dir );
-
-	my $user = Vhffs::User::get_by_uid( $main , $group->get_owner_uid );
-	my $hash = Vhffs::Functions::hash_groupname( $group->get_groupname , $main );	
-	if( -d $hash )
+	if( -d $dir )
 	{
-		my $cmd = "rm -rf $hash";
+		Vhffs::Robots::archive_targz( $group, $dir );
+		my $cmd = "rm -rf $dir";
 		system( $cmd );
 	}
 	return 0;
@@ -160,8 +158,9 @@
 	return -1 if( ! defined $group );
 
 	unless( $main->get_config->use_vhffsfs )  {
-		my $path = $user->get_home . "/" . $group->get_groupname;
-		symlink( Vhffs::Functions::hash_groupname( $group->get_groupname , $main ) , $path );
+		my $groupdir = $group->get_dir;
+		my $path = $user->get_home.'/'.$group->get_groupname;
+		symlink( $groupdir, $path );
 	}
 	$group->add_history("The user ".$user->get_username." join the group");
 	$user->add_history("The user ".$user->get_username." join the group");

Modified: trunk/vhffs-api/src/Vhffs/Robots.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots.pm	2012-01-30 23:56:07 UTC (rev 1981)
+++ trunk/vhffs-api/src/Vhffs/Robots.pm	2012-01-31 19:27:45 UTC (rev 1982)
@@ -117,9 +117,7 @@
 
 	return 1 if( $main->get_config->use_vhffsfs );
 
-	my $path = Vhffs::Functions::hash_groupname( $group->get_groupname , $main )."/".$linkname;
-
-	return -1 if ( symlink( $dir , $path ) == 0 );
+	return -1 if ( symlink( $dir , $group->get_dir.'/'.$linkname ) == 0 );
 	
 	return 1;
 }
@@ -135,9 +133,7 @@
 
 	return 1 if( $main->get_config->use_vhffsfs );
 
-	my $path = Vhffs::Functions::hash_groupname( $group->get_groupname , $main )."/".$linkname;
-
-	return -1 if ( unlink(  $path ) == 0 );
+	return -1 if ( unlink( $group->get_dir.'/'.$linkname ) == 0 );
 	
 	return 1;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/