[vhffs-dev] [svn] commit: r275 - in /trunk: vhffs-api/src/Vhffs/Services/Repository.pm vhffs-backend/conf/vhffs.conf

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


Author: gradator
Date: Wed Nov  1 00:41:04 2006
New Revision: 275

Log:
Default quota for repositories is now configurable


Modified:
    trunk/vhffs-api/src/Vhffs/Services/Repository.pm
    trunk/vhffs-backend/conf/vhffs.conf

Modified: trunk/vhffs-api/src/Vhffs/Services/Repository.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Repository.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Repository.pm Wed Nov  1 00:41:04 2006
@@ -92,6 +92,8 @@
 sub create
 {
 	my $self = shift;
+	my $conf;
+	my $quota;
 
 	return -2 if ( $self->{'user'}->fetch < 0 );
 	return -3 if ( $self->{'group'}->fetch < 0 );
@@ -120,9 +122,13 @@
 	$repository_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] );
 	$repository_id++;
 
+	#Quota
+	$conf = $self->{'main'}->get_config->get_service("repository");
+	$quota = 100;
+	$quota = $conf->{'default_quota'} if( ( defined $conf ) && ( defined $conf->{'default_quota'} ) );
 
 	#Finally, create the object
-	my $text = "INSERT INTO vhffs_repository VALUES( '".$repository_id."' , '".$self->{'name'} . "','".$self->{'user'}->get_uid."','".$self->{'group'}->get_gid."' , '1000' , '0' , '".$self->{'object_id'}."' )";
+	my $text = "INSERT INTO vhffs_repository VALUES( '".$repository_id."' , '".$self->{'name'} . "','".$self->{'user'}->get_uid."','".$self->{'group'}->get_gid."' , '".$quota."' , '0' , '".$self->{'object_id'}."' )";
 	$request = $self->{'db'}->{'DB_WRITE'}->prepare( $text );
 	$request->execute or return -2;
 

Modified: trunk/vhffs-backend/conf/vhffs.conf
==============================================================================
--- trunk/vhffs-backend/conf/vhffs.conf (original)
+++ trunk/vhffs-backend/conf/vhffs.conf Wed Nov  1 00:41:04 2006
@@ -301,6 +301,7 @@
 	#Configuration of download repository
 	<repository>
 		repository_url	=	"http://download.vhffs.org/";
+		default_quota	=	1024
 	</repository>
 </services>
 




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