Commit 53941b2c9b9df7ecb991d606066fc3107c8c16a8
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
8 changed files
with
84 additions
and
35 deletions
setup/upgrade/resources/graphics/loading.gif
0 → 100644
1.81 KB
setup/upgrade/steps/upgradeBackup.php
| @@ -57,7 +57,8 @@ class upgradeBackup extends Step { | @@ -57,7 +57,8 @@ class upgradeBackup extends Step { | ||
| 57 | protected $temp_variables = array(); | 57 | protected $temp_variables = array(); |
| 58 | 58 | ||
| 59 | public function __construct() { | 59 | public function __construct() { |
| 60 | - $this->temp_variables = array("step_name"=>"backup", "silent"=>$this->silent); | 60 | + $this->temp_variables = array("step_name"=>"backup", "silent"=>$this->silent, |
| 61 | + "loadingText"=>"Your backup is under way. Please wait until it completes"); | ||
| 61 | $this->_dbhandler = new UpgradedbUtil(); | 62 | $this->_dbhandler = new UpgradedbUtil(); |
| 62 | $this->util = new UpgradeUtil(); | 63 | $this->util = new UpgradeUtil(); |
| 63 | } | 64 | } |
setup/upgrade/steps/upgradeDatabase.php
| @@ -121,7 +121,8 @@ class upgradeDatabase extends Step | @@ -121,7 +121,8 @@ class upgradeDatabase extends Step | ||
| 121 | * @param none | 121 | * @param none |
| 122 | */ | 122 | */ |
| 123 | public function __construct() { | 123 | public function __construct() { |
| 124 | - $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent); | 124 | + $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent, |
| 125 | + "loadingText"=>"The database upgrade is under way. Please wait until it completes"); | ||
| 125 | $this->_dbhandler = new UpgradedbUtil(); | 126 | $this->_dbhandler = new UpgradedbUtil(); |
| 126 | $this->_util = new UpgradeUtil(); | 127 | $this->_util = new UpgradeUtil(); |
| 127 | if(WINDOWS_OS) | 128 | if(WINDOWS_OS) |
| @@ -195,8 +196,10 @@ class upgradeDatabase extends Step | @@ -195,8 +196,10 @@ class upgradeDatabase extends Step | ||
| 195 | else if ($action == 'runUpgrade') { | 196 | else if ($action == 'runUpgrade') { |
| 196 | $this->temp_variables['title'] = 'Upgrade In Progress'; | 197 | $this->temp_variables['title'] = 'Upgrade In Progress'; |
| 197 | if (!$this->upgradeDatabase()) { | 198 | if (!$this->upgradeDatabase()) { |
| 199 | + $this->temp_variables['backupSuccessful'] = false; | ||
| 198 | return false; | 200 | return false; |
| 199 | } | 201 | } |
| 202 | + $this->temp_variables['backupSuccessful'] = true; | ||
| 200 | } | 203 | } |
| 201 | 204 | ||
| 202 | return true; | 205 | return true; |
| @@ -221,7 +224,7 @@ class upgradeDatabase extends Step | @@ -221,7 +224,7 @@ class upgradeDatabase extends Step | ||
| 221 | $ret .= "<tr bgcolor='darkgrey'><th width='10'>Code</th><th width='100%'>Description</th><th width='30'>Applied</th></tr>\n"; | 224 | $ret .= "<tr bgcolor='darkgrey'><th width='10'>Code</th><th width='100%'>Description</th><th width='30'>Applied</th></tr>\n"; |
| 222 | $i=0; | 225 | $i=0; |
| 223 | foreach ($upgrades as $upgrade) { | 226 | foreach ($upgrades as $upgrade) { |
| 224 | - $color=((($i++)%2)==0)?'white':'lightgrey'; | 227 | + $color = ((($i++)%2)==0) ? 'white' : 'lightgrey'; |
| 225 | $ret .= sprintf("<tr bgcolor='$color'><td>%s</td><td>%s</td><td>%s</td></tr>\n", | 228 | $ret .= sprintf("<tr bgcolor='$color'><td>%s</td><td>%s</td><td>%s</td></tr>\n", |
| 226 | htmlspecialchars($upgrade->getDescriptor()), | 229 | htmlspecialchars($upgrade->getDescriptor()), |
| 227 | htmlspecialchars($upgrade->getDescription()), | 230 | htmlspecialchars($upgrade->getDescription()), |
| @@ -299,11 +302,14 @@ class upgradeDatabase extends Step | @@ -299,11 +302,14 @@ class upgradeDatabase extends Step | ||
| 299 | { | 302 | { |
| 300 | global $default; | 303 | global $default; |
| 301 | 304 | ||
| 305 | + $errors = false; | ||
| 306 | + | ||
| 302 | $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to | 307 | $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to |
| 303 | upgrade your KnowledgeTree installation to <strong>' . $default->systemVersion . '</strong>'; | 308 | upgrade your KnowledgeTree installation to <strong>' . $default->systemVersion . '</strong>'; |
| 304 | 309 | ||
| 305 | $pre_res = $this->performPreUpgradeActions(); | 310 | $pre_res = $this->performPreUpgradeActions(); |
| 306 | if (PEAR::isError($pre_res)) { | 311 | if (PEAR::isError($pre_res)) { |
| 312 | + $errors = true; | ||
| 307 | $this->temp_variables['preUpgrade'] = '<font color="red">Pre-Upgrade actions failed.</font>'; | 313 | $this->temp_variables['preUpgrade'] = '<font color="red">Pre-Upgrade actions failed.</font>'; |
| 308 | } | 314 | } |
| 309 | else { | 315 | else { |
| @@ -313,7 +319,8 @@ class upgradeDatabase extends Step | @@ -313,7 +319,8 @@ class upgradeDatabase extends Step | ||
| 313 | 319 | ||
| 314 | $res = $this->performAllUpgrades(); | 320 | $res = $this->performAllUpgrades(); |
| 315 | if (PEAR::isError($res) || PEAR::isError($pres)) { | 321 | if (PEAR::isError($res) || PEAR::isError($pres)) { |
| 316 | - // TODO instantiate error details hideable section | 322 | + $errors = true; |
| 323 | + // TODO instantiate error details hideable section? | ||
| 317 | $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font> | 324 | $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font> |
| 318 | <br/><br/> | 325 | <br/><br/> |
| 319 | Please restore from your backup and ensure that the database does not contain | 326 | Please restore from your backup and ensure that the database does not contain |
| @@ -327,11 +334,14 @@ class upgradeDatabase extends Step | @@ -327,11 +334,14 @@ class upgradeDatabase extends Step | ||
| 327 | 334 | ||
| 328 | $post_pres = $this->performPostUpgradeActions(); | 335 | $post_pres = $this->performPostUpgradeActions(); |
| 329 | if (PEAR::isError($post_res)) { | 336 | if (PEAR::isError($post_res)) { |
| 337 | + $errors = true; | ||
| 330 | $this->temp_variables['postUpgrade'] = '<font color="red">Post-Upgrade actions failed.</font>'; | 338 | $this->temp_variables['postUpgrade'] = '<font color="red">Post-Upgrade actions failed.</font>'; |
| 331 | } | 339 | } |
| 332 | else { | 340 | else { |
| 333 | $this->temp_variables['postUpgrade'] = '<font color="green">Post-Upgrade actions succeeded.</font>'; | 341 | $this->temp_variables['postUpgrade'] = '<font color="green">Post-Upgrade actions succeeded.</font>'; |
| 334 | } | 342 | } |
| 343 | + | ||
| 344 | + return !$errors; | ||
| 335 | } | 345 | } |
| 336 | 346 | ||
| 337 | private function performPreUpgradeActions() { | 347 | private function performPreUpgradeActions() { |
| @@ -404,7 +414,7 @@ class upgradeDatabase extends Step | @@ -404,7 +414,7 @@ class upgradeDatabase extends Step | ||
| 404 | ++$row; | 414 | ++$row; |
| 405 | $res = $upgrade->performUpgrade(); | 415 | $res = $upgrade->performUpgrade(); |
| 406 | $this->temp_variables['upgradeTable'] .= sprintf('<div class="bar">%s</div>', $this->showResult($res)); | 416 | $this->temp_variables['upgradeTable'] .= sprintf('<div class="bar">%s</div>', $this->showResult($res)); |
| 407 | - $this->temp_variables['upgradeTable'] .= '<br style="clear: both">' . "\n"; | 417 | + $this->temp_variables['upgradeTable'] .= '<br>' . "\n"; |
| 408 | $this->temp_variables['upgradeTable'] .= "</div>\n"; | 418 | $this->temp_variables['upgradeTable'] .= "</div>\n"; |
| 409 | if (PEAR::isError($res)) { | 419 | if (PEAR::isError($res)) { |
| 410 | if (!is_a($res, 'Upgrade_Already_Applied')) { | 420 | if (!is_a($res, 'Upgrade_Already_Applied')) { |
setup/upgrade/steps/upgradeRestore.php
| @@ -58,7 +58,8 @@ class upgradeRestore extends Step { | @@ -58,7 +58,8 @@ class upgradeRestore extends Step { | ||
| 58 | protected $util = null; | 58 | protected $util = null; |
| 59 | 59 | ||
| 60 | public function __construct() { | 60 | public function __construct() { |
| 61 | - $this->temp_variables = array("step_name"=>"restore", "silent"=>$this->silent); | 61 | + $this->temp_variables = array("step_name"=>"restore", "silent"=>$this->silent, |
| 62 | + "loadingText"=>"The database restore is under way. Please wait until it completes"); | ||
| 62 | $this->_dbhandler = new UpgradedbUtil(); | 63 | $this->_dbhandler = new UpgradedbUtil(); |
| 63 | $this->util = new UpgradeUtil(); | 64 | $this->util = new UpgradeUtil(); |
| 64 | } | 65 | } |
setup/upgrade/templates/backup.tpl
| 1 | -<form action="index.php?step_name=backup" method="post"> | ||
| 2 | - <p class="title"><?php echo $title; ?></p> | 1 | +<form action="index.php?step_name=backup" method="post" name="dbForm" id="dbForm"> |
| 2 | + <p class="title"><?php echo $title; ?></p> | ||
| 3 | 3 | ||
| 4 | - <?php | ||
| 5 | - if($errors || $warnings){ | ||
| 6 | - echo '<div>' | ||
| 7 | - . '<a href="http://wiki.knowledgetree.com/Web_Based_Upgrader#Post_Upgrade" target="_blank">' | ||
| 8 | - . 'Click Here for help on overcoming backup issues</a></div><br/>'; | ||
| 9 | - } | ||
| 10 | - ?> | ||
| 11 | - <div id="step_content_complete" class="step"> | ||
| 12 | - <br/><br/> | ||
| 13 | - <div> | 4 | + <?php |
| 5 | + if($errors || $warnings){ | ||
| 6 | + echo '<div>' | ||
| 7 | + . '<a href="http://wiki.knowledgetree.com/Web_Based_Upgrader#Post_Upgrade" target="_blank">' | ||
| 8 | + . 'Click Here for help on overcoming backup issues</a></div><br/>'; | ||
| 9 | + } | ||
| 10 | + ?> | ||
| 11 | + <div id="step_content_complete" class="step"> | ||
| 12 | + <br/><br/> | ||
| 13 | + <div> | ||
| 14 | <?php | 14 | <?php |
| 15 | if ($dir != '') { | 15 | if ($dir != '') { |
| 16 | if (!$backupStatus) { | 16 | if (!$backupStatus) { |
| @@ -44,23 +44,26 @@ You can continue to do the backup manually using the following process: | @@ -44,23 +44,26 @@ You can continue to do the backup manually using the following process: | ||
| 44 | ?><nobr><?php echo $display; ?></nobr> | 44 | ?><nobr><?php echo $display; ?></nobr> |
| 45 | </table> | 45 | </table> |
| 46 | <P> | 46 | <P> |
| 47 | - </div> | ||
| 48 | - </div> | 47 | + </div> |
| 48 | + </div> | ||
| 49 | + <?php include 'templates/loading.tpl'; ?> | ||
| 50 | + <div id="buttonBar"> | ||
| 51 | + <input type="submit" name="Previous" value="Back" class="button_previous"> | ||
| 49 | <?php | 52 | <?php |
| 50 | if ($dir != '') | 53 | if ($dir != '') |
| 51 | { | 54 | { |
| 52 | if (($action == '') || ($action == 'confirm')) { | 55 | if (($action == '') || ($action == 'confirm')) { |
| 53 | - ?><input type="submit" name="BackupNow" value="Next" class="button_next"><?php | 56 | + ?><input type="button" name="BackupNow" value="Next" class="button_next" onclick="doSubmit(this);"><?php |
| 54 | } | 57 | } |
| 55 | else if ($backupStatus) { | 58 | else if ($backupStatus) { |
| 56 | ?><input type="submit" name="Next" value="Restore" class="button_next"> | 59 | ?><input type="submit" name="Next" value="Restore" class="button_next"> |
| 57 | <input type="submit" name="Upgrade" value="Upgrade" class="button_next"><?php | 60 | <input type="submit" name="Upgrade" value="Upgrade" class="button_next"><?php |
| 58 | } | 61 | } |
| 59 | else { | 62 | else { |
| 60 | - ?><input type="submit" name="Next" value="Next" class="button_next"><?php | 63 | + ?><input type="submit" name="Next" value="Next" class="button_next""><?php |
| 61 | } | 64 | } |
| 62 | } | 65 | } |
| 63 | 66 | ||
| 64 | ?> | 67 | ?> |
| 65 | - <input type="submit" name="Previous" value="Back" class="button_previous"> | 68 | + </div> |
| 66 | </form> | 69 | </form> |
| 67 | \ No newline at end of file | 70 | \ No newline at end of file |
setup/upgrade/templates/database.tpl
| 1 | -<form id="dbsettings" action="index.php?step_name=database" method="post"> | 1 | +<form action="index.php?step_name=database" method="post" name="dbForm" id="dbForm"> |
| 2 | <p class="title"><?php echo $title; ?></p> | 2 | <p class="title"><?php echo $title; ?></p> |
| 3 | <div id="database" class="step1" style="display:block;"> | 3 | <div id="database" class="step1" style="display:block;"> |
| 4 | <div class="description"> | 4 | <div class="description"> |
| @@ -23,30 +23,42 @@ | @@ -23,30 +23,42 @@ | ||
| 23 | <?php } ?> | 23 | <?php } ?> |
| 24 | <?php } | 24 | <?php } |
| 25 | else if ($action == 'runUpgrade') { | 25 | else if ($action == 'runUpgrade') { |
| 26 | - echo $preUpgrade; | 26 | + // hiding pre-upgrade notification |
| 27 | + /* | ||
| 28 | + echo $preUpgrade; | ||
| 27 | echo '<br/><br/>'; | 29 | echo '<br/><br/>'; |
| 30 | + */ | ||
| 28 | echo $upgradeTable; | 31 | echo $upgradeTable; |
| 29 | echo '<br/><br/>'; | 32 | echo '<br/><br/>'; |
| 30 | - echo $postUpgrade; | 33 | + // hiding pre-upgrade notification |
| 34 | + /* | ||
| 35 | + echo $postUpgrade; | ||
| 31 | echo '<br/><br/>'; | 36 | echo '<br/><br/>'; |
| 37 | + */ | ||
| 32 | echo $upgradeStatus; | 38 | echo $upgradeStatus; |
| 33 | echo '<br/><br/>'; | 39 | echo '<br/><br/>'; |
| 34 | } | 40 | } |
| 35 | ?> | 41 | ?> |
| 36 | </div> | 42 | </div> |
| 37 | </div> | 43 | </div> |
| 44 | + <?php include 'templates/loading.tpl'; ?> | ||
| 45 | + <div id="buttonBar"> | ||
| 38 | <?php if (empty($action) || ($action == 'preview')) { ?> | 46 | <?php if (empty($action) || ($action == 'preview')) { ?> |
| 39 | - <input type="submit" name="Previous" value="previous" class="button_previous"/> | ||
| 40 | - <input type="submit" name="ConfirmUpgrade" value="next" class="button_next"/> | 47 | + <input type="submit" name="Previous" value="Previous" class="button_previous"/> |
| 48 | + <input type="submit" name="ConfirmUpgrade" value="Next" class="button_next"/> | ||
| 41 | <?php } | 49 | <?php } |
| 42 | else if ($action == 'confirm') { ?> | 50 | else if ($action == 'confirm') { ?> |
| 43 | - <input type="submit" name="Cancel" value="cancel" class="button_previous"/> | ||
| 44 | - <input type="submit" name="RunUpgrade" value="next" class="button_next"/> | 51 | + <input type="submit" name="Cancel" value="Cancel" class="button_previous"/> |
| 52 | + <input type="button" name="RunUpgrade" value="Next" class="button_next" onclick="doSubmit(this);"/> | ||
| 45 | <?php } | 53 | <?php } |
| 46 | else if ($action == 'runUpgrade') { ?> | 54 | else if ($action == 'runUpgrade') { ?> |
| 47 | - <script type="text/javascript"> | ||
| 48 | - alert("To complete the upgrade please do the following before continuing:\n\n1. Restart the services as appropriate for your environment.\n\n\nOn first run of your upgraded installaton please do the following:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n2. Enable the new plugins you wish to use.\n\n\nSelect 'next' at the bottom of this page to continue.") | 55 | + <?php if ($backupSuccessful) { ?> |
| 56 | + <script type="text/javascript"> | ||
| 57 | + alert("To complete the upgrade please do the following before continuing:\n\n1. Restart the services as appropriate for your environment.\n\n\nOn first run of your upgraded installaton please do the following:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n2. Enable the new plugins you wish to use.\n\n\nSelect 'Finish' at the bottom of this page to continue.") | ||
| 49 | </script> | 58 | </script> |
| 50 | - <input type="submit" name="Next" value="next" class="button_next"/> | 59 | + <input type="submit" name="Next" value="Finish" class="button_next"/> |
| 60 | + <?php } | ||
| 61 | + else { ?><input type="submit" name="Previous" value="Restore" class="button_previous"/><?php } ?> | ||
| 51 | <?php } ?> | 62 | <?php } ?> |
| 63 | + </div> | ||
| 52 | </form> | 64 | </form> |
| 53 | \ No newline at end of file | 65 | \ No newline at end of file |
setup/upgrade/templates/loading.tpl
0 → 100644
| 1 | +<div id="loadingBar" style="display:none; text-align: center; padding: 4px;"> | ||
| 2 | + <img src="/setup/upgrade/resources/graphics/loading.gif"> | ||
| 3 | + <br/> | ||
| 4 | + <?php echo $loadingText; ?> | ||
| 5 | +</div> | ||
| 6 | +<script> | ||
| 7 | + function doSubmit(obj) | ||
| 8 | + { | ||
| 9 | + var e = document.createElement('input'); | ||
| 10 | + e.setAttribute('type','hidden'); | ||
| 11 | + e.setAttribute('name',obj.name); | ||
| 12 | + e.setAttribute('value',obj.value); | ||
| 13 | + document.getElementById('loadingBar').appendChild(e); | ||
| 14 | + | ||
| 15 | + $('#buttonBar').hide(); | ||
| 16 | + $('#loadingBar').show(); | ||
| 17 | + $('#dbForm').submit(); | ||
| 18 | + } | ||
| 19 | +</script> | ||
| 0 | \ No newline at end of file | 20 | \ No newline at end of file |
setup/upgrade/templates/restore.tpl
| 1 | -<form action="index.php?step_name=restore" method="post"> | 1 | +<form action="index.php?step_name=restore" method="post" name="dbForm" id="dbForm"> |
| 2 | <p class="title"><?php echo $title; ?></p> | 2 | <p class="title"><?php echo $title; ?></p> |
| 3 | 3 | ||
| 4 | <?php | 4 | <?php |
| @@ -92,11 +92,14 @@ Press <i>Next</i> to attempt the command(s) above. | @@ -92,11 +92,14 @@ Press <i>Next</i> to attempt the command(s) above. | ||
| 92 | ?> | 92 | ?> |
| 93 | </div> | 93 | </div> |
| 94 | </div> | 94 | </div> |
| 95 | + <?php include 'templates/loading.tpl'; ?> | ||
| 96 | + <div id="buttonBar"> | ||
| 95 | <input type="submit" name="Previous" value="Back" class="button_previous"> | 97 | <input type="submit" name="Previous" value="Back" class="button_previous"> |
| 96 | <?php if (($dir != '') && ($selected)) { ?> | 98 | <?php if (($dir != '') && ($selected)) { ?> |
| 97 | - <input type="submit" name="RunRestore" value="Next" class="button_next"> | 99 | + <input type="button" name="RunRestore" value="Next" class="button_next" onclick="doSubmit(this);"> |
| 98 | <?php } | 100 | <?php } |
| 99 | else { ?> | 101 | else { ?> |
| 100 | <input type="submit" name="Next" value="Next" class="button_next"> | 102 | <input type="submit" name="Next" value="Next" class="button_next"> |
| 101 | <?php } ?> | 103 | <?php } ?> |
| 104 | + </div> | ||
| 102 | </form> | 105 | </form> |
| 103 | \ No newline at end of file | 106 | \ No newline at end of file |