[vhffs-dev] [svn] commit: r84 - in trunk: debian/ vhffs-api/src/Vhffs/ vhffs-api/src/Vhffs/Panel/ vhffs-api/src/Vhffs/Robots/ vhffs-api/src/Vhffs/Services/ vhffs-panel/ vhffs-panel/public/ vhffs-robots/src/ vhffs-tools/src/

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


Author: soda
Date: Mon Aug  1 23:53:42 2005
New Revision: 84

Log:
Add some modifications :)


Added:
    trunk/debian/vhffs-tools.manpages
    trunk/vhffs-robots/src/create_dns.pl   (with props)
    trunk/vhffs-robots/src/delete_dns.pl   (with props)
    trunk/vhffs-tools/src/vhffs-groupdel   (with props)
    trunk/vhffs-tools/src/vhffs-groupinfo   (with props)
    trunk/vhffs-tools/src/vhffs-userdel   (with props)
    trunk/vhffs-tools/src/vhffs-usermod   (with props)
Modified:
    trunk/vhffs-api/src/Vhffs/Object.pm
    trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm
    trunk/vhffs-api/src/Vhffs/Robots/DNS.pm
    trunk/vhffs-api/src/Vhffs/Robots/Group.pm
    trunk/vhffs-api/src/Vhffs/Robots/User.pm
    trunk/vhffs-api/src/Vhffs/Robots/Web.pm
    trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
    trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm
    trunk/vhffs-api/src/Vhffs/Services/Mailing.pm
    trunk/vhffs-api/src/Vhffs/User.pm
    trunk/vhffs-panel/public/index.pl
    trunk/vhffs-panel/show_code.pl
    trunk/vhffs-robots/src/delete_cvs.pl
    trunk/vhffs-robots/src/delete_group.pl
    trunk/vhffs-robots/src/delete_mail.pl
    trunk/vhffs-robots/src/delete_ml.pl
    trunk/vhffs-robots/src/delete_users.pl
    trunk/vhffs-robots/src/delete_web.pl
    trunk/vhffs-tools/src/vhffs-userinfo

Modified: trunk/vhffs-api/src/Vhffs/Object.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Object.pm Mon Aug  1 23:53:42 2005
@@ -77,6 +77,10 @@
 
 
     $query = "DELETE FROM vhffs_acl WHERE oid_dst='".$self->{'object_id'}."'";
+    $request = $self->{'db'}->{'DB_WRITE'}->prepare($query);
+    $request->execute or return -2;
+    
+	$query = "DELETE FROM vhffs_acl WHERE oid_src='".$self->{'object_id'}."'";
     $request = $self->{'db'}->{'DB_WRITE'}->prepare($query);
     $request->execute or return -2;
 

Modified: trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm Mon Aug  1 23:53:42 2005
@@ -38,8 +38,8 @@
 	return undef if( $request->execute == 0 );
 	$result		= $request->fetchrow_arrayref;
 	$cid		= $result->[0];
-	@ret[0]		= $cid;
-	@ret[1]		= $code;
+	$ret[0]		= $cid;
+	$ret[1]		= $code;
 	return( \@ret );
 }
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/DNS.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/DNS.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Robots/DNS.pm Mon Aug  1 23:53:42 2005
@@ -34,19 +34,6 @@
 	return( $request->fetchall_hashref('domain') );
 }
 
-sub create_domain
-{
-	my ( $ns ) = shift;
-
-	
-	if( $ns->fetch > 0 )
-	{
-		$ns->set_status( Vhffs::Constants::ACTIVATED );	
-		$ns->activate;
-		$ns->commit;
-	}
-}
-
 
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/Robots/Group.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Group.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Robots/Group.pm Mon Aug  1 23:53:42 2005
@@ -72,7 +72,7 @@
 		my $hash = Vhffs::Functions::hash_groupname( $group->get_groupname , $main );	
 		if( -d $hash )
 		{
-			my $cmd = "rmdir $hash ";
+			my $cmd = "rmdir  $hash ";
 			system( $cmd );
 		}
 	}
