[Fusionforge-commits] FusionForge branch master updated. v6.0.5-1870-g3af9c97

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun May 28 16:53:28 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  3af9c97c6eb2c994aab4974cf9c3ad6182cdabbb (commit)
       via  44f54d9cb0b86333a2e6dc7f39e66490f5839ab6 (commit)
       via  ed9f27b01d59bc3f12688dc6d3dcdeea2dd379d8 (commit)
       via  644b05f2583f9fcf5da05a1cd85d544d11884f81 (commit)
       via  235c88cbbd910db0bd3c8c160a7368e10f94ef53 (commit)
      from  101a5c2e7493240cbed2dca3085f6b9105fc0f6f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=3af9c97c6eb2c994aab4974cf9c3ad6182cdabbb

commit 3af9c97c6eb2c994aab4974cf9c3ad6182cdabbb
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun May 28 16:53:06 2017 +0200

    less code & space

diff --git a/src/common/tracker/EffortUnitSet.class.php b/src/common/tracker/EffortUnitSet.class.php
index 50c268f..9bc5d72 100644
--- a/src/common/tracker/EffortUnitSet.class.php
+++ b/src/common/tracker/EffortUnitSet.class.php
@@ -59,7 +59,7 @@ class EffortUnitSet extends FFError {
 	 *
 	 * @param	Object	$Object Null, group, tracker object to which this EffortUnitSet is associated
 	 */
-	function __construct(&$Object=null, $unit_set_id=false, $arr=false) {
+	function __construct(&$Object = null, $unit_set_id = false, $arr = false) {
 		parent::__construct();
 		$this->Object = $Object;
 		if (!$Object) {
@@ -419,7 +419,7 @@ class EffortUnitSet extends FFError {
  *
  * @return	array	list of EffortUnitSets.
  */
-function getAvailableEffortUnitSets(&$Object=null) {
+function getAvailableEffortUnitSets(&$Object = null) {
 	if (!$Object) {
 		$class ='';
 	} else {
@@ -486,9 +486,9 @@ function getAvailableEffortUnitSets(&$Object=null) {
  *
  * @return	integer	EffortUnitSet ID.
  */
-function getEffortUnitSetForLevel(&$Object,$level) {
+function getEffortUnitSetForLevel(&$Object, $level) {
 	if (!$Object) {
-		$class ='';
+		$class = '';
 	} else {
 		$class = get_class($Object);
 	}
@@ -519,59 +519,44 @@ function getEffortUnitSetForLevel(&$Object,$level) {
 			}
 			$group_id = $Object->getID();
 			$group_name = $Object->getPublicName();
-			if ($level<EFFORTUNITSET_PROJECT_LEVEL) {
+			if ($level < EFFORTUNITSET_PROJECT_LEVEL) {
 				return false;
 			}
 			break;
 		case '':
-			if ($level<EFFORTUNITSET_FORGE_LEVEL) {
+			if ($level < EFFORTUNITSET_FORGE_LEVEL) {
 				return false;
 			}
 			break;
 	}
 	switch($level) {
 		case EFFORTUNITSET_TRACKER_LEVEL:
-			$res = db_query_params ('SELECT unit_set_id FROM effort_unit_set WHERE group_id=$1 AND group_artifact_id=$2 AND level=$3',
+			$res = db_query_params('SELECT unit_set_id FROM effort_unit_set WHERE group_id = $1 AND group_artifact_id = $2 AND level = $3',
 			array($group_id, $atid, EFFORTUNITSET_TRACKER_LEVEL));
 			if (!$res) {
 				$this->setError(sprintf(_('Error getting Tracker ā€œ%sā€ level Effort Unit Set'),$at_name), db_error());
 				return false;
 			}
-			if (db_numrows($res)>0) {
-				$row = db_fetch_array($res);
-				return $row['unit_set_id'];
-			} else {
-				return false;
-			}
 			break;
 		case EFFORTUNITSET_PROJECT_LEVEL:
-			$res = db_query_params ('SELECT unit_set_id FROM effort_unit_set WHERE group_id=$1 AND group_artifact_id IS NULL AND level=$2',
+			$res = db_query_params('SELECT unit_set_id FROM effort_unit_set WHERE group_id = $1 AND group_artifact_id IS NULL AND level = $2',
 			array($group_id, EFFORTUNITSET_PROJECT_LEVEL));
 			if (!$res) {
 				$this->setError(sprintf(_('Error getting Project ā€œ%sā€ level Effort Unit Set'),$group_name), db_error());
 				return false;
 			}
-			if (db_numrows($res)>0) {
-				$row = db_fetch_array($res);
-				return $row['unit_set_id'];
-			} else {
-				return false;
-			}
 			break;
 		case EFFORTUNITSET_FORGE_LEVEL:
-			$res = db_query_params ('SELECT unit_set_id FROM effort_unit_set WHERE group_id IS NULL AND group_artifact_id IS NULL AND level=$1',
+			$res = db_query_params('SELECT unit_set_id FROM effort_unit_set WHERE group_id IS NULL AND group_artifact_id IS NULL AND level = $1',
 			array(EFFORTUNITSET_FORGE_LEVEL));
 			if (!$res) {
 				$this->setError(_('Error getting Forge level Effort Unit Set'), db_error());
 				return false;
 			}
-			if (db_numrows($res)>0) {
-				$row = db_fetch_array($res);
-				return $row['unit_set_id'];
-			} else {
-				return false;
-			}
 			break;
 	}
+	if (db_numrows($res) > 0) {
+		return db_result($res, 0, 'unit_set_id');
+	}
 	return false;
 }

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=44f54d9cb0b86333a2e6dc7f39e66490f5839ab6

commit 44f54d9cb0b86333a2e6dc7f39e66490f5839ab6
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun May 28 16:52:17 2017 +0200

    space & quotes

diff --git a/src/common/include/database-pgsql.php b/src/common/include/database-pgsql.php
index ee906f3..24e1f16 100644
--- a/src/common/include/database-pgsql.php
+++ b/src/common/include/database-pgsql.php
@@ -457,7 +457,7 @@ function db_begin($dbserver = NULL) {
 	// programmatical transaction
 	$_sys_db_transaction_level++;
 	if ($_sys_db_transaction_level == 1) {
-		return db_query_params("BEGIN WORK", array(), -1, 0, $dbserver);
+		return db_query_params('BEGIN WORK', array(), -1, 0, $dbserver);
 	}
 
 	return true;
@@ -484,7 +484,7 @@ function db_commit($dbserver = NULL) {
 	// programmatical transaction ends
 	$_sys_db_transaction_level--;
 	if ($_sys_db_transaction_level == 0) {
-		return db_query_params("COMMIT", array(), -1, 0, $dbserver);
+		return db_query_params('COMMIT', array(), -1, 0, $dbserver);
 	}
 
 	return true;
@@ -511,7 +511,7 @@ function db_rollback($dbserver = NULL) {
 	// programmatical transaction ends
 	$_sys_db_transaction_level--;
 	if ($_sys_db_transaction_level == 0) {
-		return db_query_params("ROLLBACK", array(), -1, 0, $dbserver);
+		return db_query_params('ROLLBACK', array(), -1, 0, $dbserver);
 	}
 
 	return true;
@@ -557,8 +557,8 @@ function db_result($qhandle, $row, $field) {
  * @param	int	$row		Row number.
  * @return	boolean	True on success
  */
-function db_result_seek($qhandle,$row) {
-	return @pg_result_seek($qhandle,$row);
+function db_result_seek($qhandle, $row) {
+	return @pg_result_seek($qhandle, $row);
 }
 
 /**

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=ed9f27b01d59bc3f12688dc6d3dcdeea2dd379d8

commit ed9f27b01d59bc3f12688dc6d3dcdeea2dd379d8
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun May 28 16:35:36 2017 +0200

    forge cli: groupImport, support partial roles, enable setup features

diff --git a/src/bin/forge b/src/bin/forge
index 327a14f..a07a335 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -509,9 +509,11 @@ class CliActions {
 					foreach ($stream['setup']['membersArr'] as $member) {
 						$muid = (int)$this->getMappingId($member['data_array']['user_id'], 'user');
 						if (!$new_group->addUser($muid, $default_role_id)) {
-							echo _('Unable to add user to group with TOBEDELETED role')."\n";
+							echo sprintf(_('Unable to add user to group with %s role'), 'TOBEDELETED')."\n";
 							db_rollback();
 							return false;
+						} else {
+							echo sprintf(_('User %d added to group with role'), $muid)._(': ').'TOBEDELETED'."\n";
 						}
 					}
 				}
@@ -519,34 +521,76 @@ class CliActions {
 				if (forge_get_config('use_tracker')) {
 					if (isset($stream['setup']['data_array']['use_tracker'])) {
 						$new_group->setUseTracker($stream['setup']['data_array']['use_tracker']);
-					}
-					if (isset($stream['trackers']) && is_array($stream['trackers'])) {
-						foreach ($stream['trackers'] as $tracker) {
-							$filename = 'trackerDump-'.$tracker['setup']['group_artifact_id'].'.'.$format;
-							$this->createSubfile($filename, $tracker, $format);
-							if (!$this->trackerImport($filename, $format)) {
-								echo _('Unable to inject tracker')."\n";
-								db_rollback();
-								return false;
+						if ($new_group->usesTracker() && isset($stream['trackers']) && is_array($stream['trackers'])) {
+							foreach ($stream['trackers'] as $tracker) {
+								$filename = 'trackerDump-'.$tracker['setup']['group_artifact_id'].'.'.$format;
+								$this->createSubfile($filename, $tracker, $format);
+								if (!$this->trackerImport($filename, $format)) {
+									echo _('Unable to inject tracker')."\n";
+									db_rollback();
+									return false;
+								}
+								@unlink($filename);
 							}
-							@unlink($filename);
 						}
+					} else {
+						$new_group->setUseTracker(false);
 					}
 				}
 				//inject docman if any
 				if (forge_get_config('use_docman')) {
 					if (isset($stream['setup']['data_array']['use_docman'])) {
 						$new_group->setUseDocman($stream['setup']['data_array']['use_docman']);
+						if ($new_group->usesDocman() && isset($stream['docman'])) {
+							$filename = 'docmanDump-'.$stream['setup']['data_array']['group_id'].'.'.$format;
+							$this->createSubfile($filename, $stream['docman'], $format);
+							if (!$this->docmanImport($filename, $format)) {
+								echo _('Unable to inject docman')."\n";
+								db_rollback();
+								return false;
+							}
+							@unlink($filename);
+						}
+					} else {
+						$new_group->setUseDocman(false);
 					}
-					if (isset($stream['docman'])) {
-						$filename = 'docmanDump-'.$stream['setup']['data_array']['group_id'].'.'.$format;
-						$this->createSubfile($filename, $stream['docman'], $format);
-						if (!$this->docmanImport($filename, $format)) {
-							echo _('Unable to inject docman')."\n";
-							db_rollback();
-							return false;
+				}
+				// enable SCM if requested
+				if (forge_get_config('use_scm')) {
+					if (isset($stream['setup']['data_array']['use_scm'])) {
+						$new_group->setUseSCM($stream['setup']['data_array']['use_scm']);
+					} else {
+						$new_group->setUseSCM(false);
+					}
+				}
+				// enable activity if requested
+				if (forge_get_config('use_activity')) {
+					if (isset($stream['setup']['data_array']['use_activity'])) {
+						$new_group->setUseActivity($stream['setup']['data_array']['use_activity']);
+					} else {
+						$new_group->setUseActivity(false);
+					}
+				}
+				//inject FRS if any
+				if (forge_get_config('use_frs')) {
+					if (isset($stream['setup']['data_array']['use_frs'])) {
+						$new_group->setUseFRS($stream['setup']['data_array']['use_frs']);
+						if ($new_group->usesFRS() && isset($stream['frs'])) {
+							//TODO: do the injection :-)
 						}
-						@unlink($filename);
+					} else {
+						$new_group->setUseFRS(false);
+					}
+				}
+				//inject forum if any
+				if (forge_get_config('use_forum')) {
+					if (isset($stream['setup']['data_array']['use_frs'])) {
+						$new_group->setUseForum($stream['setup']['data_array']['use_frs']);
+						if ($new_group->usesForum() && isset($stream['frs']) && is_array($stream['forums'])) {
+							//TODO: do the injection :-)
+						}
+					} else {
+						$new_group->setUseForum(false);
 					}
 				}
 				// recompute if any association with activated & injected features.
@@ -600,6 +644,46 @@ class CliActions {
 					foreach($stream['setup']['roles'] as $role_def) {
 						$role = new Role($new_group);
 						$perms = array();
+						if (isset($role_def['perms_array'])) {
+							foreach ($role_def['perms_array'] as $key => $value) {
+								switch ($key) {
+									case 'project_admin':
+									case 'project_read':
+									case 'scm':
+									case 'docman':
+									case 'frs_admin':
+									case 'new_frs':
+									case 'tracker_admin':
+									case 'new_tracker':
+									case 'forum_admin':
+									case 'new_forum':
+									case 'pm_admin':
+									case 'new_pm':
+										$perms[$key][$this->getMappingId($stream['setup']['data_array']['group_id'], 'group')] = current($value);
+										break;
+// 									case 'frs':
+// 										foreach ($value as $frsp_key => $frsp_val) {
+// 											$perms[$key][$this->getMappingId($frsp_key, 'package')] = $frsp_val;
+// 										}
+// 										break;
+// 									case 'forum':
+// 										foreach ($value as $fr_key => $fr_val) {
+// 											$perms[$key][$this->getMappingId($fr_key, 'forum')] = $fr_val;
+// 										}
+// 										break;
+									case 'tracker':
+										foreach ($value as $at_key => $at_val) {
+											$perms[$key][$this->getMappingId($at_key, 'tracker')] = $at_val;
+										}
+										break;
+// 									case 'pm':
+// 										foreach ($value as $pm_key => $pm_val) {
+// 											$perms[$key][$this->getMappingId($pm_key, 'subproject')] = $pm_val;
+// 										}
+// 										break;
+								}
+							}
+						}
 						if (isset($role_def['data_array']['role_class']) && $role_def['data_array']['role_class'] == 1) {
 							if (!$role->create($role_def['data_array']['role_name'], $perms, true)) {
 								echo $role->getErrorMessage()."\n";

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=644b05f2583f9fcf5da05a1cd85d544d11884f81

commit 644b05f2583f9fcf5da05a1cd85d544d11884f81
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat May 27 17:26:43 2017 +0200

    space

diff --git a/src/common/include/Role.class.php b/src/common/include/Role.class.php
index 433618d..e19f8b2 100644
--- a/src/common/include/Role.class.php
+++ b/src/common/include/Role.class.php
@@ -150,7 +150,7 @@ class Role extends RoleExplicit implements PFO_RoleExplicit {
 	 *	@param	bool	$new_project
 	 *	@return bool|int		The id on success or false on failure.
 	 */
-	function create($role_name, $data, $new_project=false) {
+	function create($role_name, $data, $new_project = false) {
 		if ($this->Group == NULL) {
 			if (!forge_check_global_perm('forge_admin')) {
 				$this->setPermissionDeniedError();
@@ -177,7 +177,7 @@ class Role extends RoleExplicit implements PFO_RoleExplicit {
 					       array (htmlspecialchars($role_name)));
 			if (db_numrows($res)) {
 				$this->setError(_('Cannot create a role with this name (already used)'));
-				db_rollback () ;
+				db_rollback();
 				return false;
 			}
 		} else {
@@ -185,36 +185,36 @@ class Role extends RoleExplicit implements PFO_RoleExplicit {
 					       array ($this->Group->getID(), htmlspecialchars($role_name)));
 			if (db_numrows($res)) {
 				$this->setError(_('Cannot create a role with this name (already used)'));
-				db_rollback () ;
+				db_rollback();
 				return false;
 			}
 		}
 
 		if ($this->Group == NULL) {
 			$res = db_query_params ('INSERT INTO pfo_role (role_name) VALUES ($1)',
-						array (htmlspecialchars($role_name))) ;
+						array (htmlspecialchars($role_name)));
 		} else {
 			$res = db_query_params ('INSERT INTO pfo_role (home_group_id, role_name) VALUES ($1, $2)',
 						array ($this->Group->getID(),
-						       htmlspecialchars($role_name))) ;
+						       htmlspecialchars($role_name)));
 		}
 		if (!$res) {
 			$this->setError('create::'.db_error());
 			db_rollback();
 			return false;
 		}
-		$role_id=db_insertid($res,'pfo_role','role_id');
+		$role_id = db_insertid($res,'pfo_role','role_id');
 		if (!$role_id) {
 			$this->setError('create::db_insertid::'.db_error());
 			db_rollback();
 			return false;
 		}
-		$this->data_array['role_id'] = $role_id ;
-		$this->data_array['role_name'] = $role_name ;
+		$this->data_array['role_id'] = $role_id;
+		$this->data_array['role_name'] = $role_name;
 
-		$this->update ($role_name, $data) ;
+		$this->update($role_name, $data);
 
-		$this->normalizeData () ;
+		$this->normalizeData();
 
 		if (!$this->fetchData($role_id)) {
 			db_rollback();
@@ -281,13 +281,13 @@ class Role extends RoleExplicit implements PFO_RoleExplicit {
 					$this->setError('Error: FRS'.db_error());
 					return false;
 				}
-				for ($j=0; $j<db_numrows($res); $j++) {
-					$data['frs'][db_result($res, $j, 'package_id')]= $v;
+				for ($j = 0; $j < db_numrows($res); $j++) {
+					$data['frs'][db_result($res, $j, 'package_id')] = $v;
 				}
 			}
 		}
 
-		return $this->create($name,$data,false);
+		return $this->create($name, $data, false);
 	}
 
 	/**

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=235c88cbbd910db0bd3c8c160a7368e10f94ef53

commit 235c88cbbd910db0bd3c8c160a7368e10f94ef53
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat May 27 17:13:37 2017 +0200

    fix PHP warning

diff --git a/src/common/include/Group.class.php b/src/common/include/Group.class.php
index 983cc62..7a3c3ff 100644
--- a/src/common/include/Group.class.php
+++ b/src/common/include/Group.class.php
@@ -2186,14 +2186,17 @@ class Group extends FFError {
 		//
 		$add_u = user_get_object($user_id);
 		$found = false;
-		foreach ($this->membersArr as $u) {
-			if ($u->getID() == $add_u->getID()) {
-				$found = true;
-				break;
+		if (is_array($this->membersArr)) {
+			foreach ($this->membersArr as $u) {
+				if ($u->getID() == $add_u->getID()) {
+					$found = true;
+					break;
+				}
+			}
+			if (!$found) {
+				$this->membersArr[] = $add_u;
 			}
 		}
-		if (!$found)
-			$this->membersArr[] = $add_u;
 
 		return true;
 	}

-----------------------------------------------------------------------

Summary of changes:
 src/bin/forge                              | 122 ++++++++++++++++++++++++-----
 src/common/include/Group.class.php         |  15 ++--
 src/common/include/Role.class.php          |  26 +++---
 src/common/include/database-pgsql.php      |  10 +--
 src/common/tracker/EffortUnitSet.class.php |  39 +++------
 5 files changed, 142 insertions(+), 70 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list