Commit af421b4714e7e61a37d232aca82e33fa09b97e8d

Authored by Megan Watson
1 parent 17eacfeb

Added errors to the display. Changed the DB user to use the admin user. Recreate…

…d the cache directory after upgrade.
PT: 1782058

Committed by: Megan Watson
setup/upgrade/lib/UpgradeItems.inc.php
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 * KnowledgeTree Community Edition 5 * KnowledgeTree Community Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2008, 2009 KnowledgeTree Inc. 7 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
8 - * 8 + *
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify it under 10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License version 3 as published by the 11 * the terms of the GNU General Public License version 3 as published by the
@@ -57,16 +57,16 @@ require_once("../wizard/dbUtilities.php"); @@ -57,16 +57,16 @@ require_once("../wizard/dbUtilities.php");
57 57
58 // {{{ Upgrade_Already_Applied 58 // {{{ Upgrade_Already_Applied
59 class Upgrade_Already_Applied { 59 class Upgrade_Already_Applied {
60 - 60 +
61 function Upgrade_Already_Applied($oUpgradeItem) { 61 function Upgrade_Already_Applied($oUpgradeItem) {
62 $this->oUpgradeItem = $oUpgradeItem; 62 $this->oUpgradeItem = $oUpgradeItem;
63 } 63 }
64 - 64 +
65 } 65 }
66 // }}} 66 // }}}
67 67
68 class UpgradeItem { 68 class UpgradeItem {
69 - 69 +
70 public $type = ""; 70 public $type = "";
71 public $name; 71 public $name;
72 public $version; 72 public $version;
@@ -76,7 +76,8 @@ class UpgradeItem { @@ -76,7 +76,8 @@ class UpgradeItem {
76 public $parent; 76 public $parent;
77 public $date; 77 public $date;
78 public $result; 78 public $result;
79 - 79 + protected $error;
  80 +
80 function UpgradeItem($name, $version, $description = null, $phase = 0, $priority = 0) { 81 function UpgradeItem($name, $version, $description = null, $phase = 0, $priority = 0) {
81 $this->name = $name; 82 $this->name = $name;
82 $this->version = $version; 83 $this->version = $version;
@@ -86,7 +87,7 @@ class UpgradeItem { @@ -86,7 +87,7 @@ class UpgradeItem {
86 $this->description = $description; 87 $this->description = $description;
87 $this->phase = $phase; 88 $this->phase = $phase;
88 $this->priority = $priority; 89 $this->priority = $priority;
89 - 90 +
90 $this->dbUtilities = new dbUtilities(); 91 $this->dbUtilities = new dbUtilities();
91 $this->iniUtilities = new iniUtilities(); 92 $this->iniUtilities = new iniUtilities();
92 } 93 }
@@ -122,6 +123,14 @@ class UpgradeItem { @@ -122,6 +123,14 @@ class UpgradeItem {
122 return $this->type; 123 return $this->type;
123 } 124 }
124 125
  126 + public function getErrors()
  127 + {
  128 + if(isset($this->error[0])){
  129 + return $this->error[0];
  130 + }
  131 + return $this->error;
  132 + }
  133 +
125 /** 134 /**
126 * Runs a DB query and returns a result based on arguments which specify what to look for 135 * Runs a DB query and returns a result based on arguments which specify what to look for
127 * 136 *
@@ -135,13 +144,13 @@ class UpgradeItem { @@ -135,13 +144,13 @@ class UpgradeItem {
135 $this->dbUtilities = new dbUtilities(); 144 $this->dbUtilities = new dbUtilities();
136 $this->iniUtilities = new iniUtilities(); 145 $this->iniUtilities = new iniUtilities();
137 } 146 }
138 - 147 +
139 $wizConfigHandler = new configuration(); 148 $wizConfigHandler = new configuration();
140 $configPath = $wizConfigHandler->readConfigPathIni(); 149 $configPath = $wizConfigHandler->readConfigPathIni();
141 - 150 +
142 $this->iniUtilities->load($configPath); 151 $this->iniUtilities->load($configPath);
143 $dconf = $this->iniUtilities->getSection('db'); 152 $dconf = $this->iniUtilities->getSection('db');
144 - $this->dbUtilities->load($dconf['dbHost'], '', $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); 153 + $this->dbUtilities->load($dconf['dbHost'], '', $dconf['dbAdminUser'], $dconf['dbAdminPass'], $dconf['dbName']);
145 $result = $this->dbUtilities->query($query); 154 $result = $this->dbUtilities->query($query);
146 if($checkResult) { 155 if($checkResult) {
147 $assArr = $this->dbUtilities->fetchAssoc($result); 156 $assArr = $this->dbUtilities->fetchAssoc($result);
@@ -153,7 +162,7 @@ class UpgradeItem { @@ -153,7 +162,7 @@ class UpgradeItem {
153 } 162 }
154 return !is_null($result); 163 return !is_null($result);
155 } 164 }
156 - 165 +
157 function _upgradeTableInstalled() { 166 function _upgradeTableInstalled() {
158 $query = "SELECT COUNT(id) FROM upgrades"; 167 $query = "SELECT COUNT(id) FROM upgrades";
159 $res = $this->runDBQuery($query, true, true); 168 $res = $this->runDBQuery($query, true, true);
@@ -169,7 +178,7 @@ class UpgradeItem { @@ -169,7 +178,7 @@ class UpgradeItem {
169 } 178 }
170 $query = "SELECT id FROM upgrades WHERE descriptor = '".$this->getDescriptor()."' AND result = 1"; 179 $query = "SELECT id FROM upgrades WHERE descriptor = '".$this->getDescriptor()."' AND result = 1";
171 $res = $this->runDBQuery($query, true, false); 180 $res = $this->runDBQuery($query, true, false);
172 - 181 +
173 if(!$res) { 182 if(!$res) {
174 return true; 183 return true;
175 } 184 }
@@ -214,7 +223,7 @@ class UpgradeItem { @@ -214,7 +223,7 @@ class UpgradeItem {
214 } 223 }
215 $sql = "INSERT INTO upgrades (`id`, `descriptor`, `description`, `date_performed`, `result`, `parent`) VALUES (NULL, '". $this->getDescriptor()."', '".$this->description."', '".$this->date."', '".$result."', '".$parentid."')"; 224 $sql = "INSERT INTO upgrades (`id`, `descriptor`, `description`, `date_performed`, `result`, `parent`) VALUES (NULL, '". $this->getDescriptor()."', '".$this->description."', '".$this->date."', '".$result."', '".$parentid."')";
216 $this->dbUtilities->query($sql); 225 $this->dbUtilities->query($sql);
217 - 226 +
218 return true; 227 return true;
219 } 228 }
220 229
@@ -225,7 +234,7 @@ class UpgradeItem { @@ -225,7 +234,7 @@ class UpgradeItem {
225 } // end class UpgradeItem 234 } // end class UpgradeItem
226 235
227 class SQLUpgradeItem extends UpgradeItem { 236 class SQLUpgradeItem extends UpgradeItem {
228 - 237 +
229 function SQLUpgradeItem($path, $version = null, $description = null, $phase = null, $priority = null) { 238 function SQLUpgradeItem($path, $version = null, $description = null, $phase = null, $priority = null) {
230 $this->type = "sql"; 239 $this->type = "sql";
231 $this->priority = 0; 240 $this->priority = 0;
@@ -366,11 +375,11 @@ class SQLUpgradeItem extends UpgradeItem { @@ -366,11 +375,11 @@ class SQLUpgradeItem extends UpgradeItem {
366 $queries = SQLFile::sqlFromFile($sqlupgradedir . $this->name); 375 $queries = SQLFile::sqlFromFile($sqlupgradedir . $this->name);
367 return $this->dbUtilities->runQueries($queries); 376 return $this->dbUtilities->runQueries($queries);
368 } 377 }
369 - 378 +
370 } // end class SQLUpgradeItem 379 } // end class SQLUpgradeItem
371 380
372 class KTRebuildPermissionObserver { 381 class KTRebuildPermissionObserver {
373 - 382 +
374 function start() { 383 function start() {
375 $this->lastBeat = time(); 384 $this->lastBeat = time();
376 } 385 }
@@ -384,11 +393,11 @@ class KTRebuildPermissionObserver { @@ -384,11 +393,11 @@ class KTRebuildPermissionObserver {
384 } 393 }
385 function end() { 394 function end() {
386 } 395 }
387 - 396 +
388 } 397 }
389 398
390 class RecordUpgradeItem extends UpgradeItem { 399 class RecordUpgradeItem extends UpgradeItem {
391 - 400 +
392 function RecordUpgradeItem ($version, $oldversion = null) { 401 function RecordUpgradeItem ($version, $oldversion = null) {
393 $this->type = "upgrade"; 402 $this->type = "upgrade";
394 if (is_null($oldversion)) { 403 if (is_null($oldversion)) {
@@ -426,7 +435,7 @@ class RecordUpgradeItem extends UpgradeItem { @@ -426,7 +435,7 @@ class RecordUpgradeItem extends UpgradeItem {
426 KTPermissionUtil::rebuildPermissionLookups(true); 435 KTPermissionUtil::rebuildPermissionLookups(true);
427 $po->end(); 436 $po->end();
428 */ 437 */
429 - 438 +
430 $versionFile=KT_DIR . '/docs/VERSION-NAME.txt'; 439 $versionFile=KT_DIR . '/docs/VERSION-NAME.txt';
431 $fp = fopen($versionFile,'rt'); 440 $fp = fopen($versionFile,'rt');
432 $systemVersion = fread($fp, filesize($versionFile)); 441 $systemVersion = fread($fp, filesize($versionFile));
@@ -495,7 +504,7 @@ class RecordUpgradeItem extends UpgradeItem { @@ -495,7 +504,7 @@ class RecordUpgradeItem extends UpgradeItem {
495 @unlink($sFile); 504 @unlink($sFile);
496 } 505 }
497 } 506 }
498 - 507 +
499 } // end class RecordUpgradeItem 508 } // end class RecordUpgradeItem
500 509
501 ?> 510 ?>
setup/upgrade/steps/upgradeDatabase.php
1 <?php 1 <?php
2 /** 2 /**
3 -* Upgrade Step Controller. 3 +* Upgrade Step Controller.
4 * 4 *
5 * KnowledgeTree Community Edition 5 * KnowledgeTree Community Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
@@ -44,7 +44,7 @@ define(&#39;KT_DIR&#39;, SYSTEM_DIR); @@ -44,7 +44,7 @@ define(&#39;KT_DIR&#39;, SYSTEM_DIR);
44 define('KT_LIB_DIR', SYSTEM_DIR.'lib'); 44 define('KT_LIB_DIR', SYSTEM_DIR.'lib');
45 require_once(WIZARD_LIB . 'upgrade.inc.php'); 45 require_once(WIZARD_LIB . 'upgrade.inc.php');
46 46
47 -class upgradeDatabase extends Step 47 +class upgradeDatabase extends Step
48 { 48 {
49 /** 49 /**
50 * Location of database binaries. 50 * Location of database binaries.
@@ -54,7 +54,7 @@ class upgradeDatabase extends Step @@ -54,7 +54,7 @@ class upgradeDatabase extends Step
54 * @var string 54 * @var string
55 */ 55 */
56 private $mysqlDir; // TODO:multiple databases 56 private $mysqlDir; // TODO:multiple databases
57 - 57 +
58 /** 58 /**
59 * Name of database binary. 59 * Name of database binary.
60 * 60 *
@@ -63,7 +63,7 @@ class upgradeDatabase extends Step @@ -63,7 +63,7 @@ class upgradeDatabase extends Step
63 * @var string 63 * @var string
64 */ 64 */
65 private $dbBinary = ''; // TODO:multiple databases 65 private $dbBinary = ''; // TODO:multiple databases
66 - 66 +
67 /** 67 /**
68 * List of errors used in template 68 * List of errors used in template
69 * 69 *
@@ -72,7 +72,7 @@ class upgradeDatabase extends Step @@ -72,7 +72,7 @@ class upgradeDatabase extends Step
72 * @var array 72 * @var array
73 */ 73 */
74 public $templateErrors = array('dmspassword', 'dmsuserpassword', 'con', 'dname', 'dtype', 'duname', 'dpassword'); 74 public $templateErrors = array('dmspassword', 'dmsuserpassword', 'con', 'dname', 'dtype', 'duname', 'dpassword');
75 - 75 +
76 /** 76 /**
77 * Flag to store class information in session 77 * Flag to store class information in session
78 * 78 *
@@ -81,7 +81,7 @@ class upgradeDatabase extends Step @@ -81,7 +81,7 @@ class upgradeDatabase extends Step
81 * @var array 81 * @var array
82 */ 82 */
83 public $storeInSession = true; 83 public $storeInSession = true;
84 - 84 +
85 public $sysVersion = ''; 85 public $sysVersion = '';
86 protected $silent = false; 86 protected $silent = false;
87 protected $temp_variables = array(); 87 protected $temp_variables = array();
@@ -96,7 +96,7 @@ class upgradeDatabase extends Step @@ -96,7 +96,7 @@ class upgradeDatabase extends Step
96 * @return string 96 * @return string
97 */ 97 */
98 public function doStep() { 98 public function doStep() {
99 - $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent, 99 + $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent,
100 "loadingText"=>"The database upgrade is under way. Please wait until it completes"); 100 "loadingText"=>"The database upgrade is under way. Please wait until it completes");
101 $this->initErrors(); 101 $this->initErrors();
102 if(!$this->inStep("database")) { 102 if(!$this->inStep("database")) {
@@ -119,25 +119,25 @@ class upgradeDatabase extends Step @@ -119,25 +119,25 @@ class upgradeDatabase extends Step
119 } 119 }
120 return 'error'; 120 return 'error';
121 } 121 }
122 - 122 +
123 $this->doRun(); 123 $this->doRun();
124 return 'landing'; 124 return 'landing';
125 } 125 }
126 - 126 +
127 private function confirmUpgrade() { 127 private function confirmUpgrade() {
128 return isset($_POST['ConfirmUpgrade']); 128 return isset($_POST['ConfirmUpgrade']);
129 } 129 }
130 - 130 +
131 private function upgrading() { 131 private function upgrading() {
132 return isset($_POST['RunUpgrade']); 132 return isset($_POST['RunUpgrade']);
133 - }  
134 - 133 + }
  134 +
