[vhffs-dev] [737] Fixes svn unicity constraint, use a new way to store svn path in database (complete path).

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


Revision: 737
Author:   gradator
Date:     2007-07-30 22:37:19 +0000 (Mon, 30 Jul 2007)

Log Message:
-----------
Fixes svn unicity constraint, use a new way to store svn path in database (complete path).

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Services/Svn.pm
    trunk/vhffs-backend/src/pgsql/initdb.sql.in
    trunk/vhffs-panel/svn/create.pl
    trunk/vhffs-panel/templates/svn/create.tmpl


Modified: trunk/vhffs-api/src/Vhffs/Services/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Svn.pm	2007-07-30 21:56:24 UTC (rev 736)
+++ trunk/vhffs-api/src/Vhffs/Services/Svn.pm	2007-07-30 22:37:19 UTC (rev 737)
@@ -45,7 +45,7 @@
 
 sub check_name($) {
     my $name = shift;
-    return ($name =~ /^[a-z0-9]{3,64}$/);
+    return ($name =~ /^[a-z0-9]+\/[a-z0-9]{3,64}$/);
 }
 
 sub delete
@@ -268,7 +268,7 @@
     my $self = shift;
     return undef if( ! defined $self );
     
-    return( $self->{'main'}->get_config->get_datadir . "/svn/svnroot/" . $self->get_group->get_groupname . "/" . $self->get_reponame );
+    return( $self->{'main'}->get_config->get_datadir . "/svn/svnroot/" . $self->get_reponame );
 }
 
 

Modified: trunk/vhffs-backend/src/pgsql/initdb.sql.in
===================================================================
--- trunk/vhffs-backend/src/pgsql/initdb.sql.in	2007-07-30 21:56:24 UTC (rev 736)
+++ trunk/vhffs-backend/src/pgsql/initdb.sql.in	2007-07-30 22:37:19 UTC (rev 737)
@@ -275,7 +275,7 @@
 ALTER TABLE vhffs_pgsql ADD CONSTRAINT vhffs_pgsql_unique_dbname UNIQUE (dbname);
 ALTER TABLE vhffs_pgsql ADD CONSTRAINT vhffs_pgsql_unique_dbuser UNIQUE (dbuser);
 ALTER TABLE vhffs_repository ADD CONSTRAINT vhffs_repository_unique_name UNIQUE (name);
-ALTER TABLE vhffs_svn ADD CONSTRAINT vhffs_svn_unique_reponame_per_owner UNIQUE (owner_gid, reponame);
+ALTER TABLE vhffs_svn ADD CONSTRAINT vhffs_svn_unique_reponame_per_owner UNIQUE (reponame);
 ALTER TABLE vhffs_dns ADD CONSTRAINT vhffs_dns_unique_domain UNIQUE (domain);
 ALTER TABLE vhffs_ml ADD CONSTRAINT vhffs_ml_unique_address UNIQUE (local_part, domain);
 ALTER TABLE vhffs_ml_subscribers ADD CONSTRAINT vhffs_ml_subscribers_member_list UNIQUE (ml_id, member);

Modified: trunk/vhffs-panel/svn/create.pl
===================================================================
--- trunk/vhffs-panel/svn/create.pl	2007-07-30 21:56:24 UTC (rev 736)
+++ trunk/vhffs-panel/svn/create.pl	2007-07-30 22:37:19 UTC (rev 737)
@@ -64,14 +64,15 @@
     my $user = $panel->{user};
     my $group = $panel->{group};
     $reponame = $cgi->param('reponame');
+    my $fullreponame = $groupname.'/'.$reponame;
     $description = $cgi->param('description');
     if(!(defined $reponame && defined $description)) {
         $panel->add_error( gettext('CGI error') );
-    } elsif( !Vhffs::Services::Svn::check_name($reponame) ) {
+    } elsif( !Vhffs::Services::Svn::check_name($fullreponame) ) {
         $panel->add_error( gettext('Invalid reponame. It must contain between 3 and 64 characters, only lowercase letters and numbers') );
     } elsif( $description =~ /^\s*$/) {
         $panel->add_error( gettext('You must enter a description') );
-    } elsif( defined Vhffs::Panel::Svn::create_svn( $vhffs, $reponame, $description, $user, $group ) ) {
+    } elsif( defined Vhffs::Panel::Svn::create_svn( $vhffs, $fullreponame, $description, $user, $group ) ) {
         my $url = '/panel.pl?project='.$panel->{groupname}.'&msg='.gettext('The SVN object was successfully created !');
         $panel->redirect($url);
     } else {

Modified: trunk/vhffs-panel/templates/svn/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/svn/create.tmpl	2007-07-30 21:56:24 UTC (rev 736)
+++ trunk/vhffs-panel/templates/svn/create.tmpl	2007-07-30 22:37:19 UTC (rev 737)
@@ -9,7 +9,7 @@
 		<label for="reponame">
 			<TMPL_VAR NAME="REPOSITORY_NAME">: 
 		</label>	
-		<input type="text" name="reponame" id="reponame" value="<tmpl_var name="REPOSITORY_VALUE">"/>
+		<TMPL_VAR NAME="GROUP">/<input type="text" name="reponame" id="reponame" value="<tmpl_var name="REPOSITORY_VALUE">"/>
 	</p>
 	<p>
 		<label for="PROJECT_USAGE">


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