diff --git a/setup/upgrade.php b/setup/upgrade.php index cdde9c7..1761dbc 100644 --- a/setup/upgrade.php +++ b/setup/upgrade.php @@ -95,14 +95,36 @@ function performAllUpgrades () { if (PEAR::isError($res)) { if (!is_a($res, 'Upgrade_Already_Applied')) { break; + } else { + $res = true; } } if ($res === false) { + $res = PEAR::raiseError("Upgrade returned false"); break; } - } - return $ret; + return $res; +} + +function failWritablePath($name, $path) { + if (!is_writable($path)) { + sprintf("The path for setting %s, which is set to %s, can not be written to. Correct this situation before continuing.", $name, $path); + exit(1); + } +} + +failWritablePath('Log directory', $default->logDirectory); +failWritablePath('Document directory', $default->documentRoot); + +if (PEAR::isError($loggingSupport)) { + print '

Logging support is not currently working. Check post-installation checkup.

'; + exit(1); +} + +if (PEAR::isError($dbSupport)) { + print '

Database support is not currently working. Check post-installation checkup.

'; + exit(1); } if ($_REQUEST["go"] === "Upgrade") { @@ -136,22 +158,26 @@ td { vertical-align: top; } upgrade your KnowledgeTree installation to $default->systemVersion. Click on the button below the table to perform the upgrades.

"; + $upgradeTable = generateUpgradeTable(); + print $upgradeTable; + print '
'; + print ''; + } else { print "

The table below describes the upgrades that have occurred to upgrade your KnowledgeTree installation to $default->systemVersion. "; - $upgradeTable = performAllUpgrades(); - } - - print $upgradeTable; - - if (!$performingUpgrade) { - print '

'; - } else { - print '
'; + $res = performAllUpgrades(); + if (PEAR::isError($res)) { + print 'Upgrade failed.' . "\n"; + } else { + $sUrl = generateLink(""); + print sprintf('Upgrade succeeded. Now + try log in and use the system.', + $sUrl) . "\n"; + } + print ''; } ?> - -