[Fusionforge-commits] r14055 - in trunk: . src/plugins/scmcpold/common

Roland Mas lolando at fusionforge.org
Wed Aug 3 10:53:12 CEST 2011


Author: lolando
Date: 2011-08-03 10:53:12 +0200 (Wed, 03 Aug 2011)
New Revision: 14055

Modified:
   trunk/
   trunk/src/plugins/scmcpold/common/CpoldPlugin.class.php
Log:
Fixed deprecations in scmcpold plugin

Modified: trunk/src/plugins/scmcpold/common/CpoldPlugin.class.php
===================================================================
--- trunk/src/plugins/scmcpold/common/CpoldPlugin.class.php	2011-08-03 07:57:56 UTC (rev 14054)
+++ trunk/src/plugins/scmcpold/common/CpoldPlugin.class.php	2011-08-03 08:53:12 UTC (rev 14055)
@@ -1,7 +1,7 @@
 <?php
 /** FusionForge CPOLD plugin
  *
- * Copyright 2009, Roland Mas
+ * Copyright 2009-2011, Roland Mas
  *
  * This file is part of FusionForge.
  *
@@ -20,6 +20,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+forge_define_config_item ('default_server', 'scmcpold', forge_get_config ('web_host')) ;
+forge_define_config_item ('repos_path', 'scmcpold', forge_get_config('chroot').'/scmrepos/cpold') ;
+
 class CpoldPlugin extends SCMPlugin {
 	function CpoldPlugin () {
 		global $gfconfig;
@@ -29,15 +32,6 @@
 		$this->hooks[] = 'scm_generate_snapshots' ;
 		$this->hooks[] = 'scm_cpold_do_nothing' ;
 
-		require $gfconfig.'plugins/scmcpold/config.php' ;
-
-		$this->default_cpold_server = $default_cpold_server ;
-		if (isset ($cpold_root)) {
-			$this->cpold_root = $cpold_root;
-		} else {
-			$this->cpold_root = $GLOBALS['sys_chroot'].'/scmrepos/cpold' ;
-		}
-
 		$this->register () ;
 	}
 
@@ -54,7 +48,7 @@
 	}
 
 	function getDefaultServer() {
-		return $this->default_cpold_server ;
+		return forge_get_config('default_server', 'scmcpold');
 	}
 
 	function getBlurb () {
@@ -73,10 +67,10 @@
 			$u =& user_get_object(user_getid()) ;
 			$d = $u->getUnixName() ;
 			$b = _('<p><b>Developer CPOLD Access via SSH</b></p><p>Only project developers can access the CPOLD tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.</p>');
-			$b .= '<p><tt>scp -r '.$d.'@' . $project->getSCMBox() . ':'. $this->cpold_root .'/'. $project->getUnixName().'/ .</tt></p>' ;
+			$b .= '<p><tt>scp -r '.$d.'@' . $project->getSCMBox() . ':'. forge_get_config('repos_path', 'scmcpold') .'/'. $project->getUnixName().'/ .</tt></p>' ;
 		} else {
 			$b = _('<p><b>Developer CPOLD Access via SSH</b></p><p>Only project developers can access the CPOLD 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.</p>');
-			$b .= '<p><tt>scp -r <i>'._('developername').'</i>@' . $project->getSCMBox() . ':'. $this->cpold_root .'/'. $project->getUnixName().'/ .</tt></p>' ;
+			$b .= '<p><tt>scp -r <i>'._('developername').'</i>@' . $project->getSCMBox() . ':'. forge_get_config('repos_path', 'scmcpold') .'/'. $project->getUnixName().'/ .</tt></p>' ;
 		}
 		return $b ;
 	}
@@ -103,7 +97,7 @@
 			return false;
 		}
 
-		$repo = $this->cpold_root . '/' . $project->getUnixName() ;
+		$repo = forge_get_config('repos_path', 'scmcpold') . '/' . $project->getUnixName() ;
 		$unix_group = 'scm_' . $project->getUnixName() ;
 
 		system ("mkdir -p $repo") ;
@@ -137,7 +131,7 @@
 			return false;
 		}
 
-		$toprepo = $this->cpold_root ;
+		$toprepo = forge_get_config('repos_path', 'scmcpold') ;
 		$repo = $toprepo . '/' . $project->getUnixName() ;
 
 		if (!is_dir ($repo)) {




More information about the Fusionforge-commits mailing list