[Fusionforge-commits] FusionForge branch master updated. v6.0.5-2045-g95cc2bc

Franck Villaume nerville at libremir.placard.fr.eu.org
Mon Jul 31 19:31:47 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  95cc2bc7e8c1689c15574dc5ffef64309e0e3f0e (commit)
       via  1e66f0e95f17c851b515e0b48dfaefa5cf921cd8 (commit)
      from  18de8fb2a16ae8ac2b0f3e91ec0a80ea82175f37 (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=95cc2bc7e8c1689c15574dc5ffef64309e0e3f0e

commit 95cc2bc7e8c1689c15574dc5ffef64309e0e3f0e
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Mon Jul 31 19:31:05 2017 +0200

    clean-up

diff --git a/src/plugins/scmhook/library/scmgit/commitTracker.class.php b/src/plugins/scmhook/library/scmgit/commitTracker.class.php
index 0b1066b..bf8b28a 100644
--- a/src/plugins/scmhook/library/scmgit/commitTracker.class.php
+++ b/src/plugins/scmhook/library/scmgit/commitTracker.class.php
@@ -140,13 +140,13 @@ class GitCommitTracker extends scmhook {
 	*
 	*/
 	function getTitleArr($group_id) {
-		$title_arr=array();
-		$title_arr[]=_('File Name').' ('.util_make_link('/scm/browser.php?group_id='.$group_id, _('Browse')).')';
-		$title_arr[]=_('Date');
-		$title_arr[]=_('Previous Version');
-		$title_arr[]=_('Current Version');
-		$title_arr[]=_('Log Message');
-		$title_arr[]=_('Author');
+		$title_arr   = array();
+		$title_arr[] = _('File Name').' ('.util_make_link('/scm/browser.php?group_id='.$group_id, _('Browse')).')';
+		$title_arr[] = _('Date');
+		$title_arr[] = _('Previous Version');
+		$title_arr[] = _('Current Version');
+		$title_arr[] = _('Log Message');
+		$title_arr[] = _('Author');
 		return $title_arr;
 	}
 
diff --git a/src/plugins/scmhook/library/scmsvn/hooks/committracker/post.php b/src/plugins/scmhook/library/scmsvn/hooks/committracker/post.php
index 460a2ab..40983e9 100755
--- a/src/plugins/scmhook/library/scmsvn/hooks/committracker/post.php
+++ b/src/plugins/scmhook/library/scmsvn/hooks/committracker/post.php
@@ -6,7 +6,7 @@
  * Portions Copyright 2004 (c) Roland Mas <99.roland.mas @nospam@ aist.enst.fr>
  * The rest Copyright 2004 (c) Francisco Gimeno <kikov @nospam@ kikov.org>
  * Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2013,2015-2016 Franck Villaume - TrivialDev
+ * Copyright 2013,2015-2017, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -34,17 +34,6 @@ require_once dirname(__FILE__).'/../../../../../../common/include/env.inc.php';
 require_once $gfcommon.'include/pre.php';
 
 /**
- * It returns the usage and exit program
- *
- * @param   string   $argv
- *
- */
-function usage( $argv ) {
-	echo "Usage: $argv[0] <Repository> <Revision> \n";
-	exit(0);
-}
-
-/**
  * It returns a list of involved artifacts.
  * An artifact is identified if [#(NUMBER)] if found.
  *
@@ -81,12 +70,9 @@ function getInvolvedTasks($Log)
 $files = array();
 
 if (count($argv) != 3) {
-    echo <<<USAGE
-Usage: $0 <repository> <revision>
-       This program should be automatically called by SVN
-USAGE;
-
-    exit;
+	echo "Usage: $argv[0] <Repository> <Revision> \n";
+	echo 'This program should be automatically called by SVN';
+	exit(0);
 }
 
 $repository = $argv[1];
diff --git a/src/plugins/scmhook/www/committracker/newcommitcvs.php b/src/plugins/scmhook/www/committracker/newcommitcvs.php
index 081fc04..6d9dd4d 100644
--- a/src/plugins/scmhook/www/committracker/newcommitcvs.php
+++ b/src/plugins/scmhook/www/committracker/newcommitcvs.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * scmhook plugin: CVS commitemail hook
+ * scmhook plugin: CVS committracker hook
  *
  * Copyright 2014, Philipp Keidel - EDAG Engineering AG
  *
@@ -92,8 +92,8 @@ function parseConfig(&$Config) {
 
 	// $repo_root = $repos_path.$GroupName;
 
-	$Result['group']    = group_get_object_by_name($Repository);
-	$Result['user']     = user_get_object_by_name($UserName);
+	$Result['group'] = group_get_object_by_name($Repository);
+	$Result['user']  = user_get_object_by_name($UserName);
 
 	if (!$Result['group'] || !is_object($Result['group']) ||
 		$Result['group']->isError() || !$Result['group']->isActive()) {
@@ -153,11 +153,10 @@ function addArtifactLog($Config, $GroupId, $Num) {
 							$Config['ActualVersion'],
 							$Config['UserName'])) ;
 			if(!$DBRes) {
-				$return['Error']="Problems with Artifact $Num: ".db_error()."\n";
+				$return['Error'] = "Problems with Artifact $Num: ".db_error()."\n";
 				db_rollback();
 			} else {
 				db_commit();
-				$lastID= db_insertid($DBRes,'plugin_scmhook_scmcvs_committracker_data_master','id');
 			}
 		}
 	}
@@ -184,7 +183,7 @@ function addTaskLog($Config, $GroupId, $Num) {
 					AND project_group_list.group_id=$2', array ($Num, $GroupId));
 	$Rows = db_numrows($Result);
 	if ($Rows == 0) {
-		$return['Error'] .= "Task:$Num Not Found.";
+		$return['Error'] .= "Task: $Num Not Found.";
 	}
 	if ($Rows == 1) {
 		db_begin();
@@ -242,4 +241,3 @@ if (isset($Configs) && is_array($Configs)) {
 		}
 	}
 }
-

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

commit 1e66f0e95f17c851b515e0b48dfaefa5cf921cd8
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Mon Jul 31 19:30:30 2017 +0200

    merge [#700] clean-up

diff --git a/src/plugins/scmhook/library/scmcvs/commitTracker.class.php b/src/plugins/scmhook/library/scmcvs/commitTracker.class.php
index eed93e0..3665f5d 100644
--- a/src/plugins/scmhook/library/scmcvs/commitTracker.class.php
+++ b/src/plugins/scmhook/library/scmcvs/commitTracker.class.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * scmhook commitTracker Plugin Class
+ * scmhook CVSCommitTracker Plugin Class
  * Copyright 2014, Philipp Keidel - EDAG Engineering AG
  * Copyright 2017, Franck Villaume - TrivialDev
  *
@@ -38,7 +38,7 @@ class CVSCommitTracker extends scmhook {
 		$this->needcopy = 0;
 		// $filepath = forge_get_config('plugins_path') . '/scmhook/library/' . $this->label . '/hooks/' . $this->unixname . '/post.php';
 		// $this->command = '/usr/bin/php ' . $filepath . ' "$1" "$2"';
-		$filepath = forge_get_config('plugins_path') . '/scmhook/library/' . $this->label . '/hooks/cvs_wrapper.php';
+		$filepath = forge_get_config('plugins_path').'/scmhook/library/'.$this->label.'/hooks/cvs_wrapper.php';
 		$this->command = 'ALL /usr/bin/php '.$filepath.' '.$this->hooktype.' progress %{sVv} $USER';
 	}
 
@@ -46,8 +46,8 @@ class CVSCommitTracker extends scmhook {
 		if ($this->group->usesTracker()) {
 			return true;
 		}
-		$this->disabledMessage = _('Hook not available due to missing dependency: Project not using tracker.');
-		$this->description = "[".$this->disabledMessage."] ".$this->description;
+		$this->disabledMessage = _('Hook not available due to missing dependency')._(': ')._('Project not using tracker.');
+		$this->description = '['.$this->disabledMessage.'] '.$this->description;
 		return false;
 	}
 
@@ -56,20 +56,22 @@ class CVSCommitTracker extends scmhook {
 	}
 
 	function artifact_extra_detail($params) {
+		global $HTML;
 		$DBResult = db_query_params('SELECT * FROM plugin_scmhook_scmcvs_committracker_data_master dm, plugin_scmhook_scmcvs_committracker_data_artifact da
 					WHERE da.group_artifact_id = $1 AND dm.holder_id = da.id ORDER BY cvs_date desc', array($params['artifact_id']));
 		if (!$DBResult) {
-			echo '<p class="error_msg">'._('Unable to retrieve data').'</p>';
+			echo $HTML->error_msg(_('Unable to retrieve data'));
 		} else {
 			$this->getCommitEntries($DBResult, $params['group_id']);
 		}
 	}
 
 	function task_extra_detail($params) {
+		global $HTML;
 		$DBResult = db_query_params ('SELECT * FROM plugin_scmhook_scmcvs_committracker_data_master dm, plugin_scmhook_scmcvs_committracker_data_artifact da
 					WHERE da.project_task_id = $1 AND dm.holder_id = da.id ORDER BY cvs_date desc', array($params['task_id']));
 		if (!$DBResult) {
-			echo '<p class="error_msg">'._('Unable to retrieve data').'</p>';
+			echo $HTML->error_msg(_('Unable to retrieve data'));
 		} else {
 			$this->getCommitEntries($DBResult, $params['group_id']);
 		}
@@ -86,28 +88,30 @@ class CVSCommitTracker extends scmhook {
 		global $HTML;
 		$group = group_get_object($group_id);
 		$Rows= db_numrows($DBResult);
+		$return = '';
 
 		if ($Rows > 0) {
-			echo '<tr><td>';
-			echo '<h2>'._('Related CVS commits').'</h2>';
+			$return .= '<tr><td>';
+			$return .= html_e('h2', array(), _('Related CVS commits'), false);
 
 			$title_arr = $this->getTitleArr();
 			echo $HTML->listTableTop($title_arr);
 
-			for ($i=0; $i<$Rows; $i++) {
-				$Row = db_fetch_array($DBResult);
-				echo '<tr ' . $HTML->boxGetAltRowStyle($i) .'>'.
-					'<td>' . $this->getFileLink($group->getUnixName(), $Row['file'],$Row['actual_version']) . '</td>'.
-					'<td>' . date(_('Y-m-d'), $Row['cvs_date']).'</td>'.
-					'<td>' . $this->getDiffLink($group->getUnixName(), $Row['file'], $Row['prev_version'], $Row['actual_version']) . '</td>'.
-					'<td>' . $this->getActualVersionLink($group->getUnixName(), $Row['file'], $Row['actual_version']) . '</td>
-						<td>' . htmlspecialchars($Row['log_text']).'</td>
-						<td>' . util_make_link_u($Row['author'], user_get_object_by_name($Row['author'])->getId(), $Row['author']) . '</td>
-					</tr>';
+			while ($Row = db_fetch_array($DBResult)) {
+				$cells = array();
+				$cells[][] = $this->getFileLink($group->getUnixName(), $Row['file'],$Row['actual_version']);
+				$cells[][] = date(_('Y-m-d'), $Row['cvs_date']);
+				$cells[][] = $this->getDiffLink($group->getUnixName(), $Row['file'], $Row['prev_version'], $Row['actual_version']);
+				$cells[][] = $this->getActualVersionLink($group->getUnixName(), $Row['file'], $Row['actual_version']);
+				$cells[][] = htmlspecialchars($Row['log_text']);
+				$commituser = user_get_object_by_name($Row['author']);
+				$cells[][] = util_display_user($commituser->getUnixName(), $commituser->getId(), $commituser->getRealname());
+				$return .= $HTML->multiTableRow(array(), $cells);
 			}
-			echo $HTML->listTableBottom();
-			echo '</td></tr>';
+			$return .= $HTML->listTableBottom();
+			$return .= '</td></tr>';
 		}
+		return $return;
 	}
 
 	/**
@@ -138,7 +142,7 @@ class CVSCommitTracker extends scmhook {
 	 *
 	 */
 	function getFileLink($GroupName, $FileName, $LatestRevision) {
-		return util_make_link ('/scm/viewvc.php/'.$FileName . '?root='.$GroupName.'&view=log&rev=' . $LatestRevision, $FileName) ;
+		return util_make_link('/scm/viewvc.php/'.$FileName . '?root='.$GroupName.'&view=log&rev=' . $LatestRevision, $FileName) ;
 	}
 
 	/**
@@ -152,7 +156,7 @@ class CVSCommitTracker extends scmhook {
 	 *
 	 */
 	 function getActualVersionLink($GroupName, $FileName, $Version) {
-		return util_make_link ('/scm/viewvc.php/'.$FileName . '?root='.$GroupName.'&rev='.$Version, $Version);
+		return util_make_link('/scm/viewvc.php/'.$FileName . '?root='.$GroupName.'&rev='.$Version, $Version);
 	}
 
 	/**
@@ -167,8 +171,9 @@ class CVSCommitTracker extends scmhook {
 	 *
 	 */
 	function getDiffLink($GroupName, $FileName, $PrevVersion, $ActualVersion) {
-		if($PrevVersion != 'NONE' && $ActualVersion != 'NONE')
-			return util_make_link ('/scm/viewvc.php/'.$FileName . '?root='.$GroupName.'&r1='.$PrevVersion . '&r2='.$ActualVersion, _('Diff To').' '.$PrevVersion);
+		if($PrevVersion != 'NONE' && $ActualVersion != 'NONE') {
+			return util_make_link('/scm/viewvc.php/'.$FileName . '?root='.$GroupName.'&r1='.$PrevVersion . '&r2='.$ActualVersion, _('Diff To').' '.$PrevVersion);
+		}
 		return _('Wrong situation');
 	}
 }
diff --git a/src/plugins/scmhook/library/scmcvs/cronjobs/updateScmRepo.php b/src/plugins/scmhook/library/scmcvs/cronjobs/updateScmRepo.php
index 847a3bf..3635924 100644
--- a/src/plugins/scmhook/library/scmcvs/cronjobs/updateScmRepo.php
+++ b/src/plugins/scmhook/library/scmcvs/cronjobs/updateScmRepo.php
@@ -86,7 +86,7 @@ class ScmCvsUpdateScmRepo {
 				}
 			}
 
