Commit 9cb4740922346f286befe5268e020a7c27f5c76e
1 parent
db1c5f1c
:Story ID:1616390: Restructured Migration Wizard according to specification file.
Committed by: Jarrett Jordaan Reviewed by: Philip Arkcoll
Showing
16 changed files
with
87 additions
and
42 deletions
setup/migrate/config/commercial_config.xml
| ... | ... | @@ -10,8 +10,8 @@ |
| 10 | 10 | <migrate version="3.7" type="Commercial Edition"> |
| 11 | 11 | <steps> |
| 12 | 12 | <step name="Current Installation">installation</step> |
| 13 | - <step name="Database Migration">database</step> | |
| 14 | - <step name="Deactivate Services">services</step> | |
| 13 | + <step name="Database Export">database</step> | |
| 14 | + <step name="Pre Migration">services</step> | |
| 15 | 15 | <step name="Complete">complete</step> |
| 16 | 16 | </steps> |
| 17 | 17 | </migrate> |
| 18 | 18 | \ No newline at end of file | ... | ... |
setup/migrate/config/community_config.xml
| ... | ... | @@ -10,8 +10,8 @@ |
| 10 | 10 | <migrate version="3.7" type="Community Edition"> |
| 11 | 11 | <steps> |
| 12 | 12 | <step name="Current Installation">installation</step> |
| 13 | - <step name="Database Migration">database</step> | |
| 14 | - <step name="Deactivate Services">services</step> | |
| 13 | + <step name="Database Export">database</step> | |
| 14 | + <step name="Pre Migration">services</step> | |
| 15 | 15 | <step name="Complete">complete</step> |
| 16 | 16 | </steps> |
| 17 | 17 | </migrate> |
| 18 | 18 | \ No newline at end of file | ... | ... |
setup/migrate/steps/migrateComplete.php
| ... | ... | @@ -53,7 +53,8 @@ class migrateComplete extends Step { |
| 53 | 53 | private $database_check = 'tick'; |
| 54 | 54 | protected $conf = array(); |
| 55 | 55 | protected $silent = true; |
| 56 | - | |
| 56 | + protected $mysqlServiceName = "KTMysql"; | |
| 57 | + | |
| 57 | 58 | function doStep() { |
| 58 | 59 | $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); |
| 59 | 60 | $this->doRun(); |
| ... | ... | @@ -128,6 +129,9 @@ class migrateComplete extends Step { |
| 128 | 129 | $this->temp_variables['services'][$serv->getName()]['class'] = $state; |
| 129 | 130 | $this->temp_variables['services'][$serv->getName()]['name'] = $serv->getName(); |
| 130 | 131 | } |
| 132 | + if(!$this->checkMysql()) { | |
| 133 | + return false; | |
| 134 | + } | |
| 131 | 135 | if ($this->services_check != 'tick') { |
| 132 | 136 | return false; |
| 133 | 137 | } |
| ... | ... | @@ -136,6 +140,41 @@ class migrateComplete extends Step { |
| 136 | 140 | } |
| 137 | 141 | |
| 138 | 142 | /** |
| 143 | + * Check if services are uninstall | |
| 144 | + * | |
| 145 | + */ | |
| 146 | + private function checkMysql() { | |
| 147 | + $running = false; | |
| 148 | + if(WINDOWS_OS) { | |
| 149 | + $cmd = "sc query {$this->mysqlServiceName}"; | |
| 150 | + $response = $this->util->pexec($cmd); | |
| 151 | + if($response['out']) { | |
| 152 | + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key | |
| 153 | + } | |
| 154 | + if($state == "STARTED") { | |
| 155 | + return true; | |
| 156 | + } | |
| 157 | + } else { | |
| 158 | + $installation = $this->getDataFromSession("installation"); // Get installation directory | |
| 159 | + $mysqlPid = $installation['location'].DS."mysql".DS."data".DS."mysqld.pid"; | |
| 160 | + if(file_exists($mysqlPid)) | |
| 161 | + $running = true; | |
| 162 | + } | |
| 163 | + if($running) { | |
| 164 | + $this->temp_variables['services']['KTMysql']['class'] = "cross"; | |
| 165 | + $this->temp_variables['services']['KTMysql']['name'] = "KTMysql"; | |
| 166 | + $this->temp_variables['services']['KTMysql']['msg'] = "Service Running"; | |
| 167 | + $this->error[] = "Service : KTMysql running.<br/>"; | |
| 168 | + return false; | |
| 169 | + } else { | |
| 170 | + $this->temp_variables['services']['KTMysql']['class'] = "tick"; | |
| 171 | + $this->temp_variables['services']['KTMysql']['name'] = "KTMysql"; | |
| 172 | + $this->temp_variables['services']['KTMysql']['msg'] = "Service has been uninstalled"; | |
| 173 | + return true; | |
| 174 | + } | |
| 175 | + } | |
| 176 | + | |
| 177 | + /** | |
| 139 | 178 | * Set all silent mode varibles |
| 140 | 179 | * |
| 141 | 180 | */ | ... | ... |
setup/migrate/steps/migrateDatabase.php
| ... | ... | @@ -168,8 +168,8 @@ class migrateDatabase extends Step |
| 168 | 168 | } |
| 169 | 169 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; |
| 170 | 170 | if($noFile) { |
| 171 | - $this->error[]['error'] = "Could not connect to the KnowledgeTree Database"; | |
| 172 | - $this->error[]['msg'] = "Make sure all KnowledgeTree Services are running."; | |
| 171 | + $this->error[]['error'] = "The KnowledgeTree Setup Wizard was unable to connect to your KnowledgeTree 3.6.1 database"; | |
| 172 | + $this->error[]['msg'] = "Please ensure that all KnowledgeTree Services are running."; | |
| 173 | 173 | $this->error[]['cmd'] = "<p class=\"description\">Click <b>Next</b> after resolving the above errors.</p>"; |
| 174 | 174 | $this->temp_variables['manual_export'] = ""; |
| 175 | 175 | } else { | ... | ... |
setup/migrate/steps/migrateServices.php
setup/migrate/templates/database.tpl
| ... | ... | @@ -11,8 +11,7 @@ |
| 11 | 11 | //print_r($errors); |
| 12 | 12 | ?> |
| 13 | 13 | <?php if(empty($errors)) { ?> |
| 14 | -<p class="description">The Setup Wizard will now migrate your existing database to the new Zend Server stack. This process may take | |
| 15 | - several minutes to complete.</p><br /> | |
| 14 | +<p class="description">The Setup Wizard will now export your existing database in preparation for the migration to the new KnowledgeTree Stack.</p><br /> | |
| 16 | 15 | <span class="error">Please ensure that your database is backed up before proceeding. If you need assistance with backing up see the <a class="description_click" target="_blank" href="http://wiki.knowledgetree.com/Backing_up_and_restoring_KnowledgeTree">'Backing up and restoring KnowledgeTree'</a> wiki entry. |
| 17 | 16 | </span> |
| 18 | 17 | <br /><br /> | ... | ... |
setup/migrate/templates/installation.tpl
| ... | ... | @@ -4,9 +4,9 @@ |
| 4 | 4 | <?php |
| 5 | 5 | if(!$errors && !$warnings) { |
| 6 | 6 | ?> |
| 7 | - <span class='big_ok'> </span> | |
| 7 | +<!-- <span class='big_ok'> </span> | |
| 8 | 8 | KnowledgeTree installation has been detected. Please click <b>Next</b> to continue. |
| 9 | - <br/><br/> | |
| 9 | + <br/><br/>--> | |
| 10 | 10 | <?php |
| 11 | 11 | } |
| 12 | 12 | ?> |
| ... | ... | @@ -26,19 +26,18 @@ |
| 26 | 26 | <?php } ?> |
| 27 | 27 | <div id="step_content_<?php echo $step_name; ?>" class="step"> |
| 28 | 28 | <p class="description"> |
| 29 | - Enter the full path of the installation you wish to upgrade: | |
| 29 | + The Setup Wizard will now prepare your current KnowledgeTree database for migration to the new KnowledgeTree Stack. | |
| 30 | + </p> | |
| 31 | + | |
| 32 | + <p class="description"> | |
| 33 | + Please enter the full path of the installation you wish to upgrade: | |
| 30 | 34 | </p> |
| 31 | - <p class="empty_space"> | |
| 32 | - <small>The default is <b>'C:\Program Files\ktdms'</b> on Windows and <b>'/opt/ktdms'</b> or <b>'/home/<i>username</i>/ktdms/'</b> on other operating systems.</small> | |
| 33 | - </p> | |
| 34 | - <p class="empty_space"> | |
| 35 | - <small> | |
| 36 | - Make sure that the KnowledgeTree services are running. | |
| 37 | - </small> | |
| 38 | - </p> | |
| 39 | - <br/> | |
| 35 | + | |
| 40 | 36 | <input id="location" name="location" type="text" style="width:430px; float:left" value="<?php if($location) echo $location; ?>"> |
| 41 | 37 | <br/><br/> |
| 38 | + <p class="description"> | |
| 39 | + <small>(The default is <b>'C:\Program Files\ktdms'</b> on Windows and <b>'/opt/ktdms'</b> or <b>'/home/<i>username</i>/ktdms/'</b> on other operating systems.)</small> | |
| 40 | + </p> | |
| 42 | 41 | <?php |
| 43 | 42 | if($errors) { |
| 44 | 43 | foreach ($errors as $error) { | ... | ... |
setup/migrate/templates/installation_confirm.tpl
| ... | ... | @@ -68,7 +68,7 @@ |
| 68 | 68 | </table> |
| 69 | 69 | |
| 70 | 70 | </div> |
| 71 | - <input type="submit" name="Edit" value="Edit" class="button_previous"/> | |
| 71 | + <input type="submit" name="Edit" value="Back" class="button_previous"/> | |
| 72 | 72 | <input type="submit" name="Confirm" value="Confirm" class="button_next"/> |
| 73 | 73 | </form> |
| 74 | 74 | <?php if (AJAX) { echo $html->js('form.js'); } ?> |
| 75 | 75 | \ No newline at end of file | ... | ... |
setup/wizard/path.php
setup/wizard/resources/css/wizard.css
setup/wizard/steps/complete.php
| ... | ... | @@ -61,6 +61,10 @@ class complete extends Step { |
| 61 | 61 | |
| 62 | 62 | function doStep() { |
| 63 | 63 | $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); |
| 64 | + $this->temp_variables['isCE'] = false; | |
| 65 | + $type = $this->util->getVersionType(); | |
| 66 | + if($type == "community") | |
| 67 | + $this->temp_variables['isCE'] = true; | |
| 64 | 68 | $this->doRun(); |
| 65 | 69 | return 'landing'; |
| 66 | 70 | } |
| ... | ... | @@ -247,20 +251,7 @@ class complete extends Step { |
| 247 | 251 | * |
| 248 | 252 | */ |
| 249 | 253 | private function registerPlugins() { |
| 250 | -// define(KT_LIB_DIR, SYSTEM_DIR); | |
| 251 | -// require_once(WIZARD_DIR . "lib" . DS . "plugins". DS . "pluginutil.inc.php"); | |
| 252 | - KTPluginUtil::_walk(KT_DIR . '/plugins', $files); | |
| 253 | - foreach ($files as $sFile) { | |
| 254 | - $plugin_ending = "Plugin.php"; | |
| 255 | - if (substr($sFile, -strlen($plugin_ending)) === $plugin_ending) { | |
| 256 | - /* Set default priority */ | |
| 257 | - $plugins[$sFile] = KTPluginUtil::getPluginPriority($sFile); | |
| 258 | - } | |
| 259 | - } | |
| 260 | 254 | |
| 261 | - /* Sort the plugins by priority */ | |
| 262 | - asort($plugins); | |
| 263 | - print_r($plugins); | |
| 264 | 255 | } |
| 265 | 256 | |
| 266 | 257 | /** | ... | ... |
setup/wizard/steps/install.php
| ... | ... | @@ -64,6 +64,7 @@ class install extends step |
| 64 | 64 | |
| 65 | 65 | public function doStep() { |
| 66 | 66 | $this->temp_variables = array("step_name"=>"install"); |
| 67 | + $this->checkInstallType(); // Set silent mode variables | |
| 67 | 68 | if(!$this->inStep("install")) { |
| 68 | 69 | return 'landing'; |
| 69 | 70 | } |
| ... | ... | @@ -90,7 +91,6 @@ class install extends step |
| 90 | 91 | public function doRun() |
| 91 | 92 | { |
| 92 | 93 | $value = 'disable'; |
| 93 | - $this->checkInstallType(); // Set silent mode variables | |
| 94 | 94 | if(isset($_POST['Install'])) { |
| 95 | 95 | if(isset($_POST['call_home'])){ |
| 96 | 96 | $value = $_POST['call_home']; | ... | ... |
setup/wizard/steps/installtype.php
| ... | ... | @@ -45,6 +45,10 @@ class installType extends step |
| 45 | 45 | |
| 46 | 46 | public function doStep() { |
| 47 | 47 | $this->temp_variables = array("step_name"=>"installtype"); |
| 48 | + $type = $this->util->getVersionType(); | |
| 49 | + $this->temp_variables['isCE'] = false; | |
| 50 | + if($type == "community") | |
| 51 | + $this->temp_variables['isCE'] = true; | |
| 48 | 52 | if(!$this->inStep("installtype")) { |
| 49 | 53 | return 'landing'; |
| 50 | 54 | } | ... | ... |
setup/wizard/templates/complete.tpl
| ... | ... | @@ -34,7 +34,11 @@ |
| 34 | 34 | dmsctl.bat install<br/> |
| 35 | 35 | dmsctl.bat start |
| 36 | 36 | <?php } else { ?> |
| 37 | - cd /usr/share/knowledgetree-ce<br/> | |
| 37 | + <?php if ($isCE) { ?> | |
| 38 | + cd /usr/share/knowledgetree-ce<br/> | |
| 39 | + <?php } else { ?> | |
| 40 | + cd /usr/share/knowledgetree<br/> | |
| 41 | + <?php } ?> | |
| 38 | 42 | sudo ./dmsctl.sh start |
| 39 | 43 | <?php } ?> |
| 40 | 44 | </p> | ... | ... |
setup/wizard/templates/installtype.tpl
| ... | ... | @@ -7,16 +7,18 @@ |
| 7 | 7 | <table> |
| 8 | 8 | <tr> |
| 9 | 9 | <td> <input type="radio" name="installtype" value="Clean Install" checked id="clean" /> </td> |
| 10 | - <td> <label for="clean"><b>Install KnowledgeTree (Default)</b> <br/>Install KnowledgeTree for the first time</label> </td> | |
| 10 | + <td> <label for="clean"><b>Install KnowledgeTree (Default)</b> <br/>Choose this option if you are installing KnowledgeTree for the first time</label> </td> | |
| 11 | 11 | </tr> |
| 12 | 12 | <tr> |
| 13 | 13 | <td> <input type="radio" name="installtype" value="Upgrade Installation" id="migrate" /> </td> |
| 14 | - <td> <label for="migrate"><b>Upgrade KnowledgeTree Stack Install</b> <br/>Migrate KnowledgeTree to the new Zend Server Stack and then perform the upgrade</label></td> | |
| 14 | + <td> <label for="migrate"><b>Upgrade KnowledgeTree Stack Install</b> <br/>Choose this option if you are upgrading from a previous version of the KnowledgeTree Stack</label></td> | |
| 15 | 15 | </tr> |
| 16 | + <?php if ($isCE) { ?> | |
| 16 | 17 | <tr> |
| 17 | 18 | <td> <input type="radio" name="installtype" value="Upgrade Only" id="upgrade" /> </td> |
| 18 | - <td> <label for="upgrade"><b>Upgrade KnowledgeTree Source Only Install</b> <br/> Upgrade from a Source Only installation of KnowledgeTree</label></td> | |
| 19 | + <td> <label for="upgrade"><b>Upgrade KnowledgeTree Source Only Install</b> <br/>Choose this option if you are upgrading from a previous Source Only installation of KnowledgeTree</label></td> | |
| 19 | 20 | </tr> |
| 21 | + <?php } ?> | |
| 20 | 22 | </table> |
| 21 | 23 | </div> |
| 22 | 24 | <input type="submit" name="Previous" value="Previous" class="button_previous"/> | ... | ... |