@@ -164,67 +164,6 @@
 {
 	my $vhffs = shift;
 	my $group = shift;
-	my $objects;
-	use Vhffs::Services::Cvs;
-	use Vhffs::Services::DNS;
-	use Vhffs::Services::Httpd;
-	use Vhffs::Services::Mailing;
-	use Vhffs::Services::Mail;
-	use Vhffs::Services::Mysql;
-	use Vhffs::Services::Postgres;
-	use Vhffs::Services::Svn;
-	
-	use Vhffs::Robots::Svn;
-	use Vhffs::Robots::Cvs;
-	use Vhffs::Robots::DNS;
-	use Vhffs::Robots::Web;
-	use Vhffs::Robots::Postgres;
-	use Vhffs::Robots::Mysql;
-	use Vhffs::Robots::Mail;
-	use Vhffs::Robots::Mailinglist;
-
-#	$objects = Vhffs::Services::Cvs::getall( $vhffs , undef , undef , $group );
-#	foreach ( @{$objects} )
-#	{
-#		Vhffs::Robots::Cvs::delete_cvs( $_ );
-#		$_->delete;
-#	}
-
-	$objects = Vhffs::Services::Svn::getall( $vhffs , undef , undef , $group );
-	foreach ( @{$objects} )
-	{
-		Vhffs::Robots::Cvs::delete_repo( $_ );
-		$_->delete;
-	}
-
-#	$objects = Vhffs::Services::DNS::getall( $vhffs , undef , undef , $group );
-#	foreach ( @{$objects} )
-#	{
-#		$_->delete;
-#	}
-
-#	$objects = Vhffs::Services::Mysql::getall( $vhffs , undef , undef , $group );
-#	foreach ( @{$objects} )
-#	{
-	#	Vhffs::Robots::Mysql::delete_db( $vhffs , $_->get_dbname ); 
-#		$_->delete;
-#	}
-
-	#$objects = Vhffs::Services::Postgres::getall( $vhffs , undef , undef , $group );
-#	foreach ( @{$objects} )
-#	{
-	#	Vhffs::Robots::Postgres::delete_db( $vhffs , $_->get_dbname ); 
-#		$_->delete;
-#	}
-
-
-	$objects = Vhffs::Services::Httpd::getall( $vhffs , undef , undef , $group );
-#	foreach ( @{$objects} )
-#	{
-#		Vhffs::Robots::Web::delete_web( $vhffs , $_->get_servername ); 
-#		$_->delete;
-#	}
-
 	my $users = $group->get_users;
 	my $user;
 	foreach $user ( @{$users} )
@@ -233,7 +172,7 @@
 	}
 
 	delete_groupdir( $vhffs , $group );
-
+	$group->delete;
 }
 
 

Modified: trunk/vhffs-api/src/Vhffs/Robots/User.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/User.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Robots/User.pm Mon Aug  1 23:53:42 2005
@@ -40,9 +40,10 @@
 
 sub delete
 {
+	my $vhffs = shift;
 	my $user = shift;
 	return if( $user->fetch < 0 );
-	delete_home( $user->{'main'} , $user->get_username );
+	delete_home( $vhffs , $user );
 }
 
 
