updateFromCdpp.php 1.02 KB
<?php

	$json = json_decode(file_get_contents('php://input'), true);
	
	$commits = $json["commits"];
	$updateOnly = false;
	$newData = false;
	$to = "ebudnik@irap.omp.eu";

	
	foreach ($commits as $commit)
	{
		$msg = $commit['message'];
		if ($msg == 'UpdateOnly') 
		{
		  // UpdateAmda 
		  $updateOnly = true;
		  $messageUpdate = "TimesUpdate in CDPP.git";
		  $subjectUpdate = "AMDA Update Required : Time Update";
		}
		else if ($msg == 'NewData')
		{
		  // UpdateAmda -i
		  $newData = true;
		  $messageNewData = "New Data in CDPP.git";
		  $subjectNewData = "AMDA Update Required : New Data";
		}
		else
		{
		  $message = "Unqualified push in CDPP.git";
		  $subject = "Unqualified push in CDPP.git";
		}
	}

	$headers = "From:AMDA@".gethostname()."\r\nContent-type: text/plain; charset=UTF-8";
	
	if ($updateOnly) 
	  mail($to, $subjectUpdate, $messageUpdate, $headers);
	if ($newData) 
	  mail($to, $subjectNewData, $messageNewData, $headers); 
	
	if (!$updateOnly && !$newData)
		mail($to, $subject, $message, $headers);
	  
?>