[Fusionforge-commits] r13707 - in trunk/src: common/include plugins/scmbzr/common plugins/scmcvs/common plugins/scmdarcs/common plugins/scmgit/common plugins/scmhg/common plugins/scmsvn/common www/register

Roland Mas lolando at fusionforge.org
Thu Jul 7 14:51:11 CEST 2011


Author: lolando
Date: 2011-07-07 14:51:11 +0200 (Thu, 07 Jul 2011)
New Revision: 13707

Modified:
   trunk/src/common/include/SCMPlugin.class.php
   trunk/src/plugins/scmbzr/common/BzrPlugin.class.php
   trunk/src/plugins/scmcvs/common/CVSPlugin.class.php
   trunk/src/plugins/scmdarcs/common/DarcsPlugin.class.php
   trunk/src/plugins/scmgit/common/GitPlugin.class.php
   trunk/src/plugins/scmhg/common/HgPlugin.class.php
   trunk/src/plugins/scmsvn/common/SVNPlugin.class.php
   trunk/src/www/register/index.php
Log:
Use sensible default for projects' scm_box when empty

Modified: trunk/src/common/include/SCMPlugin.class.php
===================================================================
--- trunk/src/common/include/SCMPlugin.class.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/common/include/SCMPlugin.class.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -244,6 +244,17 @@
 		}
 	}
 
+	function getBoxForProject($project) {
+		$box = $project->getSCMBox();
+		if ($box == '') {
+			$box = forge_get_config('default_server', $this->name);
+		}
+		if ($box == '') {
+			$box = forge_get_config('web_host');
+		}
+		return $box;
+	}
+
 	function checkParams ($params) {
 		$group_id = $params['group_id'] ;
 		$project = group_get_object($group_id);

Modified: trunk/src/plugins/scmbzr/common/BzrPlugin.class.php
===================================================================
--- trunk/src/plugins/scmbzr/common/BzrPlugin.class.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/plugins/scmbzr/common/BzrPlugin.class.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -97,7 +97,7 @@
 			$b .= '<p>';
 			$b .= _('Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
 			$b .= '</p>';
-			$b .= '<p><tt>bzr checkout bzr+ssh://'.$d.'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmbzr') .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
+			$b .= '<p><tt>bzr checkout bzr+ssh://'.$d.'@' . $this->getBoxForProject($project) . forge_get_config('repos_path', 'scmbzr') .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
 		} else {
 			$b .= '<h2>';
 			$b .= _('Developer Bazaar Access via SSH');
@@ -105,7 +105,7 @@
 			$b .= '<p>';
 			$b .= _('Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.');
 			$b .= '</p>';
-			$b .= '<p><tt>bzr checkout bzr+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmbzr') .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
+			$b .= '<p><tt>bzr checkout bzr+ssh://<i>'._('developername').'</i>@' . $this->getBoxForProject($project) . forge_get_config('repos_path', 'scmbzr') .'/'. $project->getUnixName().'/'._('branchname').'</tt></p>' ;
 		}
 		return $b ;
 	}

