forked from AOEpeople/EnvSettingsTool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalue.php
More file actions
executable file
·47 lines (35 loc) · 1.19 KB
/
value.php
File metadata and controls
executable file
·47 lines (35 loc) · 1.19 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
46
47
#!/usr/bin/php
<?php
if (version_compare(PHP_VERSION, '5.3.0') <= 0) {
throw new Exception('EnvSettingsTool needs at least PHP 5.3');
}
define('EST_ROOTDIR', dirname(__FILE__));
include(dirname(__FILE__).'/Est/Autoloading.php');
try {
if (empty($_SERVER['argv'][1])) {
throw new Exception('Please specify the environment');
}
if (getenv('NO_COLOR')) {
Est_CliOutput::$active = false;
}
$env = $_SERVER['argv'][1];
$settingsFile = empty($_SERVER['argv'][2]) ? '../settings/settings.csv' : $_SERVER['argv'][2];
if (empty($_SERVER['argv'][3])) {
throw new Exception('No handler specified!');
}
$handlerName = $_SERVER['argv'][3];
$param1 = isset($_SERVER['argv'][4]) ? $_SERVER['argv'][4] : '';
$param2 = isset($_SERVER['argv'][5]) ? $_SERVER['argv'][5] : '';
$param3 = isset($_SERVER['argv'][6]) ? $_SERVER['argv'][6] : '';
$processor = new Est_Processor($env, $settingsFile);
$handler = $processor->getHandler(
$handlerName,
(string)$param1,
(string)$param2,
(string)$param3
);
echo $handler->getValue();
} catch (Exception $e) {
echo "\nERROR: {$e->getMessage()}\n\n";
exit(1);
}