[evolvis-commits] r10661: a lot of fixes↵

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Feb 24 17:53:05 CET 2011


Author: mirabilos
Date: 2011-02-24 17:53:05 +0100 (Thu, 24 Feb 2011)
New Revision: 10661

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/post.php
   trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/update_loginfo.php
Log:
a lot of fixes


Modified: trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/post.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/post.php	2011-02-24 16:53:04 UTC (rev 10660)
+++ trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/post.php	2011-02-24 16:53:05 UTC (rev 10661)
@@ -30,7 +30,9 @@
  *  HTTP POSTs to /plugins/cvstracker/newcommit.php.
  *
  */
-require ('plugins/cvstracker/cvstracker.conf');
+ 
+require ('local.inc');
+require ('plugins/cvstracker/config.php');
 require ($sys_plugins_path.'/cvstracker/include/Snoopy.class');
 
 /**
@@ -102,18 +104,44 @@
 	return $Log;
 }
 
-if ($argc < 6 ) {
-	usage ( $argv );
-}
+$files = array();
+if($argc == 3) {
+	$repository      = $argv[1];
+	$parameters = explode(' ', $argv[2]);
+	$path = $parameters[0];
+	
+	for($i = 1; $i < count($parameters); $i++) {
+		$filesInformation = explode(',', trim($parameters[$i], ','));
 
-if ( (($argc - 3) % 3 ) != 0 )
-{
-	echo "There should be 3 params + 3*N, instead of $argc\n";
-	usage ( $argv );
+		$files[] = array(
+			'name' => $filesInformation[0],
+			'previous' => $filesInformation[1],
+			'actual' => $filesInformation[2]
+		);
+	}
+	
+} else {
+	if ($argc < 6 ) {
+		usage ( $argv );
+	}
+	
+	if ( (($argc - 3) % 3 ) != 0 ) {
+		echo "There should be 3 params + 3*N, instead of $argc\n";
+		usage ( $argv );
+	}
+	$NumFiles= (($argc-3) / 3 ); // 3 Fixed params + 3 * File
+	$repository      = $argv[1];
+	$path            = $argv[2];
+	
+	for ( $i=0; $i < $NumFiles; $i++ ) {
+		$files[] = array(
+			'name' => $argv[3 + 3*$i],
+			'previous' => $argv[4 + 3*$i],
+			'actual' => $argv[5 + 3*$i]
+		);
+	}
 }
 
-$NumFiles= (($argc-3) / 3 ); // 3 Fixed params + 3 * File
-
 // Our POSTer in Gforge
 $snoopy = new Snoopy;
 
@@ -125,14 +153,14 @@
 $Input = file_get_contents ("/dev/stdin" );
 $Log   = getLog($Input);
 
-for ( $i=0; $i < $NumFiles; $i++ )
+foreach ( $files as $file )
 {
 	$SubmitVars["UserName"]        = $UserName;
-	$SubmitVars["Repository"]      = $argv[1];
-	$SubmitVars["Path"]            = $argv[2];
-	$SubmitVars["FileName"]        = $argv[3 + 3*$i];
-	$SubmitVars["PrevVersion"]     = $argv[4 + 3*$i];
-	$SubmitVars["ActualVersion"]   = $argv[5 + 3*$i];
+	$SubmitVars["Repository"]      = $repository;
+	$SubmitVars["Path"]            = $path;
+	$SubmitVars["FileName"]        = $file['name'];
+	$SubmitVars["PrevVersion"]     = $file['previous'];
+	$SubmitVars["ActualVersion"]   = $file['actual'];
 	$SubmitVars["Log"]             = $Log;
 	$SubmitVars["TaskNumbers"]     = getInvolvedTasks($Log);
 	$SubmitVars["ArtifactNumbers"] = getInvolvedArtifacts($Log);
@@ -145,4 +173,4 @@
 	print $snoopy->results;
 }
 
-?>
+?>
\ No newline at end of file

Modified: trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/update_loginfo.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/update_loginfo.php	2011-02-24 16:53:04 UTC (rev 10660)
+++ trunk/gforge_base/evolvisforge-5.1/gforge-plugin-cvstracker/bin/update_loginfo.php	2011-02-24 16:53:05 UTC (rev 10661)
@@ -28,22 +28,36 @@
  */
 require ('squal_pre.php');
 require ('common/include/cron_utils.php');
+require ('plugins/cvstracker/config.php');
 
-require ('plugins/cvstracker/cvstracker.conf');
-
 $Res = db_query("SELECT * FROM groups WHERE status='A';");
 if (!$Res) {
         echo "Error. Couldn't get Group List!\n";
 }
+
+function addCvsTrackerToFile($path) {
+	global $sys_plugins_path, $sys_users_host;
+	
+	$FOut = fopen($path, "a");
+	if($FOut) {
+		fwrite($FOut, "# BEGIN added by gforge-plugin-cvstracker\n");
+		$Line = "ALL ( php -q -d include_path=".ini_get('include_path').
+			" ".$sys_plugins_path."/cvstracker/bin/post.php".
+			" %{sVv} )\n";
+		fwrite($FOut,$Line);
+		fwrite($FOut, "# END added by gforge-plugin-cvstracker\n");
+		fclose($FOut);
+	}
+}
+
 while ($Row = db_fetch_array($Res)) {
 	$Group = group_get_object($Row["group_id"]);
 	if ($Group->usesPlugin("cvstracker")) {
 		$LineFound=FALSE;
-		$FIn  = fopen($sys_cvsroot_path."/".$Row["unix_group_name"].
-			"/CVSROOT/loginfo","r");
+		$FIn  = fopen($sys_cvsroot_path."/".$Row["unix_group_name"]."/CVSROOT/loginfo","r");
+		
 		if ($FIn) {
 			while (!feof($FIn))  {
-
 				$Line = fgets ($FIn);
 				if(!preg_match("/^#/", $Line) &&
 					preg_match("/cvstracker/",$Line)) {
@@ -52,26 +66,12 @@
 			}
 			fclose($FIn);
 			if($LineFound==FALSE) {
-				echo "loginfo modified\n";
-				$FOut = fopen($sys_cvsroot_path."/".
-					$Row["unix_group_name"].
-					"/CVSROOT/loginfo","a");
-				if($FOut) {
-					fwrite($FOut,
-						"# Added by Gforge-plugin-cvstracker \n");
-					$Line = "ALL ( ".$sys_plugins_path.
-						"/cvstracker/bin/post.php -d ".
-						"include_path=".$sys_urlroot.":".
-						$sys_urlroot.
-						"/www/include %r".
-						" %p %{sVv}; cat ) | mail `id -un`@".$sys_users_host."\n";
-					fwrite($FOut,$Line);
-					fclose($FOut);
-				}
+				echo $Group->getUnixName().": loginfo modified\n";
+				addCvsTrackerToFile($sys_cvsroot_path."/".$Row["unix_group_name"]."/CVSROOT/loginfo");
 			}
 		}
 	}
 }
 
 
-?>
+?>
\ No newline at end of file



More information about the evolvis-commits mailing list