Modified: trunk/src/plugins/scmcvs/common/CVSPlugin.class.php
===================================================================
--- trunk/src/plugins/scmcvs/common/CVSPlugin.class.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/plugins/scmcvs/common/CVSPlugin.class.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -70,7 +70,7 @@
 	}
 
 	function getInstructionsForAnon ($project) {
-		$cvsrootend = $project->getSCMBox().':'.forge_get_config('repos_path', 'scmcvs').'/'.$project->getUnixName();
+		$cvsrootend = $this->getBoxForProject($project).':'.forge_get_config('repos_path', 'scmcvs').'/'.$project->getUnixName();
         $b = '<h2>' . _('Anonymous CVS Access') . '</h2>';
         $b .= '<p>';
         $b .= _('This project\'s CVS repository can be checked out through anonymous (pserver) CVS with the following instruction set. The module you wish to check out must be specified as the <i>modulename</i>. When prompted for a password for <i>anonymous</i>, simply press the Enter key.');
@@ -84,7 +84,7 @@
 	}
 
 	function getInstructionsForRW ($project) {
-		$cvsrootend = $project->getSCMBox().':'.forge_get_config('repos_path', 'scmcvs').'/'.$project->getUnixName();
+		$cvsrootend = $this->getBoxForProject($project).':'.forge_get_config('repos_path', 'scmcvs').'/'.$project->getUnixName();
 		if (session_loggedin()) {
 			$u =& user_get_object(user_getid()) ;
 			$d = $u->getUnixName() ;

Modified: trunk/src/plugins/scmdarcs/common/DarcsPlugin.class.php
===================================================================
--- trunk/src/plugins/scmdarcs/common/DarcsPlugin.class.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/plugins/scmdarcs/common/DarcsPlugin.class.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -98,7 +98,7 @@
  			}
  			if ($rw)
  			{
- 				$url = $project->getSCMBox() . ':'. $this->getRootRepositories($project) . '/' . $default_repo;
+ 				$url = $this->getBoxForProject($project) . ':'. $this->getRootRepositories($project) . '/' . $default_repo;
  			}
  			else
  			{

Modified: trunk/src/plugins/scmgit/common/GitPlugin.class.php
===================================================================
--- trunk/src/plugins/scmgit/common/GitPlugin.class.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/plugins/scmgit/common/GitPlugin.class.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -115,7 +115,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the GIT tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>git clone git+ssh://'.$d.'@' . $project->getSCMBox() . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
+				$b .= '<p><tt>git clone git+ssh://'.$d.'@' . $this->getBoxForProject($project) . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
 			} elseif (forge_get_config('use_dav', 'scmgit')) {
 				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
 				$b = '<h2>';
@@ -124,7 +124,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the GIT tree via this method. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>git clone '.$protocol.'://'.$d.'@' . $project->getSCMBox() . '/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
+				$b .= '<p><tt>git clone '.$protocol.'://'.$d.'@' . $this->getBoxForProject($project) . '/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
 			} else {
 				$b = '<p class="warning">'._('Missing configuration for access in scmgit.ini : use_ssh and use_dav disabled').'</p>';
 			}
@@ -136,7 +136,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the GIT tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>git clone git+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
+				$b .= '<p><tt>git clone git+ssh://<i>'._('developername').'</i>@' . $this->getBoxForProject($project) . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
 			} elseif (forge_get_config('use_dav', 'scmgit')) {
 				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
 				$b = '<h2>';
@@ -145,7 +145,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the GIT tree via this method. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>git clone '.$protocol.'://<i>'._('developername').'</i>@' . $project->getSCMBox() . '/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
+				$b .= '<p><tt>git clone '.$protocol.'://<i>'._('developername').'</i>@' . $this->getBoxForProject($project) . '/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
 			}
 		}
 
@@ -162,7 +162,7 @@
 					$b .= '<p>';
 					$b .= _('You have a personal repository for this project, accessible through SSH with the following method. Enter your site password when prompted.');
 					$b .= '</p>';
