[Fusionforge-commits] FusionForge branch master updated. v6.0.5-1486-gdcfa394

Franck Villaume nerville at libremir.placard.fr.eu.org
Sat Mar 4 17:46:47 CET 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  dcfa3949ef5b0d7cfaadac040a1492bffcc7d415 (commit)
       via  bc856feee0e2fa3ca794365e58d35d2ed3481c6d (commit)
      from  8dd1dc5aecd649469f66875d61fd40dcb8bba976 (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=dcfa3949ef5b0d7cfaadac040a1492bffcc7d415

commit dcfa3949ef5b0d7cfaadac040a1492bffcc7d415
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Mar 4 17:46:25 2017 +0100

    forge cli: fix artifactDump, enhance other dumps

diff --git a/src/bin/forge b/src/bin/forge
index 8c0da7b..ce2195a 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -125,20 +125,29 @@ class CliActions {
 		$pm->deactivate($name);
 	}
 
-	function artifactDump($aid, $params = array('latest', 'json', 'print')) {
+	function artifactDump($aid, $params = array('latest', 'json')) {
 		$artifactDump = array();
+		$artifactDump['id'] = $aid;
 		$artf = artifact_get_object($aid);
 		if ($artf && is_object($artf) && !$artf->isError()) {
 			switch ($params[0]) {
 				case 'all':
-					$artifactDump['history'] = $artf->getHistory();
+					$artifactDump['history'] = array();
+					$hist = $artf->getHistory();
+					if (db_numrows($hist) > 0) {
+						while ($arr = db_fetch_array($hist, null, PGSQL_ASSOC)) {
+							$artifactDump['history'][] = $arr;
+						}
+					}
+
 				case 'latest':
 					$artifactDump['artifact'] = (array)$artf;
+					unset($artifactDump['artifact']['ArtifactType']);
 					$artifactDump['monitor'] = $artf->getMonitorIds();
 					$artifactDump['messages'] = array();
 					$messages = $artf->getMessages();
 					if (db_numrows($messages) > 0) {
-						while ($arr = db_fetch_array($messages)) {
+						while ($arr = db_fetch_array($messages, null, PGSQL_ASSOC)) {
 							$artifactDump['messages'] = $arr;
 						}
 					}
@@ -146,7 +155,7 @@ class CliActions {
 					$artifactDump['tasks'] = array();
 					$tasks = $artf->getRelatedTasks();
 					if (db_numrows($tasks) > 0) {
-						while ($arr = db_fetch_array($tasks)) {
+						while ($arr = db_fetch_array($tasks, null, PGSQL_ASSOC)) {
 							$artifactDump['tasks'][] = $arr;
 						}
 					}
@@ -158,11 +167,14 @@ class CliActions {
 		} else {
 			$artifactDump['error'][] = _('Unable to get artifact id')._(': ').$aid;
 		}
+		ksort($artifactDump);
 		$this->print_result($artifactDump, $params);
+		return $artifactDump;
 	}
 
-	function groupDump($group_id, $params = array('setup', 'json', 'print')) {
+	function groupDump($group_id, $params = array('setup', 'json')) {
 		$groupDump = array();
+		$groupDump['id'] = $group_id;
 		$group = group_get_object($group_id);
 		if ($group && is_object($group) && !$group->isError()) {
 			switch ($params[0]) {
@@ -240,11 +252,12 @@ class CliActions {
 		} else {
 			$groupDump['error'][] = _('Unable to get group id')._(': ').$group_id;
 		}
+		ksort($groupDump);
 		$this->print_result($groupDump, $params);
 	}
 
 	function trackerDump($atid, $params = array('setup', 'json')) {
-		$trackerDump['trackerid'] = $atid;
+		$trackerDump['id'] = $atid;
 		$at = artifactType_get_object($atid);
 		if ($at && is_object($at) && !$at->isError()) {
 			switch ($params[0]) {
@@ -256,10 +269,8 @@ class CliActions {
 						$af->setup(0, '', '', 0, 'overwrite', false, false, array(), false);
 						$artifacts = $af->getArtifacts();
 						foreach ($artifacts as $artf) {
-							//we do not need this information.
-							unset($artf->ArtifactType);
+							$trackerDump['data'][] = $this->artifactDump($artf->getID(), array('all', 'return'));
 						}
-						$trackerDump['data'] = $artifacts;
 					} else {
 						$trackerDump['error'][] = _('Unable to retrieve artifacts');
 					}
@@ -274,6 +285,7 @@ class CliActions {
 		} else {
 			$trackerDump['error'][] = _('Unable to get tracker id')._(': ').$atid;
 		}
+		ksort($trackerDump);
 		$this->print_result($trackerDump, $params);
 		return $trackerDump;
 	}
@@ -308,6 +320,7 @@ class CliActions {
 		} else {
 			$docmanDump['error'][] = _('Unable to get group id')._(': ').$group_id;
 		}
+		ksort($docmanDump);
 		$this->print_result($docmanDump, $params);
 		return $docmanDump;
 	}

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

commit bc856feee0e2fa3ca794365e58d35d2ed3481c6d
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Mar 4 17:45:37 2017 +0100

    space vs. tab + enhance db_fetch_array

diff --git a/src/common/include/database-pgsql.php b/src/common/include/database-pgsql.php
index 3487dbc..95b9c31 100644
--- a/src/common/include/database-pgsql.php
+++ b/src/common/include/database-pgsql.php
@@ -542,8 +542,8 @@ function db_free_result($qhandle) {
  * db_result - Returns a field from a result set.
  *
  * @param	resource	$qhandle	Query result set handle.
- * @param	int		$row	Row number.
- * @param	string		$field	Field name.
+ * @param	int		$row		Row number.
+ * @param	string		$field		Field name.
  * @return	mixed		contents of field from database.
  */
 function db_result($qhandle, $row, $field) {
@@ -553,8 +553,8 @@ function db_result($qhandle, $row, $field) {
 /**
  * db_result_seek - Sets cursor location in a result set.
  *
- * @param	resource $qhandle Query result set handle.
- * @param	int	$row Row number.
+ * @param	resource $qhandle	Query result set handle.
+ * @param	int	$row		Row number.
  * @return	boolean	True on success
  */
 function db_result_seek($qhandle,$row) {
@@ -565,7 +565,7 @@ function db_result_seek($qhandle,$row) {
  * db_result_reset - Resets cursor location in a result set.
  *
  * @param	resource	$qhandle	Query result set handle.
- * @param	int	$row
+ * @param	int		$row
  * @return	boolean	True on success
  */
  //TODO : remove the second param if no one uses it.
@@ -609,11 +609,11 @@ function db_affected_rows($qhandle) {
  * the current row of this database result
  *
  * @param	resource	$qhandle	Query result set handle.
- * @param	bool		$row
+ * @param	const		$result_type	Result type PGSQL_ASSOC, PGSQL_NUM et PGSQL_BOTH
  * @return array array of fieldname/value key pairs.
  */
-function db_fetch_array($qhandle, $row = false) {
-	return @pg_fetch_array($qhandle);
+function db_fetch_array($qhandle, $result_type = PGSQL_BOTH) {
+	return @pg_fetch_array($qhandle, null, $result_type);
 }
 
 /**

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

Summary of changes:
 src/bin/forge                         | 31 ++++++++++++++++++++++---------
 src/common/include/database-pgsql.php | 16 ++++++++--------
 2 files changed, 30 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list