Commit 7a88f1b3fa27b751e6766b60a3aca8ec19f02048

Authored by Elena.Budnik
1 parent 941e6524

webhooks

Showing 2 changed files with 91 additions and 0 deletions   Show diff stats
updateFromAmdaInternal.php 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +<?php
  2 +
  3 + $json = json_decode(file_get_contents('php://input'), true);
  4 +
  5 + $commits = $json["commits"];
  6 + $updateOnly = false;
  7 + $newData = false;
  8 + $to = "ebudnik@irap.omp.eu";
  9 +
  10 +
  11 + foreach ($commits as $commit)
  12 + {
  13 + $msg = $commit['message'];
  14 + if ($msg == 'UpdateOnly')
  15 + {
  16 + // UpdateAmda
  17 + $updateOnly = true;
  18 + $messageUpdate = "Updates in AMDA_INTERNAL_METADATA.git : without args generation";
  19 + $subjectUpdate = "AMDA Update Required";
  20 + }
  21 + else if ($msg == 'NewData')
  22 + {
  23 + // UpdateAmda -i
  24 + $newData = true;
  25 + $messageNewData = "New Data in AMDA_INTERNAL_METADATA.git : with args generation";
  26 + $subjectNewData = "AMDA Update Required";
  27 + }
  28 + else
  29 + {
  30 + $message = "Unqualified push in AMDA_INTERNAL_METADATA.git";
  31 + $subject = "Unqualified push in AMDA_INTERNAL_METADATA.git";
  32 + }
  33 + // error_log($msg,3,'/home/budnik/AMDA/AMDA_IHM/HOOK');
  34 + }
  35 +
  36 + $headers = "From:AMDA@".gethostname()."\r\nContent-type: text/plain; charset=UTF-8";
  37 +
  38 + if ($updateOnly)
  39 + mail($to, $subjectUpdate, $messageUpdate, $headers);
  40 + if ($newData)
  41 + mail($to, $subjectNewData, $messageNewData, $headers);
  42 +
  43 + if (!$updateOnly && !$newData)
  44 + mail($to, $subject, $message, $headers);
  45 +
  46 +?>
... ...
updateFromCdpp.php 0 → 100755
... ... @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 + $json = json_decode(file_get_contents('php://input'), true);
  4 +
  5 + $commits = $json["commits"];
  6 + $updateOnly = false;
  7 + $newData = false;
  8 + $to = "ebudnik@irap.omp.eu";
  9 +
  10 +
  11 + foreach ($commits as $commit)
  12 + {
  13 + $msg = $commit['message'];
  14 + if ($msg == 'UpdateOnly')
  15 + {
  16 + // UpdateAmda
  17 + $updateOnly = true;
  18 + $messageUpdate = "TimesUpdate in CDPP.git";
  19 + $subjectUpdate = "AMDA Update Required : Time Update";
  20 + }
  21 + else if ($msg == 'NewData')
  22 + {
  23 + // UpdateAmda -i
  24 + $newData = true;
  25 + $messageNewData = "New Data in CDPP.git";
  26 + $subjectNewData = "AMDA Update Required : New Data";
  27 + }
  28 + else
  29 + {
  30 + $message = "Unqualified push in CDPP.git";
  31 + $subject = "Unqualified push in CDPP.git";
  32 + }
  33 + }
  34 +
  35 + $headers = "From:AMDA@".gethostname()."\r\nContent-type: text/plain; charset=UTF-8";
  36 +
  37 + if ($updateOnly)
  38 + mail($to, $subjectUpdate, $messageUpdate, $headers);
  39 + if ($newData)
  40 + mail($to, $subjectNewData, $messageNewData, $headers);
  41 +
  42 + if (!$updateOnly && !$newData)
  43 + mail($to, $subject, $message, $headers);
  44 +
  45 +?>
... ...