2d1f77559bcf610adfdac2a2109db02e873cee2c
[racktables] / upgrade.php
1 <?php
2
3 $relnotes = array
4 (
5 '0.17.0' => "LDAP options have been moved to LDAP_options array. This means, that if you were<br>" .
6 "using LDAP authentication for users in version 0.16.x, it will break right after<br>" .
7 "upgrade to 0.17.0. To get things working again, adjust existing secret.php file<br>" .
8 "according to secret-sample.php file provided with 0.17.0 release.<br><br>" .
9 "Another change is the addition of support for file uploads. Files are stored<br>" .
10 "in the database. There are several settings in php.ini which you may need to modify:<br>" .
11 "<ul><li>file_uploads - needs to be On</li>" .
12 "<li>upload_max_filesize - max size for uploaded files</li>" .
13 "<li>post_max_size - max size of all form data submitted via POST (including files)</li></ul><br>" .
14 "Local user accounts used to have 'enabled' flag, which allowed individual blocking and<br>" .
15 "unblocking of each. This flag was dropped in favor of existing mean of access<br>" .
16 "setup (RackCode). An unconditional denying rule is automatically added into RackCode<br>" .
17 "for such blocked account, so the effective security policy remains the same.<br>",
18 );
19
20 // At the moment we assume, that for any two releases we can
21 // sequentally execute all batches, that separate them, and
22 // nothing will break. If this changes one day, the function
23 // below will have to generate smarter upgrade paths, while
24 // the upper layer will remain the same.
25 // Returning an empty array means that no upgrade is necessary.
26 // Returning NULL indicates an error.
27 function getDBUpgradePath ($v1, $v2)
28 {
29 $versionhistory = array
30 (
31 '0.16.4',
32 '0.16.5',
33 '0.16.6',
34 '0.17.0',
35 '0.17.1',
36 );
37 if (!in_array ($v1, $versionhistory) or !in_array ($v2, $versionhistory))
38 return NULL;
39 $skip = TRUE;
40 $path = NULL;
41 // Now collect all versions > $v1 and <= $v2
42 foreach ($versionhistory as $v)
43 {
44 if ($skip and $v == $v1)
45 {
46 $skip = FALSE;
47 $path = array();
48 continue;
49 }
50 if ($skip)
51 continue;
52 $path[] = $v;
53 if ($v == $v2)
54 break;
55 }
56 return $path;
57 }
58
59 // Upgrade batches are named exactly as the release where they first appear.
60 // That is simple, but seems sufficient for beginning.
61 function executeUpgradeBatch ($batchid)
62 {
63 $query = array();
64 global $dbxlink;
65 switch ($batchid)
66 {
67 case '0.16.5':
68 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('IPV4_TREE_SHOW_USAGE','yes','string','no','no','Show address usage in IPv4 tree')";
69 $query[] = "update Config set varvalue = '0.16.5' where varname = 'DB_VERSION'";
70 break;
71 case '0.16.6':
72 $query[] = "update Config set varvalue = '0.16.6' where varname = 'DB_VERSION'";
73 break;
74 case '0.17.0':
75 // create tables for storing files (requires InnoDB support)
76 if (!isInnoDBSupported ())
77 {
78 showFailure ("Cannot upgrade because InnoDB tables are not supported by your MySQL server. See the README for details.", __FILE__);
79 die;
80 }
81
82 $query[] = "alter table Chapter change chapter_no id int(10) unsigned NOT NULL auto_increment";
83 $query[] = "alter table Chapter change chapter_name name char(128) NOT NULL";
84 $query[] = "alter table Chapter drop key chapter_name";
85 $query[] = "alter table Chapter add UNIQUE KEY name (name)";
86 $query[] = "alter table Attribute change attr_id id int(10) unsigned NOT NULL auto_increment";
87 $query[] = "alter table Attribute change attr_type type enum('string','uint','float','dict') default NULL";
88 $query[] = "alter table Attribute change attr_name name char(64) default NULL";
89 $query[] = "alter table Attribute drop key attr_name";
90 $query[] = "alter table Attribute add UNIQUE KEY name (name)";
91 $query[] = "alter table AttributeMap change chapter_no chapter_id int(10) unsigned NOT NULL";
92 $query[] = "alter table Dictionary change chapter_no chapter_id int(10) unsigned NOT NULL";
93 // Many dictionary changes were made... remove all dictvendor entries and install fresh.
94 // Take care not to erase locally added records. 0.16.x ends with max key 797
95 $query[] = 'DELETE FROM Dictionary WHERE ((chapter_id BETWEEN 11 AND 14) or (chapter_id BETWEEN 16 AND 19) ' .
96 'or (chapter_id BETWEEN 21 AND 24)) and dict_key <= 797';
97 $f = fopen ("install/init-dictvendors.sql", 'r');
98 if ($f === FALSE)
99 {
100 showFailure ("Failed to open install/init-dictvendors.sql for reading");
101 die;
102 }
103 $longq = '';
104 while (!feof ($f))
105 {
106 $line = fgets ($f);
107 if (ereg ('^--', $line))
108 continue;
109 $longq .= $line;
110 }
111 fclose ($f);
112 foreach (explode (";\n", $longq) as $dict_query)
113 {
114 if (empty ($dict_query))
115 continue;
116 $query[] = $dict_query;
117 }
118
119 // schema changes for file management
120 $query[] = "
121 CREATE TABLE `File` (
122 `id` int(10) unsigned NOT NULL auto_increment,
123 `name` char(255) NOT NULL,
124 `type` char(255) NOT NULL,
125 `size` int(10) unsigned NOT NULL,
126 `ctime` datetime NOT NULL,
127 `mtime` datetime NOT NULL,
128 `atime` datetime NOT NULL,
129 `contents` longblob NOT NULL,
130 `comment` text,
131 PRIMARY KEY (`id`),
132 UNIQUE KEY `name` (`name`)
133 ) ENGINE=InnoDB";
134 $query[] = "
135 CREATE TABLE `FileLink` (
136 `id` int(10) unsigned NOT NULL auto_increment,
137 `file_id` int(10) unsigned NOT NULL,
138 `entity_type` enum('ipv4net','ipv4rspool','ipv4vs','object','rack','user') NOT NULL default 'object',
139 `entity_id` int(10) NOT NULL,
140 PRIMARY KEY (`id`),
141 UNIQUE KEY `FileLink-unique` (`file_id`,`entity_type`,`entity_id`),
142 KEY `FileLink-file_id` (`file_id`),
143 CONSTRAINT `FileLink-File_fkey` FOREIGN KEY (`file_id`) REFERENCES `File` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
144 ) ENGINE=InnoDB";
145 $query[] = "ALTER TABLE TagStorage MODIFY COLUMN target_realm enum('file','ipv4net','ipv4rspool','ipv4vs','object','rack','user') NOT NULL default 'object'";
146
147 $query[] = "INSERT INTO `Dictionary` (`chapter_id`, `dict_key`, `dict_value`) VALUES (1,798,'Network security')";
148 $query[] = "INSERT INTO `Dictionary` (`chapter_id`, `dict_key`, `dict_value`) VALUES (1,965,'Wireless')";
149 $query[] = "INSERT INTO `Chapter` (`id`, `sticky`, `name`) VALUES (24,'no','network security models')";
150 $query[] = "INSERT INTO `Chapter` (`id`, `sticky`, `name`) VALUES (25,'no','wireless models')";
151 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,1,0)";
152 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,2,24)";
153 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,3,0)";
154 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,5,0)";
155 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,14,0)";
156 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,16,0)";
157 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,17,0)";
158 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,18,0)";
159 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,20,0)";
160 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,21,0)";
161 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,22,0)";
162 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (798,24,0)";
163 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (965,1,0)";
164 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (965,3,0)";
165 $query[] = "INSERT INTO `AttributeMap` (`objtype_id`, `attr_id`, `chapter_id`) VALUES (965,2,25)";
166 $query[] = "UPDATE Dictionary SET dict_value = 'Network switch' WHERE dict_key = 8";
167 $query[] = 'alter table IPBonds rename to IPv4Allocation';
168 $query[] = 'alter table PortForwarding rename to IPv4NAT';
169 $query[] = 'alter table IPRanges rename to IPv4Network';
170 $query[] = 'alter table IPAddress rename to IPv4Address';
171 $query[] = 'alter table IPLoadBalancer rename to IPv4LB';
172 $query[] = 'alter table IPRSPool rename to IPv4RSPool';
173 $query[] = 'alter table IPRealServer rename to IPv4RS';
174 $query[] = 'alter table IPVirtualService rename to IPv4VS';
175 $query[] = "alter table TagStorage change column target_realm entity_realm enum('file','ipv4net','ipv4vs','ipv4rspool','object','rack','user') NOT NULL default 'object'";
176 $query[] = 'alter table TagStorage change column target_id entity_id int(10) unsigned NOT NULL';
177 $query[] = 'alter table TagStorage drop key entity_tag';
178 $query[] = 'alter table TagStorage drop key target_id';
179 $query[] = 'alter table TagStorage add UNIQUE KEY `entity_tag` (`entity_realm`,`entity_id`,`tag_id`)';
180 $query[] = 'alter table TagStorage add KEY `entity_id` (`entity_id`)';
181 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('PREVIEW_TEXT_MAXCHARS','10240','uint','yes','no','Max chars for text file preview')";
182 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('PREVIEW_TEXT_ROWS','25','uint','yes','no','Rows for text file preview')";
183 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('PREVIEW_TEXT_COLS','80','uint','yes','no','Columns for text file preview')";
184 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('PREVIEW_IMAGE_MAXPXS','320','uint','yes','no','Max pixels per axis for image file preview')";
185 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('VENDOR_SIEVE','','string','yes','no','Vendor sieve configuration')";
186 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('IPV4LB_LISTSRC','{\$typeid_4}','string','yes','no','List source: IPv4 load balancers')";
187 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('IPV4OBJ_LISTSRC','{\$typeid_4} or {\$typeid_7} or {\$typeid_8} or {\$typeid_12} or {\$typeid_445} or {\$typeid_447}','string','yes','no','List source: IPv4-enabled objects')";
188 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('IPV4NAT_LISTSRC','{\$typeid_4} or {\$typeid_7} or {\$typeid_8}','string','yes','no','List source: IPv4 NAT performers')";
189 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('ASSETWARN_LISTSRC','{\$typeid_4} or {\$typeid_7} or {\$typeid_8}','string','yes','no','List source: object, for which asset tag should be set')";
190 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('NAMEWARN_LISTSRC','{\$typeid_4} or {\$typeid_7} or {\$typeid_8}','string','yes','no','List source: object, for which common name should be set')";
191 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('RACKS_PER_ROW','12','unit','yes','no','Racks per row')";
192 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('FILTER_PREDICATE_SIEVE','','string','yes','no','Predicate sieve regex(7)')";
193 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('FILTER_DEFAULT_ANDOR','or','string','no','no','Default list filter boolean operation (or/and)')";
194 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('FILTER_SUGGEST_ANDOR','yes','string','no','no','Suggest and/or selector in list filter')";
195 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('FILTER_SUGGEST_TAGS','yes','string','no','no','Suggest tags in list filter')";
196 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('FILTER_SUGGEST_PREDICATES','yes','string','no','no','Suggest predicates in list filter')";
197 $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('FILTER_SUGGEST_EXTRA','no','string','no','no','Suggest extra expression in list filter')";
198 $query[] = "delete from Config where varname = 'USER_AUTH_SRC'";
199 $query[] = "delete from Config where varname = 'COOKIE_TTL'";
200 $query[] = "delete from Config where varname = 'rtwidth_0'";
201 $query[] = "delete from Config where varname = 'rtwidth_1'";
202 $query[] = "delete from Config where varname = 'rtwidth_2'";
203 $query[] = "delete from Config where varname = 'NAMEFUL_OBJTYPES'";
204 $query[] = "delete from Config where varname = 'REQUIRE_ASSET_TAG_FOR'";
205 $query[] = "delete from Config where varname = 'IPV4_PERFORMERS'";
206 $query[] = "delete from Config where varname = 'NATV4_PERFORMERS'";
207 $query[] = "alter table TagTree add column valid_realm set('file','ipv4net','ipv4vs','ipv4rspool','object','rack','user') not null default 'file,ipv4net,ipv4vs,ipv4rspool,object,rack,user' after parent_id";
208 $result = $dbxlink->query ("select user_id, user_name, user_realname from UserAccount where user_enabled = 'no'");
209 while ($row = $result->fetch (PDO::FETCH_ASSOC))
210 $query[] = "update Script set script_text = concat('deny {\$userid_${row['user_id']}} # ${row['user_name']} (${row['user_realname']})\n', script_text) where script_name = 'RackCode'";
211 $query[] = "update Script set script_text = NULL where script_name = 'RackCodeCache'";
212 unset ($result);
213 $query[] = "alter table UserAccount drop column user_enabled";
214
215 $query[] = "CREATE TABLE RackRow ( id int(10) unsigned NOT NULL auto_increment, name char(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM";
216
217 $result = $dbxlink->query ("select dict_key, dict_value from Dictionary where chapter_no = 3");
218 while($row = $result->fetch(PDO::FETCH_NUM))
219 $query[] = "insert into RackRow set id=${row[0]}, name='${row[1]}'";
220 unset ($result);
221 $query[] = "delete from Dictionary where chapter_id = 3";
222 $query[] = "delete from Chapter where id = 3";
223 $query[] = "
224 CREATE TABLE `LDAPCache` (
225 `presented_username` char(64) NOT NULL,
226 `successful_hash` char(40) NOT NULL,
227 `first_success` timestamp NOT NULL default CURRENT_TIMESTAMP,
228 `last_retry` timestamp NOT NULL default '0000-00-00 00:00:00',
229 `displayed_name` char(128) default NULL,
230 `memberof` text,
231 UNIQUE KEY `presented_username` (`presented_username`),
232 KEY `scanidx` (`presented_username`,`successful_hash`)
233 ) ENGINE=InnoDB;";
234 $query[] = "alter table UserAccount modify column user_password_hash char(40) NULL";
235 $query[] = 'ALTER TABLE Rack DROP COLUMN deleted';
236 $query[] = 'ALTER TABLE RackHistory DROP COLUMN deleted';
237 $query[] = 'ALTER TABLE RackObject DROP COLUMN deleted';
238 $query[] = 'ALTER TABLE RackObjectHistory DROP COLUMN deleted';
239 // Can't be added straight due to many duplicates, even in "dictbase" data.
240 $result = $dbxlink->query ('SELECT type1, type2, count(*) - 1 as excess FROM PortCompat GROUP BY type1, type2 HAVING excess > 0');
241 while ($row = $result->fetch (PDO::FETCH_ASSOC))
242 $query[] = "DELETE FROM PortCompat WHERE type1 = ${row['type1']} AND type2 = ${row['type2']} limit ${row['excess']}";
243 unset ($result);
244 $query[] = 'ALTER TABLE PortCompat DROP KEY type1';
245 $query[] = 'ALTER TABLE PortCompat ADD UNIQUE `type1_2` (type1, type2)';
246 $query[] = "UPDATE Config SET varvalue = '0.17.0' WHERE varname = 'DB_VERSION'";
247
248 break;
249 case '0.17.1':
250 $query[] = "ALTER TABLE Dictionary DROP KEY `chap_to_key`";
251 // Token set has changed, so the cache isn't valid any more.
252 $query[] = "UPDATE Script SET script_text = NULL WHERE script_name = 'RackCodeCache'";
253 $query[] = "UPDATE Config SET varvalue = '0.17.1' WHERE varname = 'DB_VERSION'";
254 break;
255 default:
256 showFailure ("executeUpgradeBatch () failed, because batch '${batchid}' isn't defined", __FILE__);
257 die;
258 break;
259 }
260 $failures = array();
261 echo "<tr><th>Executing batch '${batchid}'</th><td>";
262 foreach ($query as $q)
263 {
264 $result = $dbxlink->query ($q);
265 if ($result == NULL)
266 {
267 $errorInfo = $dbxlink->errorInfo();
268 $failures[] = array ($q, $errorInfo[2]);
269 }
270 }
271 if (!count ($failures))
272 echo "<strong><font color=green>done</font></strong>";
273 else
274 {
275 echo "<strong><font color=red>The following queries failed:</font></strong><br><pre>";
276 foreach ($failures as $f)
277 {
278 list ($q, $i) = $f;
279 echo "${q} -- ${i}\n";
280 }
281 echo "</pre>";
282 }
283 echo '</td></tr>';
284 }
285
286 // ******************************************************************
287 //
288 // Execution starts here
289 //
290 // ******************************************************************
291
292 $root = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://';
293 $root .= isset ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT']=='80'?'':$_SERVER['SERVER_PORT']));
294 $root .= strtr (dirname ($_SERVER['PHP_SELF']), '\\', '/');
295 if (substr ($root, -1) != '/')
296 $root .= '/';
297
298 // a clone of showError() to drop dependency on interface.php
299 function showFailure ($info = '', $location = 'N/A')
300 {
301 global $root;
302 if (preg_match ('/\.php$/', $location))
303 $location = basename ($location);
304 elseif ($location != 'N/A')
305 $location = $location . '()';
306 echo "<div class=msg_error>An error has occured in [${location}]. ";
307 if (empty ($info))
308 echo 'No additional information is available.';
309 else
310 echo "Additional information:<br><p>\n<pre>\n${info}\n</pre></p>";
311 echo "This failure is most probably fatal.<br></div>\n";
312 }
313
314 require_once 'inc/config.php'; // for CODE_VERSION
315 require_once 'inc/database.php'; // for getDatabaseVersion()
316 // Enforce default value for now, releases prior to 0.17.0 didn't support 'httpd' auth source.
317 $user_auth_src = 'database';
318
319 if (file_exists ('inc/secret.php'))
320 require_once 'inc/secret.php';
321 else
322 die ("Database connection parameters are read from inc/secret.php file, " .
323 "which cannot be found.\nCopy provided inc/secret-sample.php to " .
324 "inc/secret.php and modify to your setup.\n\nThen reload the page.");
325
326 try
327 {
328 $dbxlink = new PDO ($pdo_dsn, $db_username, $db_password);
329 }
330 catch (PDOException $e)
331 {
332 die ("Database connection failed:\n\n" . $e->getMessage());
333 }
334
335 // Now we need to be sure that the current user is the administrator.
336 // The rest doesn't matter within this context.
337
338 function authenticate_admin ($username, $password)
339 {
340 global $dbxlink;
341 $hash = sha1 ($password);
342 $query = "select count(*) from UserAccount where user_id = 1 and user_name = '${username}' and user_password_hash = '${hash}'";
343 if (($result = $dbxlink->query ($query)) == NULL)
344 die ('SQL query failed in ' . __FUNCTION__);
345 $rows = $result->fetchAll (PDO::FETCH_NUM);
346 return $rows[0][0] == 1;
347 }
348
349 switch ($user_auth_src)
350 {
351 case 'database':
352 case 'ldap': // authenticate against DB as well
353 if
354 (
355 !isset ($_SERVER['PHP_AUTH_USER']) or
356 !strlen ($_SERVER['PHP_AUTH_USER']) or
357 !isset ($_SERVER['PHP_AUTH_PW']) or
358 !strlen ($_SERVER['PHP_AUTH_PW']) or
359 !authenticate_admin (escapeString ($_SERVER['PHP_AUTH_USER']), escapeString ($_SERVER['PHP_AUTH_PW']))
360 )
361 {
362 header ('WWW-Authenticate: Basic realm="RackTables upgrade"');
363 header ('HTTP/1.0 401 Unauthorized');
364 showFailure ('You must be authenticated as an administrator to complete the upgrade.', __FILE__);
365 die;
366 }
367 break; // cleared
368 case 'httpd':
369 if
370 (
371 !isset ($_SERVER['REMOTE_USER']) or
372 !strlen ($_SERVER['REMOTE_USER'])
373 )
374 {
375 showFailure ('System misconfiguration. The web-server didn\'t authenticate the user, although ought to do.');
376 die;
377 }
378 break; // cleared
379 default:
380 showFailure ('authentication source misconfiguration', __FILE__);
381 die;
382 }
383
384 $dbver = getDatabaseVersion();
385 echo '<table border=1>';
386 echo "<tr><th>Current status</th><td>Data version: ${dbver}<br>Code version: " . CODE_VERSION . "</td></tr>\n";
387
388 $path = getDBUpgradePath ($dbver, CODE_VERSION);
389 if ($path === NULL)
390 {
391 echo "<tr><th>Upgrade path</th><td><font color=red>not found</font></td></tr>\n";
392 echo "<tr><th>Summary</th><td>Check README for more information.</td></tr>\n";
393 }
394 else
395 {
396 if (!count ($path))
397 echo "<tr><th>Summary</th><td>Come back later.</td></tr>\n";
398 else
399 {
400 echo "<tr><th>Upgrade path</th><td>${dbver} &rarr; " . implode (' &rarr; ', $path) . "</td></tr>\n";
401 foreach ($path as $batchid)
402 {
403 executeUpgradeBatch ($batchid);
404 if (isset ($relnotes[$batchid]))
405 echo "<tr><th>Release notes for ${batchid}</th><td>" . $relnotes[$batchid] . "</td></tr>\n";
406 }
407 echo "<tr><th>Summary</th><td>Upgrade complete, it is Ok to <a href='${root}'>enter</a> the system.</td></tr>\n";
408 }
409 }
410 echo '</table>';
411
412 ?>