Commit 485a8c471ba92babfb7fd320f8f19ae7e3d44a86

Authored by jarrett
1 parent 71ceb5dd

Merge Work/Home

Commited By: Jarrett Jordaan

Reviewed By: Megan Watson
setup/migrate/steps/migrateDatabase.php
@@ -148,7 +148,7 @@ class migrateDatabase extends Step @@ -148,7 +148,7 @@ class migrateDatabase extends Step
148 148
149 public function exportDatabase() { 149 public function exportDatabase() {
150 if(WINDOWS_OS) { 150 if(WINDOWS_OS) {
151 - 151 + $tmpFolder = "../";
152 } else { 152 } else {
153 $tmpFolder = "/tmp/knowledgtree"; 153 $tmpFolder = "/tmp/knowledgtree";
154 } 154 }
@@ -160,6 +160,7 @@ class migrateDatabase extends Step @@ -160,6 +160,7 @@ class migrateDatabase extends Step
160 $sqlFile = $tmpFolder."dms.sql"; 160 $sqlFile = $tmpFolder."dms.sql";
161 $dbName = $dbSettings['dbName']; 161 $dbName = $dbSettings['dbName'];
162 $cmd = "mysqldump -u{$uname} -p{$pwrd} {$dbName} > ".$sqlFile; 162 $cmd = "mysqldump -u{$uname} -p{$pwrd} {$dbName} > ".$sqlFile;
  163 + echo $cmd;
163 $response = $this->util->pexec($cmd); 164 $response = $this->util->pexec($cmd);
164 if(file_exists($sqlFile)) { 165 if(file_exists($sqlFile)) {
165 return true; 166 return true;
setup/migrate/steps/migrateInstallation.php
@@ -82,6 +82,8 @@ class migrateInstallation extends step @@ -82,6 +82,8 @@ class migrateInstallation extends step
82 private $dbSettings = array(); 82 private $dbSettings = array();
83 private $ktSettings = array(); 83 private $ktSettings = array();
84 private $urlPaths = array(); 84 private $urlPaths = array();
  85 + private $knownWindowsLocations = array("C:\Program Files\ktdms"=>"C:\Program Files\ktdms\knowledgeTree\config\config-path","C:\Program Files x86\ktdms"=>"C:\Program Files x86\ktdms\knowledgeTree\config\config-path","C:\ktdms"=>"C:\ktdms\knowledgeTree\config\config-path");
  86 + private $knownUnixLocations = array("/opt/ktdms","/var/www/ktdms");
85 87
86 function __construct() { 88 function __construct() {
87 $this->temp_variables = array("step_name"=>"installation", "silent"=>$this->silent); 89 $this->temp_variables = array("step_name"=>"installation", "silent"=>$this->silent);
@@ -113,19 +115,15 @@ class migrateInstallation extends step @@ -113,19 +115,15 @@ class migrateInstallation extends step
113 115
114 public function detectInstallation() { 116 public function detectInstallation() {
115 if(WINDOWS_OS) { 117 if(WINDOWS_OS) {
116 - $path1 = "'C:\\Program Files\ktdms'";  
117 - $path2 = "'C:\\Program Files x86\ktdms'";  
118 - if(file_exists($path1))  
119 - $this->location = "C:\\Program Files\ktdms";  
120 - elseif (file_exists($path2))  
121 - $this->location = "C:\\Program Files x86\ktdms"; 118 + foreach ($this->knownWindowsLocations as $loc=>$configPath) {
  119 + if(file_exists($configPath))
  120 + $this->location = $loc;
  121 + }
122 } else { 122 } else {
123 - $path1 = "/opt/ktdms";  
124 - $path2 = "/var/www/ktdms";  
125 - if(file_exists($path1))  
126 - $this->location = $path1;  
127 - elseif(file_exists($path2))  
128 - $this->location = $path2; 123 + foreach ($this->knownUnixLocations as $loc) {
  124 + if(file_exists($configPath))
  125 + $this->location = $loc;
  126 + }
129 } 127 }
130 } 128 }
131 129
@@ -133,17 +131,24 @@ class migrateInstallation extends step @@ -133,17 +131,24 @@ class migrateInstallation extends step
133 $ktInstallPath = isset($_POST['location']) ? $_POST['location']: ''; 131 $ktInstallPath = isset($_POST['location']) ? $_POST['location']: '';
134 if($ktInstallPath != '') { 132 if($ktInstallPath != '') {
135 $this->location = $ktInstallPath; 133 $this->location = $ktInstallPath;
136 - //echo $ktInstallPath;die;  
137 if(file_exists($ktInstallPath)) { 134 if(file_exists($ktInstallPath)) {
138 $configPath = $ktInstallPath.DS."knowledgeTree".DS."config".DS."config-path"; 135 $configPath = $ktInstallPath.DS."knowledgeTree".DS."config".DS."config-path";
139 if(file_exists($configPath)) { 136 if(file_exists($configPath)) {
140 $configFilePath = file_get_contents($configPath); 137 $configFilePath = file_get_contents($configPath);
141 - if(file_exists($configFilePath)) { 138 + if(file_exists($configFilePath)) { // For 3.7 and after
142 $this->readConfig($configFilePath); 139 $this->readConfig($configFilePath);
143 $this->storeSilent(); 140 $this->storeSilent();
144 141
145 return true; 142 return true;
146 } else { 143 } else {
  144 + $configFilePath = $ktInstallPath.DS."knowledgeTree".DS.$configFilePath; // For older than 3.6.2
  145 + $configFilePath = trim($configFilePath);
  146 + if(file_exists($configFilePath)) {
  147 + $this->readConfig($configFilePath);
  148 + $this->storeSilent();
  149 +
  150 + return true;
  151 + }
147 $this->error[] = "KT installation configuration file empty"; 152 $this->error[] = "KT installation configuration file empty";
148 } 153 }
149 } else { 154 } else {
setup/wizard/lib/services/windowsService.php
@@ -142,7 +142,7 @@ class windowsService extends Service { @@ -142,7 +142,7 @@ class windowsService extends Service {
142 */ 142 */
143 public function restart() { 143 public function restart() {
144 $response = $this->stop(); 144 $response = $this->stop();
145 - sleep(10); 145 + sleep(1);
146 $this->start(); 146 $this->start();
147 } 147 }
148 148
@@ -157,9 +157,11 @@ class windowsService extends Service { @@ -157,9 +157,11 @@ class windowsService extends Service {
157 public function uninstall() { 157 public function uninstall() {
158 $status = $this->status(); 158 $status = $this->status();
159 if ($status != '') { 159 if ($status != '') {
  160 + $this->stop();
  161 + sleep(1);
160 $cmd = "sc delete {$this->name}"; 162 $cmd = "sc delete {$this->name}";
161 $response = $this->util->pexec($cmd); 163 $response = $this->util->pexec($cmd);
162 - sleep(10); 164 + sleep(1);
163 return $response; 165 return $response;
164 } 166 }
165 return $status; 167 return $status;