-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrigger.php
56 lines (51 loc) · 1.22 KB
/
trigger.php
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
46
47
48
49
50
51
52
53
54
55
56
<?php
/* GET args:
* c[omponent]=[fiteagle]
*/
/**
* configuration
*/
$app_config = array(
'fiteagle' => array( 'state_file' => "/tmp/fiteagle_module-ci-ok.txt"),
'omn' => array( 'state_file' => "/tmp/fiteagle_module-ci-ok.txt"),
'integration' => array( 'state_file' => "/tmp/fiteagle_integration-ok.txt"),
'integration-bin' => array( 'state_file' => "/tmp/fiteagle_integration-ok.txt"),
'integration-src' => array('ignore' => 1)
);
//print_r($_REQUEST);
if (isset($_REQUEST['component'])){
$component = $_REQUEST['component'];
}else if (isset($_REQUEST['c'])){
$component = $_REQUEST['c'];
}else{
http_response_code(404);
echo "Unknown component\n";
exit();
}
if (!empty($component) && !empty($app_config[$component]))
{
// $text = date("c\n");
$text = time() . "\n";
if (isset($app_config[$component]['state_file']))
{
if (!file_exists($app_config[$component]['state_file'])){
file_put_contents($app_config[$component]['state_file'],$text);
echo "OK\n";
}else{
echo "OK; already triggered\n";
}
}
elseif (isset($app_config[$component]['ignore']))
{
echo "OK; Ignored\n";
}
else
{
http_response_code(500);
echo "config error!";
}
}else{
http_response_code(404);
echo "Unknown component\n";
exit();
}