[Fusionforge-commits] r7979 - in trunk/gforge: common/include plugins/scmbzr/common plugins/scmcpold/common plugins/scmcvs/common plugins/scmsvn/common

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Aug 27 15:39:01 CEST 2009


Author: lolando
Date: 2009-08-27 15:39:01 +0200 (Thu, 27 Aug 2009)
New Revision: 7979

Modified:
   trunk/gforge/common/include/SCMPlugin.class.php
   trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
   trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php
   trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
   trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
Log:
Reorg constructor a bit

Modified: trunk/gforge/common/include/SCMPlugin.class.php
===================================================================
--- trunk/gforge/common/include/SCMPlugin.class.php	2009-08-27 13:38:50 UTC (rev 7978)
+++ trunk/gforge/common/include/SCMPlugin.class.php	2009-08-27 13:39:01 UTC (rev 7979)
@@ -31,8 +31,44 @@
 	 */
 	function SCMPlugin () {
 		$this->Plugin() ;
+		$this->hooks[] = 'scm_page';
+		$this->hooks[] = 'scm_admin_update';
+		$this->hooks[] = 'scm_admin_page';
+ 		$this->hooks[] = 'scm_stats';
+		$this->hooks[] = 'scm_createrepo';
+		$this->hooks[] = 'scm_plugin';
+		$this->register () ;
 	}
 
