r1531 + log ticket:46
[racktables] / install.php
CommitLineData
f48dc2cc
DO
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3<head><title>RackTables installation</title>
4<link rel=stylesheet type='text/css' href=pi.css />
5</head>
6<body>
7<?php
8
9function already_installed()
10{
11 return FALSE;
12}
13
14function test_install_step ($stepno)
15{
16 switch ($stepno)
17 {
18 // Step 0. Check if the software is already installed.
19 case 0:
20 return 1;
21 break;
22 // Step 1. Check for PHP extensions.
23 case 1:
24 $nerrs = 0;
25 echo "<table border=1><tr><th>check item</th><th>result</th></tr>\n";
26
27 echo '<tr><td>PDO extension</td>';
28 if (class_exists ('PDO'))
29 echo '<td class=msg_success>Ok';
30 else
31 {
32 echo '<td class=msg_error>not found';
33 $nerrs++;
34 }
35 echo '</td></tr>';
36
37 echo '<tr><td>PDO-MySQL</td>';
38 if (defined ('PDO::MYSQL_ATTR_READ_DEFAULT_FILE'))
39 echo '<td class=msg_success>Ok';
40 else
41 {
42 echo '<td class=msg_error>not found';
43 $nerrs++;
44 }
45 echo '</td></tr>';
46
47 echo '<tr><td>hash functions</td>';
48 if (function_exists ('hash_algos'))
49 echo '<td class=msg_success>Ok';
50 else
51 {
52 echo '<td class=msg_error>not found';
53 $nerrs++;
54 }
55 echo '</td></tr>';
56
57 echo '<tr><td>SNMP extension</td>';
58 if (defined ('SNMP_NULL'))
59 echo '<td class=msg_success>Ok';
60 else
61 echo '<td class=msg_warning>Not found. Live SNMP tab will not function properly until the extension is installed.';
62 echo '</td></tr>';
63
64 echo '<tr><td>GD functions</td>';
65 if (defined ('GD_VERSION'))
66 echo '<td class=msg_success>Ok';
67 else
68 {
69 echo '<td class=msg_error>not found';
70 $nerrs++;
71 }
72 echo '</td></tr>';
73
74 echo "</table>\n";
75 return !$nerrs;
76 break;
77 // Step 2. Check that we can write to configuration file.
78 case 2:
79 return 1;
80 break;
81 // Step 3. Ask for DB connection paramaters and test
82 // the connection. Neither save the parameters nor allow
83 // going further until we succeed with the given
84 // credentials.
85 case 3:
86 return 1;
87 break;
88 default:
89 die ("Unexpected argument '${stepno}'");
90 }
91}
92
93//********************************** START **************
94if (isset ($_REQUEST['step']))
95 $next_step = $_REQUEST['step'];
96elseif (!already_installed())
97 $next_step = 1;
98else
99 die ('Already installed.');
100
101$result = test_install_step ($next_step);
102switch ($result)
103{
104 case -1: // fail
105
106 break;
107 case 0: // retry
108 break;
109 case 1: // advance
110}
111
112?>
113</body>
114</html>