... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
<?php |
2 | 2 |
# Config |
3 | 3 |
$setup_dir = getcwd(); |
4 |
- $app_home_dir = $setup_dir . '/..'; |
|
4 |
+ $app_home_dir = realpath($setup_dir . '/..'); |
|
5 | 5 |
$cpanm_path = "$app_home_dir/cpanm"; |
6 | 6 |
putenv("PERL_CPANM_HOME=$setup_dir"); |
7 | 7 |
|
... | ... |
@@ -9,9 +9,11 @@ |
9 | 9 |
$op = $_REQUEST['op']; |
10 | 10 |
|
11 | 11 |
$current_path = $_SERVER["SCRIPT_NAME"]; |
12 |
+ $app_path = $current_path; |
|
13 |
+ $app_path = preg_replace('/\/setup\/setup\.php/', '', $app_path) . '.cgi'; |
|
12 | 14 |
$output = array(''); |
13 | 15 |
$app_home_dir = getcwd() . '/..'; |
14 |
- $success = true; |
|
16 |
+ $setup_command_success = true; |
|
15 | 17 |
|
16 | 18 |
if($op == 'setup') { |
17 | 19 |
|
... | ... |
@@ -23,14 +25,14 @@ |
23 | 25 |
if ($ret == 0) { |
24 | 26 |
exec("perl -Iextlib/lib/perl5 cpanm -n -L extlib --installdeps . 2>&1", $output, $ret); |
25 | 27 |
if ($ret == 0) { |
26 |
- $success = true; |
|
28 |
+ $setup_command_success = true; |
|
27 | 29 |
} |
28 | 30 |
else { |
29 |
- $success = false; |
|
31 |
+ $setup_command_success = false; |
|
30 | 32 |
} |
31 | 33 |
} |
32 | 34 |
else { |
33 |
- $success = false; |
|
35 |
+ $setup_command_success = false; |
|
34 | 36 |
} |
35 | 37 |
} |
36 | 38 |
?> |
... | ... |
@@ -46,8 +48,6 @@ |
46 | 48 |
<link rel="stylesheet" href="css/bootstrap-responsive.css" /> |
47 | 49 |
</head> |
48 | 50 |
<body> |
49 |
- <?php echo $cpanm_path ?> |
|
50 |
- |
|
51 | 51 |
<div class="container"> |
52 | 52 |
<div class="text-center"><h1>Setup Tool</h1></div> |
53 | 53 |
</div> |
... | ... |
@@ -60,17 +60,18 @@ |
60 | 60 |
</div> |
61 | 61 |
</form> |
62 | 62 |
<span class="label">Result</span> |
63 |
-<pre style="height:300px;overflow:auto;margin-bottom:0;margin-top:0;"> |
|
64 |
-<?php if (!$success) { ?> |
|
65 |
-<span style="color:red">Error</span> |
|
63 |
+<pre style="height:300px;overflow:auto;margin-bottom:30px"> |
|
64 |
+<?php if (!$setup_command_success) { ?> |
|
65 |
+<span style="color:red">Error(Setup command failed)</span> |
|
66 | 66 |
<?php } ?> |
67 |
-<?php if ($output) { ?> |
|
67 |
+<?php if ($setup_command_success) { ?> |
|
68 | 68 |
<?php foreach ($output as $line) { ?> |
69 | 69 |
<?php echo htmlspecialchars($line) ?> |
70 | 70 |
|
71 | 71 |
<?php } ?> |
72 | 72 |
<?php } ?> |
73 | 73 |
</pre> |
74 |
+ <div style="font-size:150%;margin-bottom:30px;">Go to <a href="<?php echo $app_path ?>">Application</a></div> |
|
74 | 75 |
</div> |
75 | 76 |
</body> |
76 | 77 |
</html> |