updateFromCdpp.php
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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);
?>