[Fusionforge-commits] r10596 - trunk/src/common/include

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Sep 21 16:17:58 CEST 2010


Author: lolando
Date: 2010-09-21 16:17:58 +0200 (Tue, 21 Sep 2010)
New Revision: 10596

Modified:
   trunk/src/common/include/Group.class.php
Log:
Only create tools in newly registered projects if they're globally enabled

Modified: trunk/src/common/include/Group.class.php
===================================================================
--- trunk/src/common/include/Group.class.php	2010-09-21 13:57:37 UTC (rev 10595)
+++ trunk/src/common/include/Group.class.php	2010-09-21 14:17:58 UTC (rev 10596)
@@ -2097,63 +2097,69 @@
 		//	Tracker Integration
 		//
 		//
-		$ats = new ArtifactTypes($this);
-		if (!$ats || !is_object($ats)) {
-			$this->setError(_('Error creating ArtifactTypes object'));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
-		} else if ($ats->isError()) {
-			$this->setError(sprintf (_('ATS%d: %s'), 1, $ats->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
+		if (forge_get_config ('use_tracker')) {
+			$ats = new ArtifactTypes($this);
+			if (!$ats || !is_object($ats)) {
+				$this->setError(_('Error creating ArtifactTypes object'));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			} else if ($ats->isError()) {
+				$this->setError(sprintf (_('ATS%d: %s'), 1, $ats->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
+			if (!$ats->createTrackers()) {
+				$this->setError(sprintf (_('ATS%d: %s'), 2, $ats->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
 		}
-		if (!$ats->createTrackers()) {
-			$this->setError(sprintf (_('ATS%d: %s'), 2, $ats->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
-		}
 
 		//
 		//
 		//	Forum Integration
 		//
 		//
-		$f = new Forum($this);
-		if (!$f->create(_('Open-Discussion'),_('General Discussion'),1,'',1,0)) {
-			$this->setError(sprintf (_('F%d: %s'), 1, $f->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
+		if (forge_get_config ('use_forum')) {
+			$f = new Forum($this);
+			if (!$f->create(_('Open-Discussion'),_('General Discussion'),1,'',1,0)) {
+				$this->setError(sprintf (_('F%d: %s'), 1, $f->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
+			$f = new Forum($this);
+			if (!$f->create(_('Help'),_('Get Public Help'),1,'',1,0)) {
+				$this->setError(sprintf (_('F%d: %s'), 2, $f->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
+			$f = new Forum($this);
+			if (!$f->create(_('Developers-Discussion'),_('Project Developer Discussion'),0,'',1,0)) {
+				$this->setError(sprintf (_('F%d: %s'), 3, $f->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
 		}
-		$f = new Forum($this);
-		if (!$f->create(_('Help'),_('Get Public Help'),1,'',1,0)) {
-			$this->setError(sprintf (_('F%d: %s'), 2, $f->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
-		}
-		$f = new Forum($this);
-		if (!$f->create(_('Developers-Discussion'),_('Project Developer Discussion'),0,'',1,0)) {
-			$this->setError(sprintf (_('F%d: %s'), 3, $f->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
-		}
-
+		
 		//
 		//
 		//	Doc Mgr Integration
 		//
 		//
-		$dg = new DocumentGroup($this);
-		if (!$dg->create(_('Uncategorized Submissions'))) {
-			$this->setError(sprintf(_('DG: %s'),$dg->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
+		if (forge_get_config('use_docman')) {
+			$dg = new DocumentGroup($this);
+			if (!$dg->create(_('Uncategorized Submissions'))) {
+				$this->setError(sprintf(_('DG: %s'),$dg->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
 		}
 
 		//
@@ -2161,12 +2167,14 @@
 		//	FRS integration
 		//
 		//
-		$frs = new FRSPackage($this);
-		if (!$frs->create($this->getUnixName())) {
-			$this->setError(sprintf(_('FRSP: %s'),$frs->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
+		if (forge_get_config ('use_frs')) {
+			$frs = new FRSPackage($this);
+			if (!$frs->create($this->getUnixName())) {
+				$this->setError(sprintf(_('FRSP: %s'),$frs->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
 		}
 
 		//
@@ -2174,20 +2182,22 @@
 		//	PM Integration
 		//
 		//
-		$pg = new ProjectGroup($this);
-		if (!$pg->create(_('To Do'),_('Things We Have To Do'),1)) {
-			$this->setError(sprintf(_('PG%d: %s'),1,$pg->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
+		if (forge_get_config ('use_pm')) {
+			$pg = new ProjectGroup($this);
+			if (!$pg->create(_('To Do'),_('Things We Have To Do'),1)) {
+				$this->setError(sprintf(_('PG%d: %s'),1,$pg->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
+			$pg = new ProjectGroup($this);
+			if (!$pg->create(_('Next Release'),_('Items For Our Next Release'),1)) {
+				$this->setError(sprintf(_('PG%d: %s'),2,$pg->getErrorMessage()));
+				db_rollback();
+				setup_gettext_from_context();
+				return false;
+			}
 		}
-		$pg = new ProjectGroup($this);
-		if (!$pg->create(_('Next Release'),_('Items For Our Next Release'),1)) {
-			$this->setError(sprintf(_('PG%d: %s'),2,$pg->getErrorMessage()));
-			db_rollback();
-			setup_gettext_from_context();
-			return false;
-		}
 
 		//
 		//




More information about the Fusionforge-commits mailing list