[vhffs-dev] [svn] commit: r106 - in /trunk: vhffs-api/src/Vhffs/Robots/User.pm vhffs-robots/src/create_homes.pl

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


Author: soda
Date: Fri Dec  9 18:49:02 2005
New Revision: 106

Log:
fix bugs


Modified:
    trunk/vhffs-api/src/Vhffs/Robots/User.pm
    trunk/vhffs-robots/src/create_homes.pl

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 Fri Dec  9 18:49:02 2005
@@ -91,8 +91,6 @@
 	$main = shift;
 	$user = shift;
 
-	$user = new Vhffs::User( $main , $username , '401');
-	
 	if( $user->fetch > 0 )
 	{
 		$user->add_history( "Ok, robots take now the creation of the user" );
@@ -120,7 +118,14 @@
 		my $content = sprintf("Hello %s %s, Welcome on VHFFS\n\nHere are your login information :\nUser: %s\nPassword: %s\n\nVHFFS Administrators\n", $user->get_firstname, $user->get_lastname, $user->get_username, $plainpassword );
 		$user->send_mail( $subject, $content );
 
-		$user->commit;
+		if( $user->commit < 0 )
+		{
+			return -1;
+		}
+		else
+		{
+			return 1;
+		}
 	}
 
 	return 1;

Modified: trunk/vhffs-robots/src/create_homes.pl
==============================================================================
--- trunk/vhffs-robots/src/create_homes.pl (original)
+++ trunk/vhffs-robots/src/create_homes.pl Fri Dec  9 18:49:02 2005
@@ -6,21 +6,25 @@
 use Vhffs::Robots;
 use Vhffs::Main;
 
-lock;
+Vhffs::Robots::lock;
 
 my $main = init Vhffs::Main;
-my $users = Vhffs::User::getall( $main , Vhffs::Constants::WAITING_FOR_CREATION , undef );
+my $users = Vhffs::User::getall( $main , Vhffs::Constants::WAITING_FOR_CREATION , undef , undef );
 my $user;
 
 foreach $user ( @{$users} )
 {
 	if( Vhffs::Robots::User::create_home( $main , $user ) < 0 )
 	{
-		print sprintf( "Error while creating home for %s\n" , $user->get_username);
+		Vhffs::Robots::vhffs_log( sprintf( "Error while creating home for %s" , $user->get_username) );
+	}
+	else
+	{
+		Vhffs::Robots::vhffs_log( sprintf( "Creating home/account for %s" , $user->get_username) );
 	}
 }
 
-unlock();
+Vhffs::Robots::unlock();
 
 exit 0;
 




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