-					$b .= '<p><tt>git clone git+ssh://'.$u->getUnixName().'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $u->getUnixName() .'.git</tt></p>' ;
+					$b .= '<p><tt>git clone git+ssh://'.$u->getUnixName().'@' . $this->getBoxForProject($project) . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $u->getUnixName() .'.git</tt></p>' ;
 				} else {
 					$glist = $u->getGroups();
 					foreach ($glist as $g) {

Modified: trunk/src/plugins/scmhg/common/HgPlugin.class.php
===================================================================
--- trunk/src/plugins/scmhg/common/HgPlugin.class.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/plugins/scmhg/common/HgPlugin.class.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -65,7 +65,7 @@
 			$b .= '<p>' ;
 			$b .= _('Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
 			$b .= '</p>' ;
-			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
+			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $this->getBoxForProject($project) . forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
 		} else {
 			$d = '<i>developername</i>';
 			$b = '</h2>' ;
@@ -74,7 +74,7 @@
 			$b .= '<p>' ;
 			$b .= _('Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.');
 			$b .= '</p>' ;
-			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $project->getSCMBox() . forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
+			$b .= '<p><tt>hg clone ssh://'.$d.'@' . $this->getBoxForProject($project) . forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
 		}
 		return $b ;
 	}

Modified: trunk/src/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- trunk/src/plugins/scmsvn/common/SVNPlugin.class.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/plugins/scmsvn/common/SVNPlugin.class.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -105,10 +105,10 @@
 		$b .= '<p>' ;
 		$module = $this->topModule($project);
 		if (forge_get_config('use_ssh', 'scmsvn')) {
-			$b .= '<tt>svn checkout svn://'.$project->getSCMBox().$this->svn_root_fs.'/'.$project->getUnixName().$module.'</tt><br />';
+			$b .= '<tt>svn checkout svn://'.$this->getBoxForProject($project).$this->svn_root_fs.'/'.$project->getUnixName().$module.'</tt><br />';
 		}
 		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_dav .'/'. $project->getUnixName() .$module.'</tt><br/><br/>';
+			$b .= '<tt>svn checkout --username '.forge_get_config('anonsvn_login', 'scmsvn').' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://' . $this->getBoxForProject($project). $this->svn_root_dav .'/'. $project->getUnixName() .$module.'</tt><br/><br/>';
 			$b .= _('The password is ').forge_get_config('anonsvn_password', 'scmsvn').'<br/>';
 		}
 		$b .= '</p>';
@@ -130,7 +130,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>svn checkout svn+ssh://'.$d.'@' . $project->getSCMBox() . $this->svn_root_fs .'/'. $project->getUnixName().$module.'</tt></p>' ;
+				$b .= '<p><tt>svn checkout svn+ssh://'.$d.'@' . $this->getBoxForProject($project) . $this->svn_root_fs .'/'. $project->getUnixName().$module.'</tt></p>' ;
 			}
 			if (forge_get_config('use_dav', 'scmsvn')) {
 				$b .= '<h2>';
@@ -139,7 +139,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the SVN tree via this method. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>svn checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root_dav .'/'.$project->getUnixName().$module.'</tt></p>' ;
+				$b .= '<p><tt>svn checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $this->getBoxForProject($project) . $this->svn_root_dav .'/'.$project->getUnixName().$module.'</tt></p>' ;
 			}
 		} else {
 			if (forge_get_config('use_ssh', 'scmsvn')) {
@@ -149,7 +149,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>svn checkout svn+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . $this->svn_root_fs .'/'. $project->getUnixName().$module.'</tt></p>' ;
+				$b .= '<p><tt>svn checkout svn+ssh://<i>'._('developername').'</i>@' . $this->getBoxForProject($project) . $this->svn_root_fs .'/'. $project->getUnixName().$module.'</tt></p>' ;
 			}
 			if (forge_get_config('use_dav', 'scmsvn')) {
 				$b .= '<h2>';
@@ -158,7 +158,7 @@
 				$b .= '<p>';
 				$b .= _('Only project developers can access the SVN tree via this method. Substitute <i>developername</i> with the proper values. Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>svn checkout --username <i>'._('developername').'</i> http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root_dav .'/'.$project->getUnixName().$module.'</tt></p>' ;
+				$b .= '<p><tt>svn checkout --username <i>'._('developername').'</i> http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $this->getBoxForProject($project) . $this->svn_root_dav .'/'.$project->getUnixName().$module.'</tt></p>' ;
 			}
 		}
 		return $b ;

Modified: trunk/src/www/register/index.php
===================================================================
--- trunk/src/www/register/index.php	2011-07-07 12:35:49 UTC (rev 13706)
+++ trunk/src/www/register/index.php	2011-07-07 12:51:11 UTC (rev 13707)
@@ -98,10 +98,6 @@
 		}
 	}
 
-	if ($scm_host == '') {
-		$scm_host = forge_get_config('web_host');
-	}
-
 	if ( !$purpose && forge_get_config ('project_auto_approval') ) {
 		$purpose = 'No purpose given, autoapprove was on';
 	}




More information about the Fusionforge-commits mailing list