-			$loginfo = "$cvsdir_root/CVSROOT/loginfo";
+			$loginfo = $cvsdir_root.'/CVSROOT/loginfo';
 			if (count($newHooksPostCommit)) {
 				// Befehl in /CVSROOT/loginfo eintragen
 				$content = file_get_contents($loginfo);
@@ -101,10 +101,10 @@ class ScmCvsUpdateScmRepo {
 			} else 	{
 				// Befehl aus /CVSROOT/loginfo entfernen
 				$content = file_get_contents($loginfo);
-				file_put_contents($loginfo, "");
+				file_put_contents($loginfo, '');
 				$oldLines = explode("\n", $content);
 				foreach($oldLines as $line) {
-					if(substr($line, 0, 1) == "#" || strpos($line, "cvs_wrapper.php") === false) {
+					if(substr($line, 0, 1) == '#' || strpos($line, 'cvs_wrapper.php') === false) {
 						file_put_contents($loginfo, "$line\n", FILE_APPEND);
 					}
 				}
diff --git a/src/plugins/scmhook/library/scmcvs/hooks/committracker/post.php b/src/plugins/scmhook/library/scmcvs/hooks/committracker/post.php
index 657d18a..98afce3 100644
--- a/src/plugins/scmhook/library/scmcvs/hooks/committracker/post.php
+++ b/src/plugins/scmhook/library/scmcvs/hooks/committracker/post.php
@@ -1,7 +1,10 @@
 #! /usr/bin/php
 <?php
 /**
- * Copyright (C) 2014 Philipp Keidel - EDAG Engineering AG
+ * Fusionforge Plugin Scmhook scmcvs committracker HTTPPoster
+ *
+ * Copyright 2014, Philipp Keidel - EDAG Engineering AG
+ * Copyrigth 2017, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -35,9 +38,9 @@ require_once $gfcommon.'include/pre.php';
  * @return	string	$Result	Returns artifact.
  */
 function getInvolvedArtifacts($Log) {
-	preg_match_all('/[\[]#[\d]+[\]]/', $Log,  $Matches );
+	preg_match_all('/[\[]#[\d]+[\]]/', $Log,  $Matches);
 	foreach($Matches as $Match) {
-		$Result = preg_replace ('/[[]#([\d]+)[]]/', '\1', $Match);
+		$Result = preg_replace('/[[]#([\d]+)[]]/', '\1', $Match);
 	}
 	return $Result;
 }
@@ -51,9 +54,9 @@ function getInvolvedArtifacts($Log) {
  * @return	string	$Result	Returns artifact.
  */
 function getInvolvedTasks($Log) {
-	preg_match_all('/[\[]T[\d]+[\]]/', $Log,  $Matches );
+	preg_match_all('/[\[]T[\d]+[\]]/', $Log,  $Matches);
 	foreach($Matches as $Match) {
-		$Result = preg_replace ('/[[]T([\d]+)[]]/', '\1', $Match);
+		$Result = preg_replace('/[[]T([\d]+)[]]/', '\1', $Match);
 	}
 	return $Result;
 }
@@ -90,18 +93,16 @@ $tmpname     = $argv[1];
 $stdin       = file_get_contents($tmpname);
 $projectname = $argv[2];
 $username    = $argv[4];
-$misc        = explode(" ", $argv[3], 2); // db\/usersess\/appserver admin_env,1.58,1.59 codecheck,1.16,1.17
+$misc        = explode(' ', $argv[3], 2); // db\/usersess\/appserver admin_env,1.58,1.59 codecheck,1.16,1.17
 $dirpath     = $misc[0];
 
-$files       = explode(" ", $misc[1]);
+$files       = explode(' ', $misc[1]);
 $allfiles    = array();
 
 unlink($tmpname);
 
-echo "dirpath: $dirpath\n";
-
 foreach($files as $file) {
-	$i = explode(",", $file);
+	$i = explode(',', $file);
 	$allfiles[] = array(
 			'filename' => $i[0],
 			'oldrev'   => $i[1],
@@ -125,16 +126,16 @@ $SubmitUrl = util_make_url('/plugins/scmhook/committracker/newcommitcvs.php');
 $SubmitVars = array();
 $i = 0;
 foreach ( $allfiles as $onefile ) {
-	$SubmitVars[$i]["UserName"]        = $username;
-	$SubmitVars[$i]["Repository"]      = $projectname;
-	$SubmitVars[$i]["Directory"]       = $dirpath;
-	$SubmitVars[$i]["FileName"]        = $onefile['filename'];
-	$SubmitVars[$i]["PrevVersion"]     = $onefile['oldrev'];
-	$SubmitVars[$i]["ActualVersion"]   = $onefile['newrev'];
-	$SubmitVars[$i]["Log"]             = $logmessage;
-	$SubmitVars[$i]["TaskNumbers"]     = $tasks_involved;
-	$SubmitVars[$i]["ArtifactNumbers"] = $artifacts_involved;
-	$SubmitVars[$i]["CVSDate"]         = time();
+	$SubmitVars[$i]['UserName']        = $username;
+	$SubmitVars[$i]['Repository']      = $projectname;
+	$SubmitVars[$i]['Directory']       = $dirpath;
+	$SubmitVars[$i]['FileName']        = $onefile['filename'];
+	$SubmitVars[$i]['PrevVersion']     = $onefile['oldrev'];
+	$SubmitVars[$i]['ActualVersion']   = $onefile['newrev'];
+	$SubmitVars[$i]['Log']             = $logmessage;
+	$SubmitVars[$i]['TaskNumbers']     = $tasks_involved;
+	$SubmitVars[$i]['ArtifactNumbers'] = $artifacts_involved;
+	$SubmitVars[$i]['CVSDate']         = time();
 	$i++;
 }
 
diff --git a/src/plugins/scmhook/library/scmcvs/hooks/cvs_wrapper.php b/src/plugins/scmhook/library/scmcvs/hooks/cvs_wrapper.php
index 489ac3c..df75668 100644
--- a/src/plugins/scmhook/library/scmcvs/hooks/cvs_wrapper.php
+++ b/src/plugins/scmhook/library/scmcvs/hooks/cvs_wrapper.php
@@ -1,6 +1,8 @@
 #!/usr/bin/php
+<?php
 /**
- * Copyright (C) 2014 Philipp Keidel - EDAG Engineering AG
+ * Copyright 2014, Philipp Keidel - EDAG Engineering AG
+ * Copyright 2017, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -18,26 +20,27 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-<?php
+require_once dirname(__FILE__).'/../../../../../common/include/env.inc.php';
+require_once $gfcommon.'include/pre.php';
 
-$script_name=$argv[1];
+$script_name = $argv[1];
 
-if ( $script_name == "post-commit" ) {
-	$script_path="/usr/share/gforge/plugins/scmhook/library/scmcvs/hooks/committracker/post.php";
+if ($script_name == 'post-commit') {
+	$script_path = forge_get_config('plugins_path').'/scmhook/library/scmcvs/hooks/committracker/post.php';
 } else {
-	echo "Invalid script specified: $script_name";
+	echo _('Invalid script specified')._(': ').$script_name;
 	exit(1);
 }
 
 $args = '';
-for ($i=2; $i<count($argv); $i++) {
+for ($i = 2; $i < count($argv); $i++) {
 	$args .= escapeshellarg($argv[$i]).' ';
 }
 
 $filepath = tempnam("/tmp", "cvswrapper_");
 file_put_contents($filepath, file_get_contents("php://stdin"));
 
-$command = "cd /usr/share/gforge/plugins/ && php $script_path \"$filepath\" $args";
+$command = 'cd '.forge_get_config('plugins_path').' && php '.$script_path.' "'.$filepath.'" '.$args;
 $ouptut = array();
 
 $retval = execute($command, $output);
diff --git a/src/plugins/scmhook/library/scmcvs/skel/post-commit/head b/src/plugins/scmhook/library/scmcvs/skel/post-commit/head
index 829303e..1a24852 100644
--- a/src/plugins/scmhook/library/scmcvs/skel/post-commit/head
+++ b/src/plugins/scmhook/library/scmcvs/skel/post-commit/head
@@ -1,3 +1 @@
 #!/bin/sh
-
-

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

Summary of changes:
 .../scmhook/library/scmcvs/commitTracker.class.php | 53 ++++++++++++----------
 .../library/scmcvs/cronjobs/updateScmRepo.php      |  6 +--
 .../library/scmcvs/hooks/committracker/post.php    | 41 +++++++++--------
 .../scmhook/library/scmcvs/hooks/cvs_wrapper.php   | 19 ++++----
 .../scmhook/library/scmcvs/skel/post-commit/head   |  2 -
 .../scmhook/library/scmgit/commitTracker.class.php | 14 +++---
 .../library/scmsvn/hooks/committracker/post.php    | 22 ++-------
 .../scmhook/www/committracker/newcommitcvs.php     | 12 ++---
 8 files changed, 80 insertions(+), 89 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list