Commit e3a6f025cfb72e64bb4f1f3d1b3ef8f47e9ed01a

Authored by nbm
1 parent dcd52110

KTS-1057: Put a nice "click here to go to KnowledgeTree" after the

upgrade succeeds.



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5790 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 39 additions and 13 deletions
setup/upgrade.php
... ... @@ -95,14 +95,36 @@ function performAllUpgrades () {
95 95 if (PEAR::isError($res)) {
96 96 if (!is_a($res, 'Upgrade_Already_Applied')) {
97 97 break;
  98 + } else {
  99 + $res = true;
98 100 }
99 101 }
100 102 if ($res === false) {
  103 + $res = PEAR::raiseError("Upgrade returned false");
101 104 break;
102 105 }
103   -
104 106 }
105   - return $ret;
  107 + return $res;
  108 +}
  109 +
  110 +function failWritablePath($name, $path) {
  111 + if (!is_writable($path)) {
  112 + sprintf("The path for setting %s, which is set to %s, can not be written to. Correct this situation before continuing.", $name, $path);
  113 + exit(1);
  114 + }
  115 +}
  116 +
  117 +failWritablePath('Log directory', $default->logDirectory);
  118 +failWritablePath('Document directory', $default->documentRoot);
  119 +
  120 +if (PEAR::isError($loggingSupport)) {
  121 + print '<p><font color="red">Logging support is not currently working. Check post-installation checkup.</font></p>';
  122 + exit(1);
  123 +}
  124 +
  125 +if (PEAR::isError($dbSupport)) {
  126 + print '<p><font color="red">Database support is not currently working. Check post-installation checkup.</font></p>';
  127 + exit(1);
106 128 }
107 129  
108 130 if ($_REQUEST["go"] === "Upgrade") {
... ... @@ -136,22 +158,26 @@ td { vertical-align: top; }
136 158 upgrade your KnowledgeTree installation to <strong>$default->systemVersion</strong>.
137 159 Click on the button below the table to perform the upgrades.</p>
138 160 ";
  161 + $upgradeTable = generateUpgradeTable();
  162 + print $upgradeTable;
  163 + print '<form><input type="submit" name="go" value="Upgrade" /></form>';
  164 + print '</body></html>';
  165 +
139 166 } else {
140 167 print "
141 168 <p>The table below describes the upgrades that have occurred to
142 169 upgrade your KnowledgeTree installation to <strong>$default->systemVersion</strong>.
143 170 ";
144 171  
145   - $upgradeTable = performAllUpgrades();
146   - }
147   -
148   - print $upgradeTable;
149   -
150   - if (!$performingUpgrade) {
151   - print '<form><input type="submit" name="go" value="Upgrade" /></form>';
152   - } else {
153   - print '<form><input type="submit" name="go" value="ShowUpgrades" /></form>';
  172 + $res = performAllUpgrades();
  173 + if (PEAR::isError($res)) {
  174 + print '<font color="red">Upgrade failed.</font>' . "\n";
  175 + } else {
  176 + $sUrl = generateLink("");
  177 + print sprintf('<font color="green">Upgrade succeeded. Now
  178 + try <a href="%s">log in and use the system</a>.</font>',
  179 + $sUrl) . "\n";
  180 + }
  181 + print '</body></html>';
154 182 }
155 183 ?>
156   - </body>
157   -</html>
... ...