+	function CallHook ($hookname, $params) {
+		global $HTML ;
+		
+		switch ($hookname) {
+		case 'scm_page':
+			$group_id = $params['group_id'] ;
+			$this->getPage ($group_id) ;
+			break ;
+		case 'scm_admin_update':
+			$this->AdminUpdate ($params) ;
+			break ;
+		case 'scm_admin_page':
+			$this->getAdminPage ($params) ;
+			break ;
+		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;
+			break;
+		default:
+			// Forgot something
+		}
+	}
+
 	function register () {
 		global $scm_list ;
 

Modified: trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-08-27 13:38:50 UTC (rev 7978)
+++ trunk/gforge/plugins/scmbzr/common/BzrPlugin.class.php	2009-08-27 13:39:01 UTC (rev 7979)
@@ -24,23 +24,15 @@
 class BzrPlugin extends SCMPlugin {
 	function BzrPlugin () {
 		global $gfconfig;
-		$this->SCMPlugin () ;
+		require_once $gfconfig.'plugins/scmbzr/config.php' ;
+		
 		$this->name = 'scmbzr';
 		$this->text = 'Bazaar';
-		$this->hooks[] = 'scm_page';
-		$this->hooks[] = 'scm_admin_update';
-		$this->hooks[] = 'scm_admin_page';
- 		$this->hooks[] = 'scm_stats';
-		$this->hooks[] = 'scm_plugin';
-		$this->hooks[] = 'scm_createrepo';
+		$this->SCMPlugin () ;
 
-		require_once $gfconfig.'plugins/scmbzr/config.php' ;
-		
 		$this->default_bzr_server = $default_bzr_server ;
 		$this->enabled_by_default = $enabled_by_default ;
 		$this->bzr_root = $bzr_root;
-
-		$this->register () ;
 	}
 	
 	function getDefaultServer() {

Modified: trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php	2009-08-27 13:38:50 UTC (rev 7978)
+++ trunk/gforge/plugins/scmcpold/common/CpoldPlugin.class.php	2009-08-27 13:39:01 UTC (rev 7979)
@@ -24,23 +24,15 @@
 class CpoldPlugin extends SCMPlugin {
 	function CpoldPlugin () {
 		global $gfconfig;
-		$this->SCMPlugin () ;
+		require_once $gfconfig.'plugins/scmcpold/config.php' ;
+
 		$this->name = 'scmcpold';
 		$this->text = 'CPOLD';
-		$this->hooks[] = 'scm_page';
-		$this->hooks[] = 'scm_admin_update';
-		$this->hooks[] = 'scm_admin_page';
- 		$this->hooks[] = 'scm_stats';
-		$this->hooks[] = 'scm_plugin';
-		$this->hooks[] = 'scm_createrepo';
+		$this->SCMPlugin () ;
 		
-		require_once $gfconfig.'plugins/scmcpold/config.php' ;
-		
 		$this->default_cpold_server = $default_cpold_server ;
 		$this->enabled_by_default = $enabled_by_default ;
 		$this->cpold_root = $cpold_root;
-		
-		$this->register () ;
 	}
 	
   }

Modified: trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2009-08-27 13:38:50 UTC (rev 7978)
+++ trunk/gforge/plugins/scmcvs/common/CVSPlugin.class.php	2009-08-27 13:39:01 UTC (rev 7979)
@@ -25,18 +25,14 @@
 	function CVSPlugin () {
 		global $cvs_root;
 		global $gfconfig;
-		$this->SCMPlugin () ;
+		require_once $GLOBALS['gfconfig'].'plugins/scmcvs/config.php' ;
+
 		$this->name = 'scmcvs';
 		$this->text = 'CVS';
-		$this->hooks[] = 'scm_page';
-		$this->hooks[] = 'scm_admin_update';
-		$this->hooks[] = 'scm_admin_page';
-		$this->hooks[] = 'scm_stats';
-		$this->hooks[] = 'scm_createrepo' ;
+		$this->SCMPlugin () ;
+
 		$this->hooks[] = 'scm_snapshots_and_tarballs' ;
-		$this->hooks[] = 'scm_plugin';
 
-		require_once $GLOBALS['gfconfig'].'plugins/scmcvs/config.php' ;
 
 		$this->default_cvs_server = $default_cvs_server ;
 		if ($cvs_root) {
@@ -47,8 +43,6 @@
 		//$this->default_cvs_server = $default_cvs_server ;
 		//$this->this_server = $this_server ;
 		$this->enabled_by_default = $enabled_by_default ;
-
-		$this->register () ;
 	}
 	
 	function getDefaultServer() {
@@ -59,31 +53,11 @@
 		global $HTML;
 		
 		switch ($hookname) {
-		case 'scm_page':
-			$group_id = $params['group_id'] ;
-			$this->getPage ($group_id) ;
-			break ;
-		case 'scm_admin_update':
-			$this->adminUpdate ($params) ;
-			break ;
-		case 'scm_admin_page':
-			$this->getAdminPage ($params) ;
-			break ;
-		case 'scm_stats':
-			$this->getStats ($params) ;
-			break;
-		case 'scm_createrepo':
-			$this->createOrUpdateRepo ($params) ;
-			break;
 		case 'scm_snapshots_and_tarballs':
 			$this->generateSnapshots ($params) ;
 			break;
-		case 'scm_plugin':
-			$scm_plugins=& $params['scm_plugins'];
-			$scm_plugins[]=$this->name;
-			break;
 		default:
-			// Forgot something
+			parent::CallHook ($hookname, $params) ;
 		}
 	}
 

Modified: trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php
===================================================================
--- trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2009-08-27 13:38:50 UTC (rev 7978)
+++ trunk/gforge/plugins/scmsvn/common/SVNPlugin.class.php	2009-08-27 13:39:01 UTC (rev 7979)
@@ -25,18 +25,12 @@
 class SVNPlugin extends SCMPlugin {
 	function SVNPlugin () {
 		global $gfconfig;
-		$this->SCMPlugin () ;
+		require_once $gfconfig.'plugins/scmsvn/config.php' ;
+
 		$this->name = 'scmsvn';
 		$this->text = 'SVN';
-		$this->hooks[] = 'scm_page';
-		$this->hooks[] = 'scm_admin_update';
-		$this->hooks[] = 'scm_admin_page';
- 		$this->hooks[] = 'scm_stats';
-		$this->hooks[] = 'scm_createrepo';
-		$this->hooks[] = 'scm_plugin';
+		$this->SCMPlugin () ;
 
-		require_once $gfconfig.'plugins/scmsvn/config.php' ;
-		
 		$this->default_svn_server = $default_svn_server ;
 		$this->enabled_by_default = $enabled_by_default ;
 		$this->use_ssh = $use_ssh;
@@ -44,42 +38,12 @@
 		$this->use_ssl = $use_ssl;
 		$this->svn_root = $svn_root;
 
-		$this->register () ;
 	}
 	
 	function getDefaultServer() {
 		return $this->default_svn_server ;
 	}
 
-	function CallHook ($hookname, $params) {
-		global $HTML ;
-		
-		switch ($hookname) {
-		case 'scm_page':
-			$group_id = $params['group_id'] ;
-			$this->getPage ($group_id) ;
-			break ;
-		case 'scm_admin_update':
-			$this->AdminUpdate ($params) ;
-			break ;
-		case 'scm_admin_page':
-			$this->getAdminPage ($params) ;
-			break ;
-		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;
-			break;
-		default:
-			// Forgot something
-		}
-	}
-
 	function getBlurb () {
 		return _('<p>Documentation for Subversion (sometimes referred to as "SVN") is available <a href="http://svnbook.red-bean.com/">here</a>.</p>') ;
 	}




More information about the Fusionforge-commits mailing list