135 private function doRun($action = null) { 135 private function doRun($action = null) {
136 $this->readConfig(); 136 $this->readConfig();
137 - 137 +
138 $this->util->dbUtilities->load($this->dbSettings['dbHost'], $this->dbSettings['dbPort'], $this->dbSettings['dbUser'],$this->dbSettings['dbPass'], $this->dbSettings['dbName']); 138 $this->util->dbUtilities->load($this->dbSettings['dbHost'], $this->dbSettings['dbPort'], $this->dbSettings['dbUser'],$this->dbSettings['dbPass'], $this->dbSettings['dbName']);
139 $this->temp_variables['action'] = $action; 139 $this->temp_variables['action'] = $action;
140 - 140 +
141 if (is_null($action) || ($action == 'preview')) { 141 if (is_null($action) || ($action == 'preview')) {
142 $this->temp_variables['title'] = 'Preview Upgrade'; 142 $this->temp_variables['title'] = 'Preview Upgrade';
143 $this->temp_variables['upgradeTable'] = $this->generateUpgradeTable(); 143 $this->temp_variables['upgradeTable'] = $this->generateUpgradeTable();
@@ -154,10 +154,10 @@ class upgradeDatabase extends Step @@ -154,10 +154,10 @@ class upgradeDatabase extends Step
154 } 154 }
155 $this->temp_variables['backupSuccessful'] = true; 155 $this->temp_variables['backupSuccessful'] = true;
156 } 156 }
157 - 157 +
158 return true; 158 return true;
159 } 159 }
160 - 160 +
161 private function generateUpgradeTable() { 161 private function generateUpgradeTable() {
162 $this->sysVersion = $this->readVersion(); 162 $this->sysVersion = $this->readVersion();
163 $this->temp_variables['systemVersion'] = $this->sysVersion; 163 $this->temp_variables['systemVersion'] = $this->sysVersion;
@@ -197,7 +197,7 @@ class upgradeDatabase extends Step @@ -197,7 +197,7 @@ class upgradeDatabase extends Step
197 $this->error[] = "KT installation version not found"; 197 $this->error[] = "KT installation version not found";
198 } 198 }
199 199
200 - return false; 200 + return false;
201 } 201 }
202 202
203 /** 203 /**
@@ -213,14 +213,14 @@ class upgradeDatabase extends Step @@ -213,14 +213,14 @@ class upgradeDatabase extends Step
213 $this->error[$e] = false; 213 $this->error[$e] = false;
214 } 214 }
215 } 215 }
216 - 216 +
217 public function storeSilent() { 217 public function storeSilent() {
218 $this->temp_variables['paths'] = $this->paths; 218 $this->temp_variables['paths'] = $this->paths;
219 $this->temp_variables['sysVersion'] = $this->sysVersion; 219 $this->temp_variables['sysVersion'] = $this->sysVersion;
220 $this->temp_variables['sysVersion'] = $this->sysVersion; 220 $this->temp_variables['sysVersion'] = $this->sysVersion;
221 $this->temp_variables['dbSettings'] = $this->dbSettings; 221 $this->temp_variables['dbSettings'] = $this->dbSettings;
222 } 222 }
223 - 223 +
224 private function upgradeConfirm() 224 private function upgradeConfirm()
225 { 225 {
226 if (!isset($_SESSION['backupStatus']) || $_SESSION['backupStatus'] === false) { 226 if (!isset($_SESSION['backupStatus']) || $_SESSION['backupStatus'] === false) {
@@ -234,12 +234,12 @@ class upgradeDatabase extends Step @@ -234,12 +234,12 @@ class upgradeDatabase extends Step
234 private function doDatabaseUpgrade() 234 private function doDatabaseUpgrade()
235 { 235 {
236 $errors = false; 236 $errors = false;
237 - 237 +
238 $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to 238 $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to
239 upgrade your KnowledgeTree installation to <strong>' . $this->sysVersion . '</strong>'; 239 upgrade your KnowledgeTree installation to <strong>' . $this->sysVersion . '</strong>';
240 - 240 +
241 $this->performPreUpgradeActions(); 241 $this->performPreUpgradeActions();
242 - 242 +
243 $res = $this->performAllUpgrades(); 243 $res = $this->performAllUpgrades();
244 if (!$res) { 244 if (!$res) {
245 $errors = true; 245 $errors = true;
@@ -247,7 +247,7 @@ class upgradeDatabase extends Step @@ -247,7 +247,7 @@ class upgradeDatabase extends Step
247 // TODO instantiate error details hideable section? 247 // TODO instantiate error details hideable section?
248 $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font> 248 $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font>
249 <br/><br/> 249 <br/><br/>
250 - Please restore from your backup and ensure that the database does not contain 250 + Please restore from your backup and ensure that the database does not contain
251 any unsupported modifications and try the upgrade process again. 251 any unsupported modifications and try the upgrade process again.
252 <br/><br/> 252 <br/><br/>
253 If the problem persists, contact KnowledgeTree Support.'; 253 If the problem persists, contact KnowledgeTree Support.';
@@ -255,27 +255,27 @@ class upgradeDatabase extends Step @@ -255,27 +255,27 @@ class upgradeDatabase extends Step
255 else { 255 else {
256 $this->temp_variables['upgradeStatus'] = '<font color="green">Upgrade succeeded.</font>'; 256 $this->temp_variables['upgradeStatus'] = '<font color="green">Upgrade succeeded.</font>';
257 } 257 }
258 - 258 +
259 $this->performPostUpgradeActions(); 259 $this->performPostUpgradeActions();
260 -  
261 - 260 +
  261 +
262 return !$errors; 262 return !$errors;
263 } 263 }
264 264
265 private function performPreUpgradeActions() { 265 private function performPreUpgradeActions() {
266 - 266 +
267 // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works. 267 // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works.
268 // It should idealy work the same as the upgrades. 268 // It should idealy work the same as the upgrades.
269 // Lock the scheduler 269 // Lock the scheduler
270 $lockFile = $this->cachePath . DIRECTORY_SEPARATOR . 'scheduler.lock'; 270 $lockFile = $this->cachePath . DIRECTORY_SEPARATOR . 'scheduler.lock';
271 touch($lockFile); 271 touch($lockFile);
272 return true; 272 return true;
273 - 273 +
274 } 274 }
275 - 275 +
276 private function deleteDirectory($sPath) { 276 private function deleteDirectory($sPath) {
277 if (empty($sPath) || !is_dir($sPath)) return; 277 if (empty($sPath) || !is_dir($sPath)) return;
278 - 278 +
279 if (!WINDOWS_OS) { 279 if (!WINDOWS_OS) {
280 if (file_exists('/bin/rm')) { 280 if (file_exists('/bin/rm')) {
281 $this->util->pexec(array('/bin/rm', '-rf', $sPath)); 281 $this->util->pexec(array('/bin/rm', '-rf', $sPath));
@@ -303,28 +303,31 @@ class upgradeDatabase extends Step @@ -303,28 +303,31 @@ class upgradeDatabase extends Step
303 closedir($hPath); 303 closedir($hPath);
304 rmdir($sPath); 304 rmdir($sPath);
305 } 305 }
306 - 306 +
307 private function performPostUpgradeActions() { 307 private function performPostUpgradeActions() {
308 - 308 +
309 // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works. 309 // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works.
310 // It should idealy work the same as the upgrades. 310 // It should idealy work the same as the upgrades.
311 - 311 +
312 // Ensure all plugins are re-registered. 312 // Ensure all plugins are re-registered.
313 $sql = "TRUNCATE plugin_helper"; 313 $sql = "TRUNCATE plugin_helper";
314 $this->util->dbUtilities->query($sql); 314 $this->util->dbUtilities->query($sql);
315 - 315 +
316 // Clear out all caches and proxies - they need to be regenerated with the new code 316 // Clear out all caches and proxies - they need to be regenerated with the new code
317 $this->deleteDirectory($this->proxyPath); 317 $this->deleteDirectory($this->proxyPath);
318 $this->deleteDirectory($this->cachePath); 318 $this->deleteDirectory($this->cachePath);
319 - 319 +
  320 + // Recreate the cache directory - it doesn't get regenerated
  321 + mkdir($this->cachePath, 0755);
  322 +
320 // Unlock the scheduler 323 // Unlock the scheduler
321 $lockFile = $this->cachePath . DIRECTORY_SEPARATOR . 'scheduler.lock'; 324 $lockFile = $this->cachePath . DIRECTORY_SEPARATOR . 'scheduler.lock';
322 if(file_exists($lockFile)){ 325 if(file_exists($lockFile)){
323 unlink($lockFile); 326 unlink($lockFile);
324 } 327 }
325 - 328 +
326 return true; 329 return true;
327 - 330 +
328 } 331 }
329 332
330 private function performAllUpgrades () { 333 private function performAllUpgrades () {
@@ -343,11 +346,12 @@ class upgradeDatabase extends Step @@ -343,11 +346,12 @@ class upgradeDatabase extends Step
343 } else { 346 } else {
344 $class = "even"; 347 $class = "even";
345 } 348 }
346 - $this->temp_variables['upgradeTable'] .= sprintf('<div class="row %s"><div class="foo">%s</div>' . "\n", $class, 349 + $this->temp_variables['upgradeTable'] .= sprintf('<div class="row %s"><div class="foo">%s</div>' . "\n", $class,
347 htmlspecialchars($upgrade->getDescription())); 350 htmlspecialchars($upgrade->getDescription()));
348 ++$row; 351 ++$row;
349 $res = $upgrade->performUpgrade(); 352 $res = $upgrade->performUpgrade();
350 - $this->temp_variables['upgradeTable'] .= sprintf('<div class="bar">%s</div>', $this->showResult($res)); 353 + $errors = $upgrade->getErrors();
  354 + $this->temp_variables['upgradeTable'] .= sprintf('<div class="bar">%s</div>', $this->showResult($res, $errors));
351 $this->temp_variables['upgradeTable'] .= '<br>' . "\n"; 355 $this->temp_variables['upgradeTable'] .= '<br>' . "\n";
352 $this->temp_variables['upgradeTable'] .= "</div>\n"; 356 $this->temp_variables['upgradeTable'] .= "</div>\n";
353 if ($res === false) { 357 if ($res === false) {
@@ -355,11 +359,11 @@ class upgradeDatabase extends Step @@ -355,11 +359,11 @@ class upgradeDatabase extends Step
355 break; 359 break;
356 } 360 }
357 } 361 }
358 - 362 +
359 return $res; 363 return $res;
360 } 364 }
361 -  
362 - private function showResult($res) { 365 +
  366 + private function showResult($res, $errors = null) {
363 if ($res && is_a($res, 'Upgrade_Already_Applied')) { 367 if ($res && is_a($res, 'Upgrade_Already_Applied')) {
364 return '<span style="color: orange">Already applied</span>'; 368 return '<span style="color: orange">Already applied</span>';
365 } 369 }
@@ -367,7 +371,15 @@ class upgradeDatabase extends Step @@ -367,7 +371,15 @@ class upgradeDatabase extends Step
367 return '<span style="color: green">Success</span>'; 371 return '<span style="color: green">Success</span>';
368 } 372 }
369 if ($res === false) { 373 if ($res === false) {
370 - return '<span style="color: red">Failure</span>'; 374 + $str = '<span style="color: red">Failure</span>';
  375 + if(is_array($errors)){
  376 + $str .= '<ul style="padding-left: 20px; color: red;">';
  377 + foreach ($errors as $error){
  378 + $str .= '<li style="padding: 5px 2px 0;">'.$error."</li>\n";
  379 + }
  380 + $str .= '</ul>';
  381 + }
  382 + return $str;
371 } 383 }
372 return $res; 384 return $res;
373 } 385 }