From 485a8c471ba92babfb7fd320f8f19ae7e3d44a86 Mon Sep 17 00:00:00 2001 From: jarrett Date: Tue, 6 Oct 2009 23:06:26 +0200 Subject: [PATCH] Merge Work/Home --- setup/migrate/steps/migrateDatabase.php | 3 ++- setup/migrate/steps/migrateInstallation.php | 33 +++++++++++++++++++-------------- setup/wizard/lib/services/windowsService.php | 6 ++++-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/setup/migrate/steps/migrateDatabase.php b/setup/migrate/steps/migrateDatabase.php index 90ce0ba..334e014 100644 --- a/setup/migrate/steps/migrateDatabase.php +++ b/setup/migrate/steps/migrateDatabase.php @@ -148,7 +148,7 @@ class migrateDatabase extends Step public function exportDatabase() { if(WINDOWS_OS) { - + $tmpFolder = "../"; } else { $tmpFolder = "/tmp/knowledgtree"; } @@ -160,6 +160,7 @@ class migrateDatabase extends Step $sqlFile = $tmpFolder."dms.sql"; $dbName = $dbSettings['dbName']; $cmd = "mysqldump -u{$uname} -p{$pwrd} {$dbName} > ".$sqlFile; + echo $cmd; $response = $this->util->pexec($cmd); if(file_exists($sqlFile)) { return true; diff --git a/setup/migrate/steps/migrateInstallation.php b/setup/migrate/steps/migrateInstallation.php index ef7304b..be8eedf 100644 --- a/setup/migrate/steps/migrateInstallation.php +++ b/setup/migrate/steps/migrateInstallation.php @@ -82,6 +82,8 @@ class migrateInstallation extends step private $dbSettings = array(); private $ktSettings = array(); private $urlPaths = array(); + 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"); + private $knownUnixLocations = array("/opt/ktdms","/var/www/ktdms"); function __construct() { $this->temp_variables = array("step_name"=>"installation", "silent"=>$this->silent); @@ -113,19 +115,15 @@ class migrateInstallation extends step public function detectInstallation() { if(WINDOWS_OS) { - $path1 = "'C:\\Program Files\ktdms'"; - $path2 = "'C:\\Program Files x86\ktdms'"; - if(file_exists($path1)) - $this->location = "C:\\Program Files\ktdms"; - elseif (file_exists($path2)) - $this->location = "C:\\Program Files x86\ktdms"; + foreach ($this->knownWindowsLocations as $loc=>$configPath) { + if(file_exists($configPath)) + $this->location = $loc; + } } else { - $path1 = "/opt/ktdms"; - $path2 = "/var/www/ktdms"; - if(file_exists($path1)) - $this->location = $path1; - elseif(file_exists($path2)) - $this->location = $path2; + foreach ($this->knownUnixLocations as $loc) { + if(file_exists($configPath)) + $this->location = $loc; + } } } @@ -133,17 +131,24 @@ class migrateInstallation extends step $ktInstallPath = isset($_POST['location']) ? $_POST['location']: ''; if($ktInstallPath != '') { $this->location = $ktInstallPath; - //echo $ktInstallPath;die; if(file_exists($ktInstallPath)) { $configPath = $ktInstallPath.DS."knowledgeTree".DS."config".DS."config-path"; if(file_exists($configPath)) { $configFilePath = file_get_contents($configPath); - if(file_exists($configFilePath)) { + if(file_exists($configFilePath)) { // For 3.7 and after $this->readConfig($configFilePath); $this->storeSilent(); return true; } else { + $configFilePath = $ktInstallPath.DS."knowledgeTree".DS.$configFilePath; // For older than 3.6.2 + $configFilePath = trim($configFilePath); + if(file_exists($configFilePath)) { + $this->readConfig($configFilePath); + $this->storeSilent(); + + return true; + } $this->error[] = "KT installation configuration file empty"; } } else { diff --git a/setup/wizard/lib/services/windowsService.php b/setup/wizard/lib/services/windowsService.php index 121ffed..9bc344d 100644 --- a/setup/wizard/lib/services/windowsService.php +++ b/setup/wizard/lib/services/windowsService.php @@ -142,7 +142,7 @@ class windowsService extends Service { */ public function restart() { $response = $this->stop(); - sleep(10); + sleep(1); $this->start(); } @@ -157,9 +157,11 @@ class windowsService extends Service { public function uninstall() { $status = $this->status(); if ($status != '') { + $this->stop(); + sleep(1); $cmd = "sc delete {$this->name}"; $response = $this->util->pexec($cmd); - sleep(10); + sleep(1); return $response; } return $status; -- libgit2 0.21.4