[Fusionforge-commits] r10029 - in trunk/gforge: plugins/scmsvn/common www/scm/include

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Tue Jun 15 13:21:12 CEST 2010


Author: aljeux
Date: 2010-06-15 13:21:12 +0200 (Tue, 15 Jun 2010)
New Revision: 10029

Modified:
   trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
   trunk/gforge/www/scm/include/viewvc_utils.php
Log:
Misc fixes on scmsvn (and WebDAV support).

Modified: trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2010-06-15 10:08:06 UTC (rev 10028)
+++ trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2010-06-15 11:21:12 UTC (rev 10029)
@@ -3,6 +3,7 @@
  *
  * Copyright 2003-2010, Roland Mas, Franck Villaume
  * Copyright 2004, GForge, LLC
+ * Copyright 2010, Alain Peyrat <aljeux at free.fr>
  *
  * This file is part of FusionForge.
  *
@@ -35,10 +36,10 @@
 
 class SVNPlugin extends SCMPlugin {
 	function SVNPlugin () {
-		global $gfconfig;
 		$this->SCMPlugin () ;
 		$this->name = 'scmsvn';
-		$this->text = 'SVN';
+		$this->text = 'Subversion';
+		$this->svn_root = '/svn';
 		$this->hooks[] = 'scm_browser_page';
 		$this->hooks[] = 'scm_update_repolist' ;
 		$this->hooks[] = 'scm_generate_snapshots' ;
@@ -84,7 +85,7 @@
 		}
 		if (forge_get_config('use_dav', 'scmsvn')) {
 			$b .= '<tt>svn checkout --username '.forge_get_config('anonsvn_login', 'scmsvn').' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://' . $project->getSCMBox(). $this->svn_root .'/'. $project->getUnixName() .'/trunk</tt><br/><br/>';
-			$b .= _('The password is ').forge_get_config('anonsvn_pass', 'scmsvn').'<br/>';
+			$b .= _('The password is ').forge_get_config('anonsvn_password', 'scmsvn').'<br/>';
 		}
 		$b .= '</p>';
 		return $b ;
@@ -174,8 +175,6 @@
 	}
 
 	function printBrowserPage ($params) {
-		global $HTML;
-
 		$project = $this->checkParams ($params) ;
 		if (!$project) {
 			return false ;
@@ -198,16 +197,16 @@
 			return false;
 		}
 
-		$repo = $this->svn_root . '/' . $project->getUnixName() ;
-		$unix_group = 'scm_' . $project->getUnixName() ;
+		$repo = forge_get_config('repos_path', 'scmsvn') . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo) || !is_file ("$repo/format")) {
 			system ("svnadmin create $repo") ;
 			system ("svn mkdir -m'Init' file:///$repo/trunk file:///$repo/tags file:///$repo/branches") ;
-			system ("find $repo -type d | xargs chmod g+s") ;
 		}
 
 		if (forge_get_config('use_ssh', 'scmsvn')) {
+			$unix_group = 'scm_' . $project->getUnixName() ;
+			system ("find $repo -type d | xargs chmod g+s") ;
 			system ("chgrp -R $unix_group $repo") ;
 			if ($project->enableAnonSCM()) {
 				system ("chmod -R g+wX,o+rX-w $repo") ;
@@ -216,12 +215,9 @@
 			}
 		} else {
 			$unix_user = forge_get_config('apache_user');
+			$unix_group = forge_get_config('apache_group');
 			system ("chown -R $unix_user:$unix_group $repo") ;
-			if ($project->enableAnonSCM()) {
-				system ("chmod -R g+wX,o+rX-w $repo") ;
-			} else {
-				system ("chmod -R g+wX,o-rwx $repo") ;
-			}
+			system ("chmod -R g-rwx,o-rwx $repo") ;
 		}
 	}
 
@@ -316,15 +312,15 @@
 			$usr_adds = array () ;
 			$usr_updates = array () ;
 
-			$repo = $this->svn_root . '/' . $project->getUnixName() ;
+			$repo = forge_get_config('repos_path', 'scmsvn') . '/' . $project->getUnixName() ;
 			if (!is_dir ($repo) || !is_file ("$repo/format")) {
 				echo "No repository\n" ;
 				db_rollback () ;
 				return false ;
 			}
 	
-                        $d1 = date ('Y-m-d', $start_time - 150000) ;
-                        $d2 = date ('Y-m-d', $end_time + 150000) ;
+			$d1 = date ('Y-m-d', $start_time - 150000) ;
+			$d2 = date ('Y-m-d', $end_time + 150000) ;
 
 			$pipe = popen ("svn log file://$repo --xml -v -q -r '".'{'.$d2.'}:{'.$d1.'}'."' 2> /dev/null", 'r' ) ;
 
@@ -441,7 +437,7 @@
 			return false;
 		}
 
-		$toprepo = $this->svn_root ;
+		$toprepo = forge_get_config('repos_path', 'scmsvn') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo) || !is_file ("$repo/format")) {

Modified: trunk/gforge/www/scm/include/viewvc_utils.php
===================================================================
--- trunk/gforge/www/scm/include/viewvc_utils.php	2010-06-15 10:08:06 UTC (rev 10028)
+++ trunk/gforge/www/scm/include/viewvc_utils.php	2010-06-15 11:21:12 UTC (rev 10029)
@@ -70,9 +70,9 @@
 	}
 	
 	if ($repos_type == "cvs") {
-		$repos_root = $GLOBALS['cvsdir_prefix'].'/'.$repos_name;
+		$repos_root = forge_get_config('repos_path', 'scmcvs').'/'.$repos_name;
 	} else if ($repos_type == "svn") {
-		$repos_root = $GLOBALS['svndir_prefix'].'/'.$repos_name;
+		$repos_root = forge_get_config('repos_path', 'scmsvn').'/'.$repos_name;
 	} else {
 		die("Invalid repository type");
 	}




More information about the Fusionforge-commits mailing list