@@ -51,9 +52,8 @@
 {
 	my( $main , $username , $user , $homedir , @subdirs , $path , $value );
 
-	( $main , $username ) = @_;
-
-	$user = new Vhffs::User( $main , $username , '401');
+	$main = shift;
+	$user = shift;
 	
 	if( $user->fetch > 0 )
 	{

Modified: trunk/vhffs-api/src/Vhffs/Robots/Web.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Web.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Robots/Web.pm Mon Aug  1 23:53:42 2005
@@ -91,19 +91,19 @@
 }
 
 
-sub delete_web
+sub delete
 {
 	use Vhffs::Group;
 
-	my( $main , $servername );
+	my( $main , $web );
+	$main = shift;
+	$web = shift;
 
-	( $main , $servername ) = @_;
 
-	$web = new Vhffs::Services::Httpd( $main , $servername , '401');
 	my $dir;	
 	if( $web->fetch > 0 )
 	{
-		$web->add_history( "Ok, the robot take the creation of this object. Web directory will be created");
+		$web->add_history( "Ok, the robot will delete this object. Web directory will be removed");
 		my $hash = Vhffs::Functions::hash_webdir( $web->get_servername );
 
 		return -1 if( ( ! defined $hash ) || ( length( $hash ) < 2 ) );

Modified: trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Cvs.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Cvs.pm Mon Aug  1 23:53:42 2005
@@ -190,7 +190,7 @@
 
     $query = "SELECT c.cvsroot, c.object_id FROM  vhffs_cvs c, vhffs_object o WHERE c.object_id = o.object_id";
 	$query.= " AND o.state='".$state."'" if( defined $state );
-	$query.= " AND c.cvsroot LIKE '%".$state."%'" if( defined $state );
+	$query.= " AND c.cvsroot LIKE '%".$name."%'" if( defined $name );
 	$query.= " AND c.owner_gid='".$group->get_gid."'" if( defined $group );
     $query .= " ORDER BY c.cvsroot";
     $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query );

Modified: trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Httpd.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Httpd.pm Mon Aug  1 23:53:42 2005
@@ -49,12 +49,15 @@
 sub delete
 {
     my $self = shift;
-
+	print "suppression de la partie web\n";
     my $query = "DELETE FROM vhffs_httpd WHERE object_id='".$self->{'object_id'}."'";
     my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query);
     $request->execute or return -1;
 	
+	print "finish\n";
+	print "object\n";
 	return -2 if( $self->SUPER::delete < 0 );
+	print "finish\n";
 
 	return 1;
 }
@@ -98,7 +101,6 @@
 sub fetch
 {
 	my $self = shift;
-
 	my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_httpd where servername='".$self->{'servername'}."'") or return -1;
 
     my $rows = $request->execute() or return -3;

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm Mon Aug  1 23:53:42 2005
@@ -52,9 +52,12 @@
 sub delete
 {
     my $self = shift;
-
-    my $query = "DELETE FROM vhffs_mxdomain WHERE object_id='".$self->{'object_id'}."'";
-    my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query);
+	my $query;
+	my $request;
+
+
+    $query = "DELETE FROM vhffs_mxdomain WHERE object_id='".$self->{'object_id'}."'";
+    $request = $self->{'db'}->{'DB_WRITE'}->prepare($query);
     $request->execute or return -1;
 
     $query = "DELETE FROM vhffs_boxes WHERE domain='".$self->{'domain'}."'";
@@ -64,6 +67,9 @@
     $query = "DELETE FROM vhffs_forward WHERE domain='".$self->{'domain'}."'";
     $request = $self->{'db'}->{'DB_WRITE'}->prepare($query);
     $request->execute or return -1;
+
+
+
 
 
     return -2 if( $self->SUPER::delete < 0 );

Modified: trunk/vhffs-api/src/Vhffs/Services/Mailing.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mailing.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Mailing.pm Mon Aug  1 23:53:42 2005
@@ -580,6 +580,7 @@
     my $state = shift;
     my $name = shift;
     my $group = shift;
+    my $domain = shift;
 
     my $query;
     return undef if( ! defined $vhffs );
@@ -588,6 +589,7 @@
 	$query .= " AND o.state='".$state."'" if( defined $state );
 	$query .= " AND ml.owner_gid='".$group->get_gid."'" if( defined $group );
     $query .= " AND ( ( local LIKE '%".$name."%' ) OR (domain LIKE '%".$name."'% ) )" if( defined $name );
+    $query .= " AND ( domain='".$domain."')" if( defined $domain );
 
     my $request = $vhffs->get_db_object->{'DB_WRITE'}->prepare( $query );
     my $rows = $request->execute() or return -3;

Modified: trunk/vhffs-api/src/Vhffs/User.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm (original)
+++ trunk/vhffs-api/src/Vhffs/User.pm Mon Aug  1 23:53:42 2005
@@ -380,7 +380,6 @@
 sub delete
 {
     my $request;
-    my $request2;
     my $self;
 
     $self = shift;
@@ -391,12 +390,16 @@
     return -1 if ( ! defined $self->{'uid'} );
     return -2 if ( $self->{'group'}->delete < 0 );
 
+
+    $request = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_panel_user_prefs WHERE uid='".$self->{'uid'}."'");
+    $request->execute() or return -2;
+
     $request = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_users WHERE uid='".$self->{'uid'}."'");
-    $request2 = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_user_group WHERE uid='".$self->{'uid'}."'");
-    
-
     $request->execute() or return -1;
-    $request2->execute() or return -2;
+
+    $request = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_user_group WHERE uid='".$self->{'uid'}."'");
+    $request->execute() or return -2;
+
     
 	$self->SUPER::delete;
 

Modified: trunk/vhffs-panel/public/index.pl
==============================================================================
--- trunk/vhffs-panel/public/index.pl (original)
+++ trunk/vhffs-panel/public/index.pl Mon Aug  1 23:53:42 2005
@@ -39,7 +39,7 @@
 
 
 $template->param( TEXT_LASTGROUPS => sprintf( gettext("Show me last groups on %s") , $hostname )  );
-$template->param( TEXT_ALLGROUPS => sprintf( gettext("Show me last groups on %s") , $hostname )  );
+$template->param( TEXT_ALLGROUPS => sprintf( gettext("Show me all groups on %s") , $hostname )  );
 $template->param( GROUPS_TITLE => gettext("Group public area")  );
 $template->param( TEXT_SEARCH_GROUP => gettext("Show me this group according to this username")  );
 

Modified: trunk/vhffs-panel/show_code.pl
==============================================================================
--- trunk/vhffs-panel/show_code.pl (original)
+++ trunk/vhffs-panel/show_code.pl Mon Aug  1 23:53:42 2005
@@ -1,7 +1,8 @@
 #!/usr/bin/perl -w
 
 use CGI;
-
+use GD;
+use GD::Text::Wrap;
 use Vhffs::Main;
 use Vhffs::Panel::Confirmation;
 
@@ -10,6 +11,11 @@
 my $cid;
 my $code;
 my $vhffs;
+my $gd;
+my $wp;
+my $black;
+my $white;
+my $blue;
 
 $cgi 		= new CGI;
 $vhffs		= init Vhffs::Main;	
@@ -17,5 +23,35 @@
 $cid 		= $cgi->param( "cid" );
 $code		= Vhffs::Panel::Confirmation::get_code( $vhffs , $cid );
 
-print CGI->header( -type=>"text/html", -charset=>"utf-8" );
-print $code;
+if(( ! ( defined $code )  ) || ( ! ( defined $cid ) ) )
+{
+	print CGI->header( -type=>"text/html", -charset=>"utf-8" );
+	print "cid error";
+	exit 1;
+}
+
+$gd = GD::Image->new(70,30);
+$white = $gd->colorAllocate(255,255,255);
+$black = $gd->colorAllocate(  0,  0,  0);
+$blue  = $gd->colorAllocate(127,127,255);
+
+#print "No colours: $black ", $gd->colorsTotal, "\n";
+    
+
+$wp = GD::Text::Wrap->new($gd,
+    width       => 70,
+    line_space  => 0,
+    color       => $black, 
+    text        => $code,
+);
+$wp->set(align => 'center');
+$wp->draw(0,5);
+$wp->set(para_space => 10, preserve_nl => 0);
+# Assume the user has set FONT_PATH or TTF_FONT_PATH
+#$wp->font_path('/usr/share/fonts/ttfonts');
+print CGI->header( -type=>"image/png" );
+
+binmode STDOUT ;
+print STDOUT $gd->png();
+
+close STDOUT;

Modified: trunk/vhffs-robots/src/delete_cvs.pl
==============================================================================
--- trunk/vhffs-robots/src/delete_cvs.pl (original)
+++ trunk/vhffs-robots/src/delete_cvs.pl Mon Aug  1 23:53:42 2005
@@ -15,8 +15,9 @@
 {
     if( ( defined $cvs ) && ( $cvs->fetch > 0 ))
     {
+		print "Will delete CVS repository " . $cvs->get_cvsroot . "\n";
         Vhffs::Robots::Cvs::delete_cvs( $cvs );
-	$cvs->delete;
+		$cvs->delete;
     }
 }
 

Modified: trunk/vhffs-robots/src/delete_group.pl
==============================================================================
--- trunk/vhffs-robots/src/delete_group.pl (original)
+++ trunk/vhffs-robots/src/delete_group.pl Mon Aug  1 23:53:42 2005
@@ -5,16 +5,114 @@
 use Vhffs::Main;
 use Vhffs::Group;
 use Vhffs::Constants;
-my $main = init Vhffs::Main;
-my $groups = Vhffs::Group::getall( $main , Vhffs::Constants::TO_DELETE );
+use Vhffs::Services::Cvs;
+use Vhffs::Services::DNS;
+use Vhffs::Services::Httpd;
+use Vhffs::Services::Mailing;
+use Vhffs::Services::Mail;
+use Vhffs::Services::Mysql;
+use Vhffs::Services::Postgres;
+use Vhffs::Services::Svn;
+
+my $vhffs = init Vhffs::Main;
+my $groups = Vhffs::Group::getall( $vhffs , Vhffs::Constants::TO_DELETE );
 my $group;
+my $objects;
+my $object;
+my $ok;
 
 foreach $group ( @{$groups} )
 {
-	my $user;
-	if( $group->fetch > 0 )
+	print "Will try to delete group ". $group->get_groupname . "\n";
+	$ok = 1;
+
+    $objects = Vhffs::Services::Cvs::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+    foreach $object ( @{$objects} )
+    {
+		printf "\tRemain cvs\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		$object->commit;
+    }
+
+    $objects = Vhffs::Services::Svn::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+    foreach $object ( @{$objects} )
+    {
+		printf "\tRemain svn\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		$object->commit;
+    }
+
+    $objects = Vhffs::Services::DNS::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+    foreach $object ( @{$objects} )
+    {
+		printf "\tRemain dns\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		$object->commit;
+    }
+
+    $objects = Vhffs::Services::Mysql::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+    foreach $object ( @{$objects} )
+    {
+		printf "\tRemain mysql\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		$object->commit;
+    }
+
+    $objects = Vhffs::Services::Postgres::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+   foreach $object ( @{$objects} )
+   {
+		printf "\tRemain postgres\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		$object->commit;
+   }
+
+
+    $objects = Vhffs::Services::Httpd::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+   foreach $object ( @{$objects} )
+   {
+		printf "\tRemain website\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		$object->commit;
+   }
+    
+	$objects = Vhffs::Services::Mailing::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+   foreach $object ( @{$objects} )
+   {
+		printf "\tRemain mailing-list\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		$object->commit;
+   }
+
+
+	$objects = Vhffs::Services::Mail::getall( $vhffs , undef , undef , $group );
+	$ok = 0 if( defined $objects );
+   foreach $object ( @{$objects} )
+   {
+		printf "\tRemain mail\n";
+        $object->set_status( Vhffs::Constants::TO_DELETE );
+		if( $object->commit < 0 )
+		{
+			print "error while commit this object\n";
+		}
+   }
+
+
+	if( $ok == 1 )
 	{
-		Vhffs::Robots::Group::delete( $main , $group );
+		printf "\tDelete group ". $group->get_groupname."\n";
+		Vhffs::Robots::Group::delete( $vhffs , $group );
 	}
+	else
+	{
+		printf "\tCannot delete group ". $group->get_groupname.", remain some services\n";
+	}
+
 }
 

Modified: trunk/vhffs-robots/src/delete_mail.pl
==============================================================================
--- trunk/vhffs-robots/src/delete_mail.pl (original)
+++ trunk/vhffs-robots/src/delete_mail.pl Mon Aug  1 23:53:42 2005
@@ -2,16 +2,34 @@
 
 
 use Vhffs::Robots::Mail;
+use Vhffs::Services::Mail;
+use Vhffs::Services::Mailing;
 use Vhffs::Main;
-use Data::Dumper;
 
 
 my $main = init Vhffs::Main;
-my $mails = Vhffs::Robots::Mail::get_all_mail_to_delete( $main );
+my $mails = Vhffs::Services::Mail::getall( $main , Vhffs::Constants::TO_DELETE );
+my $mail;
+my $lists;
+my $list;
+foreach $mail ( @{$mails} )
+{
+	print "Will try to delete mail domain ". $mail->get_domain."\n";
 
-
-foreach( keys %{$mails} )
-{
-	Vhffs::Robots::Mail::delete_mail( $main , $_ );
+    my $lists = Vhffs::Services::Mailing::getall( $main , undef , undef , undef , $mail->get_domain );
+	if( defined $lists )
+	{
+		print "\tRemains mailing-list for this domain\n";
+		foreach $list ( @{$lists} )
+		{
+			$list->set_status( Vhffs::Constants::TO_DELETE );
+			$list->commit;
+		}
+	}
+	else
+	{
+		print "\tDelete mail domain ". $mail->get_domain."\n";
+		$mail->delete;
+	}
 }
 

Modified: trunk/vhffs-robots/src/delete_ml.pl
==============================================================================
--- trunk/vhffs-robots/src/delete_ml.pl (original)
+++ trunk/vhffs-robots/src/delete_ml.pl Mon Aug  1 23:53:42 2005
@@ -11,6 +11,7 @@
 
 foreach $ml ( @{$mls} )
 {
+	print "Will delete mailing-list " . $ml->get_listname . "\n";
 	$ml->delete;
 }
 

Modified: trunk/vhffs-robots/src/delete_users.pl
==============================================================================
--- trunk/vhffs-robots/src/delete_users.pl (original)
+++ trunk/vhffs-robots/src/delete_users.pl Mon Aug  1 23:53:42 2005
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 
-use Vhffs::Robots::Cvs;
+use Vhffs::Robots::User;
 use Vhffs::User;
 use Vhffs::Constants;
 use Vhffs::Main;
@@ -11,13 +11,42 @@
 my $lol = Vhffs::User::getall( $main , Vhffs::Constants::TO_DELETE );
 my $user;
 my $groups;
+my $group;
 foreach $user ( @{$lol} )
 {
+	$ok = 1;
     if( ( defined $user ) && ( $user->fetch > 0 ))
     {
-		next if( defined $user->get_groups );
-        Vhffs::Robots::User::delete_user( $user );
-		$user->delete;
+		print "Suppression du user en cours".$user->get_username." \n";
+		$groups =  $user->get_groups;
+
+		if( defined $groups )
+		{
+			foreach $group ( @{$groups} )
+			{
+				print "\tSuppression du groupe : ". $group->get_groupname."\n";
+				#Vérification si le user possède encore des groupes. 
+				#Si il en possède, on ne supprime pas le user
+				#Et on mets les groups à supprimer
+				if( $group->get_owneruid == $user->get_uid )
+				{
+					$ok = 0;
+					$group->set_status( Vhffs::Constants::TO_DELETE );
+					$group->commit;
+				}
+			}
+		}
+		
+		if( $ok == 1 )
+		{
+			printf "\tSuppression du user\n";
+        	Vhffs::Robots::User::delete( $vhffs, $user );
+			$user->delete;
+		}
+		else
+		{
+			printf "\tUser encore actif, il reste des groupes\n";
+		}
     }
 }
 

Modified: trunk/vhffs-robots/src/delete_web.pl
==============================================================================
--- trunk/vhffs-robots/src/delete_web.pl (original)
+++ trunk/vhffs-robots/src/delete_web.pl Mon Aug  1 23:53:42 2005
@@ -2,16 +2,17 @@
 
 
 use Vhffs::Robots::Web;
+use Vhffs::Services::Httpd;
 use Vhffs::Main;
-use Data::Dumper;
+use Vhffs::Constants;
+
+my $main = init Vhffs::Main;
+my $webs = Vhffs::Services::Httpd::getall( $main , Vhffs::Constants::TO_DELETE );
+my $web;
 
 
-my $main = init Vhffs::Main;
-my $webs = Vhffs::Robots::Web::get_all_web_to_delete( $main );
-
-
-foreach( keys %{$webs} )
+foreach $web ( @{$webs} )
 {
-	Vhffs::Robots::Web::delete_web( $main , $_ );
+	Vhffs::Robots::Web::delete( $main , $web );
 }
 

Modified: trunk/vhffs-tools/src/vhffs-userinfo
==============================================================================
--- trunk/vhffs-tools/src/vhffs-userinfo (original)
+++ trunk/vhffs-tools/src/vhffs-userinfo Mon Aug  1 23:53:42 2005
@@ -2,6 +2,7 @@
 
 use Vhffs::User;
 use Vhffs::Main;
+use Vhffs::Functions;
 
 my $vhffs = init Vhffs::Main;
 
@@ -13,7 +14,7 @@
 {
 	foreach $user ( @{$users} )
 	{
-		print $user->get_username . "\t" . $user->get_firstname . "\t". $user->get_lastname . "\t" . $user->get_mail ."\n";
+		print $user->get_username . "\t" . $user->get_firstname . "\t". $user->get_lastname . "\t" . $user->get_mail . "\t" . $user->get_shell . "\t".Vhffs::Functions::hash_homename( $user->get_home , $vhffs)."\n";
 	}
 }
 else




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