[evolvis-commits] r12820: Added code to convert scmsvn to the new repository creation dispatching method , not active yet

mirabilos at evolvis.org mirabilos at evolvis.org
Mon Feb 28 02:02:06 CET 2011


Author: mirabilos
Date: 2011-02-28 02:02:06 +0100 (Mon, 28 Feb 2011)
New Revision: 12820

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Added code to convert scmsvn to the new repository creation dispatching method, not active yet

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2011-02-28 01:02:04 UTC (rev 12819)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2011-02-28 01:02:06 UTC (rev 12820)
@@ -31,8 +31,8 @@
 		$this->hooks[] = 'scm_page';
 		$this->hooks[] = 'scm_admin_update';
 		$this->hooks[] = 'scm_admin_page';
-// to be revised		
  		$this->hooks[] = 'scm_stats';
+		$this->hooks[] = 'scm_createrepo';
 		$this->hooks[] = 'scm_plugin';
 
 		require_once $gfconfig.'plugins/scmsvn/config.php' ;
@@ -68,6 +68,9 @@
 		case 'scm_stats':
 			$this->getStats ($params) ;
 			break;
+		case 'scm_createrepo':
+			$this->createOrUpdateRepo ($params) ;
+			break;
 		case 'scm_plugin':
 			$scm_plugins=& $params['scm_plugins'];
 			$scm_plugins[]=$this->name;
@@ -278,6 +281,42 @@
 			echo '<hr size="1" />';
 		}
 	}
+
+	function createOrUpdateRepo ($params) {
+		return true ;   // Disabled for now
+
+		$group_id = $params['group_id'] ;
+
+		$project =& group_get_object($group_id);
+		if (!$project || !is_object($project)) {
+			return false;
+		} elseif ($project->isError()) {
+			return false;
+		}
+               
+		if (! $project->usesPlugin ($this->name)) {
+			return false;
+		}
+
+		$repo = $this->svn_root . '/' . $project->getUnixName() ;
+		$unix_group = 'scm_' . $project->getUnixName() ;
+
+		$repo_exists = false ;
+		if (is_dir ($repo) && is_file ("$repo/format")) {
+			$repo_exists = true ;
+		}
+               
+		if (!$repo_exists) {
+			system ("svnadmin create --fs-type fsfs $repo") ;
+		}
+
+		system ("chgrp -R $unix_group $repo") ;
+		if ($project->enableAnonSCM()) {
+			system ("chmod -R g+wXs,o+rX-w $repo") ;
+		} else {
+			system ("chmod -R g+wXs,o-rwx $repo") ;
+		}
+	}
   }
 
 // Local Variables:



More information about the evolvis-commits mailing list