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 148  
149 149 public function exportDatabase() {
150 150 if(WINDOWS_OS) {
151   -
  151 + $tmpFolder = "../";
152 152 } else {
153 153 $tmpFolder = "/tmp/knowledgtree";
154 154 }
... ... @@ -160,6 +160,7 @@ class migrateDatabase extends Step
160 160 $sqlFile = $tmpFolder."dms.sql";
161 161 $dbName = $dbSettings['dbName'];
162 162 $cmd = "mysqldump -u{$uname} -p{$pwrd} {$dbName} > ".$sqlFile;
  163 + echo $cmd;
163 164 $response = $this->util->pexec($cmd);
164 165 if(file_exists($sqlFile)) {
165 166 return true;
... ...
setup/migrate/steps/migrateInstallation.php
... ... @@ -82,6 +82,8 @@ class migrateInstallation extends step
82 82 private $dbSettings = array();
83 83 private $ktSettings = array();
84 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 88 function __construct() {
87 89 $this->temp_variables = array("step_name"=>"installation", "silent"=>$this->silent);
... ... @@ -113,19 +115,15 @@ class migrateInstallation extends step
113 115  
114 116 public function detectInstallation() {
115 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 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 131 $ktInstallPath = isset($_POST['location']) ? $_POST['location']: '';
134 132 if($ktInstallPath != '') {
135 133 $this->location = $ktInstallPath;
136   - //echo $ktInstallPath;die;
137 134 if(file_exists($ktInstallPath)) {
138 135 $configPath = $ktInstallPath.DS."knowledgeTree".DS."config".DS."config-path";
139 136 if(file_exists($configPath)) {
140 137 $configFilePath = file_get_contents($configPath);
141   - if(file_exists($configFilePath)) {
  138 + if(file_exists($configFilePath)) { // For 3.7 and after
142 139 $this->readConfig($configFilePath);
143 140 $this->storeSilent();
144 141  
145 142 return true;
146 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 152 $this->error[] = "KT installation configuration file empty";
148 153 }
149 154 } else {
... ...
setup/wizard/lib/services/windowsService.php
... ... @@ -142,7 +142,7 @@ class windowsService extends Service {
142 142 */
143 143 public function restart() {
144 144 $response = $this->stop();
145   - sleep(10);
  145 + sleep(1);
146 146 $this->start();
147 147 }
148 148  
... ... @@ -157,9 +157,11 @@ class windowsService extends Service {
157 157 public function uninstall() {
158 158 $status = $this->status();
159 159 if ($status != '') {
  160 + $this->stop();
  161 + sleep(1);
160 162 $cmd = "sc delete {$this->name}";
161 163 $response = $this->util->pexec($cmd);
162   - sleep(10);
  164 + sleep(1);
163 165 return $response;
164 166 }
165 167 return $status;
... ...