Commit e3c1352a5cb0015794212f5142ed6243377d9320
1 parent
806fd35e
Merge Work/Home
Commited By: Jarrett Jordaan Reviewed By: Megan Watson
Showing
13 changed files
with
98 additions
and
103 deletions
setup/migrate/steps/migrateDatabase.php
| @@ -122,16 +122,16 @@ class migrateDatabase extends Step | @@ -122,16 +122,16 @@ class migrateDatabase extends Step | ||
| 122 | $manual = false; // If file was exported manually | 122 | $manual = false; // If file was exported manually |
| 123 | $dbSettings = $installation['dbSettings']; | 123 | $dbSettings = $installation['dbSettings']; |
| 124 | $location = $installation['location']; | 124 | $location = $installation['location']; |
| 125 | - $uname = $this->temp_variables['duname']; | ||
| 126 | - $pwrd = $this->temp_variables['dpassword']; | 125 | +// $uname = $this->temp_variables['duname']; |
| 126 | +// $pwrd = $this->temp_variables['dpassword']; | ||
| 127 | $port = $this->util->getPort($location); | 127 | $port = $this->util->getPort($location); |
| 128 | $tmpFolder = $this->resolveTempDir(); | 128 | $tmpFolder = $this->resolveTempDir(); |
| 129 | if(WINDOWS_OS) { | 129 | if(WINDOWS_OS) { |
| 130 | $termOrBash = "command prompt window"; | 130 | $termOrBash = "command prompt window"; |
| 131 | - $exe = "\"$location\mysql\bin\mysqldump.exe\""; // Location of dump | 131 | + $exe = DS."$location".DS."mysql".DS."bin".DS."mysqldump.exe".DS; // Location of dump |
| 132 | } else { | 132 | } else { |
| 133 | $termOrBash = "terminal window"; | 133 | $termOrBash = "terminal window"; |
| 134 | - $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump | 134 | + $exe = "'$location".DS."mysql".DS."bin".DS."mysqldump'"; // Location of dump |
| 135 | } | 135 | } |
| 136 | $date = date('Y-m-d-H-i-s'); | 136 | $date = date('Y-m-d-H-i-s'); |
| 137 | if(isset($database['manual_export'])) { | 137 | if(isset($database['manual_export'])) { |
| @@ -147,7 +147,7 @@ class migrateDatabase extends Step | @@ -147,7 +147,7 @@ class migrateDatabase extends Step | ||
| 147 | if(!$manual) { // Try to export database | 147 | if(!$manual) { // Try to export database |
| 148 | $sqlFile = $tmpFolder."/kt-backup-$date.sql"; | 148 | $sqlFile = $tmpFolder."/kt-backup-$date.sql"; |
| 149 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; | 149 | $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; |
| 150 | - $response = $this->util->pexec($cmd); | 150 | + $this->util->pexec($cmd); |
| 151 | } | 151 | } |
| 152 | if(file_exists($sqlFile)) { | 152 | if(file_exists($sqlFile)) { |
| 153 | $fileContents = file_get_contents($sqlFile); | 153 | $fileContents = file_get_contents($sqlFile); |
setup/migrate/steps/migrateInstallation.php
| @@ -85,10 +85,6 @@ class migrateInstallation extends step | @@ -85,10 +85,6 @@ class migrateInstallation extends step | ||
| 85 | private $ktSettings = array(); | 85 | private $ktSettings = array(); |
| 86 | 86 | ||
| 87 | private $urlPaths = array(); | 87 | private $urlPaths = array(); |
| 88 | - | ||
| 89 | - 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"); | ||
| 90 | - | ||
| 91 | - private $knownUnixLocations = array("/opt/ktdms","/var/www/ktdms"); | ||
| 92 | 88 | ||
| 93 | /** | 89 | /** |
| 94 | * Installation Settings | 90 | * Installation Settings |
| @@ -132,12 +128,14 @@ class migrateInstallation extends step | @@ -132,12 +128,14 @@ class migrateInstallation extends step | ||
| 132 | 128 | ||
| 133 | public function detectInstallation() { | 129 | public function detectInstallation() { |
| 134 | if(WINDOWS_OS) { | 130 | if(WINDOWS_OS) { |
| 135 | - foreach ($this->knownWindowsLocations as $loc=>$configPath) { | 131 | + $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"); |
| 132 | + foreach ($knownWindowsLocations as $loc=>$configPath) { | ||
| 136 | if(file_exists($configPath)) | 133 | if(file_exists($configPath)) |
| 137 | $this->location = $loc; | 134 | $this->location = $loc; |
| 138 | } | 135 | } |
| 139 | } else { | 136 | } else { |
| 140 | - foreach ($this->knownUnixLocations as $loc=>$configPath) { | 137 | + $knownUnixLocations = array("/opt/ktdms"=>"/opt/ktdms/knowledgeTree/config/config-path","/var/www/ktdms"=>"/var/www/ktdms/knowledgeTree/config/config-path"); |
| 138 | + foreach ($knownUnixLocations as $loc=>$configPath) { | ||
| 141 | if(file_exists($configPath)) | 139 | if(file_exists($configPath)) |
| 142 | $this->location = $loc; | 140 | $this->location = $loc; |
| 143 | } | 141 | } |
| @@ -162,9 +160,10 @@ class migrateInstallation extends step | @@ -162,9 +160,10 @@ class migrateInstallation extends step | ||
| 162 | if($this->foundVersion < $this->supportedVersion) { | 160 | if($this->foundVersion < $this->supportedVersion) { |
| 163 | $this->versionError = true; | 161 | $this->versionError = true; |
| 164 | $this->error[] = "KT installation needs to be 3.6.1 or higher"; | 162 | $this->error[] = "KT installation needs to be 3.6.1 or higher"; |
| 165 | - } else { | ||
| 166 | - return true; | 163 | + return false; |
| 167 | } | 164 | } |
| 165 | + | ||
| 166 | + return true; | ||
| 168 | } | 167 | } |
| 169 | 168 | ||
| 170 | public function readVersion() { | 169 | public function readVersion() { |
| @@ -222,6 +221,8 @@ class migrateInstallation extends step | @@ -222,6 +221,8 @@ class migrateInstallation extends step | ||
| 222 | } else { | 221 | } else { |
| 223 | $this->error[] = "Please Enter a Location"; | 222 | $this->error[] = "Please Enter a Location"; |
| 224 | } | 223 | } |
| 224 | + | ||
| 225 | + return false; | ||
| 225 | } | 226 | } |
| 226 | 227 | ||
| 227 | private function loadConfig($path) { | 228 | private function loadConfig($path) { |
| @@ -246,7 +247,7 @@ class migrateInstallation extends step | @@ -246,7 +247,7 @@ class migrateInstallation extends step | ||
| 246 | $this->ktSettings = array('fileSystemRoot'=> $froot, | 247 | $this->ktSettings = array('fileSystemRoot'=> $froot, |
| 247 | ); | 248 | ); |
| 248 | // $urlPaths = $ini->getSection('urls'); | 249 | // $urlPaths = $ini->getSection('urls'); |
| 249 | - $urlPaths = $this->util->iniUtilities->getSection('urls'); | 250 | +// $urlPaths = $this->util->iniUtilities->getSection('urls'); |
| 250 | $varDir = $froot.DS.'var'; | 251 | $varDir = $froot.DS.'var'; |
| 251 | $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), | 252 | $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), |
| 252 | array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), | 253 | array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), |
setup/migrate/steps/migrateServices.php
| @@ -201,11 +201,11 @@ class migrateServices extends Step | @@ -201,11 +201,11 @@ class migrateServices extends Step | ||
| 201 | */ | 201 | */ |
| 202 | public function unixStop() { | 202 | public function unixStop() { |
| 203 | $cmd = $this->conf['location']."/dmsctl.sh stop lucene"; | 203 | $cmd = $this->conf['location']."/dmsctl.sh stop lucene"; |
| 204 | - $res = $this->util->pexec($cmd); | 204 | + $this->util->pexec($cmd); |
| 205 | $cmd = $this->conf['location']."/dmsctl.sh stop scheduler"; | 205 | $cmd = $this->conf['location']."/dmsctl.sh stop scheduler"; |
| 206 | - $res = $this->util->pexec($cmd); | 206 | + $this->util->pexec($cmd); |
| 207 | $cmd = $this->conf['location']."/dmsctl.sh stop soffice"; | 207 | $cmd = $this->conf['location']."/dmsctl.sh stop soffice"; |
| 208 | - $res = $this->util->pexec($cmd); | 208 | + $this->util->pexec($cmd); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | /** | 211 | /** |
| @@ -214,11 +214,11 @@ class migrateServices extends Step | @@ -214,11 +214,11 @@ class migrateServices extends Step | ||
| 214 | */ | 214 | */ |
| 215 | public function windowsStop() { | 215 | public function windowsStop() { |
| 216 | $cmd = "sc delete KTLucene"; | 216 | $cmd = "sc delete KTLucene"; |
| 217 | - $res = $this->util->pexec($cmd); | 217 | + $this->util->pexec($cmd); |
| 218 | $cmd = "sc delete KTScheduler"; | 218 | $cmd = "sc delete KTScheduler"; |
| 219 | - $res = $this->util->pexec($cmd); | 219 | + $this->util->pexec($cmd); |
| 220 | $cmd = "sc delete KTOpenoffice"; | 220 | $cmd = "sc delete KTOpenoffice"; |
| 221 | - $res = $this->util->pexec($cmd); | 221 | + $this->util->pexec($cmd); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | /** | 224 | /** |
| @@ -232,7 +232,7 @@ class migrateServices extends Step | @@ -232,7 +232,7 @@ class migrateServices extends Step | ||
| 232 | $serv->load(); | 232 | $serv->load(); |
| 233 | $sStatus = $serv->status(); | 233 | $sStatus = $serv->status(); |
| 234 | if($sStatus != '') { | 234 | if($sStatus != '') { |
| 235 | - $res = $serv->uninstall(); | 235 | + $serv->uninstall(); |
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | } | 238 | } |
setup/wizard/dbUtilities.php
| @@ -105,15 +105,13 @@ class dbUtilities { | @@ -105,15 +105,13 @@ class dbUtilities { | ||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | public function load($dhost = 'localhost', $duname, $dpassword, $dbname) { | 107 | public function load($dhost = 'localhost', $duname, $dpassword, $dbname) { |
| 108 | - if($this->isConnected($dhost, $duname, $dpassword, $dbname)) return true; | ||
| 109 | - $this->dbhost = $dhost; | ||
| 110 | - $this->dbuname = $duname; | ||
| 111 | - $this->dbpassword = $dpassword; | ||
| 112 | - $this->dbconnection = @mysql_connect($dhost, $duname, $dpassword); | ||
| 113 | - if(!$this->dbconnection) { | ||
| 114 | - $this->error[] = @mysql_error(); | 108 | + if(!$this->isConnected($dhost, $duname, $dpassword, $dbname)) { |
| 109 | + $this->dbhost = $dhost; | ||
| 110 | + $this->dbuname = $duname; | ||
| 111 | + $this->dbpassword = $dpassword; | ||
| 112 | + $this->dbconnection = @mysql_connect($dhost, $duname, $dpassword); | ||
| 113 | + $this->dbname = $dbname; | ||
| 115 | } | 114 | } |
| 116 | - $this->dbname = $dbname; | ||
| 117 | } | 115 | } |
| 118 | 116 | ||
| 119 | public function isConnected($dhost = 'localhost', $duname, $dpassword, $dbname) { | 117 | public function isConnected($dhost = 'localhost', $duname, $dpassword, $dbname) { |
| @@ -235,6 +233,9 @@ class dbUtilities { | @@ -235,6 +233,9 @@ class dbUtilities { | ||
| 235 | * @return array. | 233 | * @return array. |
| 236 | */ | 234 | */ |
| 237 | public function getErrors() { | 235 | public function getErrors() { |
| 236 | + if(!$this->dbconnection) { | ||
| 237 | + $this->error[] = @mysql_error(); | ||
| 238 | + } | ||
| 238 | return $this->error; | 239 | return $this->error; |
| 239 | } | 240 | } |
| 240 | 241 |
setup/wizard/iniUtilities.php
| @@ -67,23 +67,23 @@ class iniUtilities { | @@ -67,23 +67,23 @@ class iniUtilities { | ||
| 67 | function backupIni($iniFile) | 67 | function backupIni($iniFile) |
| 68 | { | 68 | { |
| 69 | $content = file_get_contents($iniFile); | 69 | $content = file_get_contents($iniFile); |
| 70 | - if ($content === false) | 70 | + if (!$content === false) |
| 71 | { | 71 | { |
| 72 | - return false; | ||
| 73 | - } | ||
| 74 | - $date = date('YmdHis'); | ||
| 75 | - | ||
| 76 | - $backupFile = $iniFile . '.' .$date; | ||
| 77 | - if (is_writeable($backupFile)) { | ||
| 78 | - file_put_contents($backupFile, $content); | ||
| 79 | - } | 72 | + $date = date('YmdHis'); |
| 73 | + | ||
| 74 | + $backupFile = $iniFile . '.' .$date; | ||
| 75 | + if (is_writeable($backupFile)) { | ||
| 76 | + file_put_contents($backupFile, $content); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + return false; | ||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | function read($iniFile) { | 82 | function read($iniFile) { |
| 83 | $iniArray = file($iniFile); | 83 | $iniArray = file($iniFile); |
| 84 | $section = ''; | 84 | $section = ''; |
| 85 | foreach($iniArray as $iniLine) { | 85 | foreach($iniArray as $iniLine) { |
| 86 | - $this->lineNum++; | 86 | + ++$this->lineNum; |
| 87 | $iniLine = trim($iniLine); | 87 | $iniLine = trim($iniLine); |
| 88 | $firstChar = substr($iniLine, 0, 1); | 88 | $firstChar = substr($iniLine, 0, 1); |
| 89 | if($firstChar == ';') { | 89 | if($firstChar == ';') { |
| @@ -163,12 +163,12 @@ class iniUtilities { | @@ -163,12 +163,12 @@ class iniUtilities { | ||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | function itemExists($checkSection, $checkItem) { | 165 | function itemExists($checkSection, $checkItem) { |
| 166 | - | ||
| 167 | $this->exists = ''; | 166 | $this->exists = ''; |
| 168 | foreach($this->cleanArray as $section => $items) { | 167 | foreach($this->cleanArray as $section => $items) { |
| 169 | if($section == $checkSection) { | 168 | if($section == $checkSection) { |
| 170 | $this->exists = 'section'; | 169 | $this->exists = 'section'; |
| 171 | - foreach ($items as $key => $value) { | 170 | + $items = array_flip($items); |
| 171 | + foreach ($items as $key) { | ||
| 172 | if($key == $checkItem) { | 172 | if($key == $checkItem) { |
| 173 | return true; | 173 | return true; |
| 174 | } | 174 | } |
setup/wizard/installUtil.php
| @@ -39,12 +39,11 @@ | @@ -39,12 +39,11 @@ | ||
| 39 | * @package Installer | 39 | * @package Installer |
| 40 | * @version Version 0.1 | 40 | * @version Version 0.1 |
| 41 | */ | 41 | */ |
| 42 | - | ||
| 43 | -require_once("../wizard/iniUtilities.php"); | ||
| 44 | -require_once("../wizard/dbUtilities.php"); | 42 | +require_once("path.php"); // Include if util is loaded directly |
| 43 | +require_once(WIZARD_DIR."iniUtilities.php"); | ||
| 44 | +require_once(WIZARD_DIR."dbUtilities.php"); | ||
| 45 | 45 | ||
| 46 | class InstallUtil { | 46 | class InstallUtil { |
| 47 | - | ||
| 48 | private $salt = 'installers'; | 47 | private $salt = 'installers'; |
| 49 | public $dbUtilities = null; | 48 | public $dbUtilities = null; |
| 50 | public $iniUtilities = null; | 49 | public $iniUtilities = null; |
| @@ -78,15 +77,17 @@ class InstallUtil { | @@ -78,15 +77,17 @@ class InstallUtil { | ||
| 78 | public function error($error) { | 77 | public function error($error) { |
| 79 | $template_vars['error'] = $error; | 78 | $template_vars['error'] = $error; |
| 80 | $file = "templates/error.tpl"; | 79 | $file = "templates/error.tpl"; |
| 81 | - if (!file_exists($file)) { | ||
| 82 | - return false; | 80 | + if (file_exists($file)) { |
| 81 | + extract($template_vars); // Extract the vars to local namespace | ||
| 82 | + ob_start(); | ||
| 83 | + include($file); | ||
| 84 | + $contents = ob_get_contents(); | ||
| 85 | + ob_end_clean(); | ||
| 86 | + echo $contents; | ||
| 83 | } | 87 | } |
| 84 | - extract($template_vars); // Extract the vars to local namespace | ||
| 85 | - ob_start(); | ||
| 86 | - include($file); | ||
| 87 | - $contents = ob_get_contents(); | ||
| 88 | - ob_end_clean(); | ||
| 89 | - echo $contents; | 88 | + |
| 89 | + return false; | ||
| 90 | + | ||
| 90 | } | 91 | } |
| 91 | /** | 92 | /** |
| 92 | * Check if system needs to be installed | 93 | * Check if system needs to be installed |
| @@ -173,7 +174,7 @@ class InstallUtil { | @@ -173,7 +174,7 @@ class InstallUtil { | ||
| 173 | return $url; | 174 | return $url; |
| 174 | } | 175 | } |
| 175 | if (!empty($protocol)) { | 176 | if (!empty($protocol)) { |
| 176 | - $url = $protocol .':'. end($array = explode(':', $url, 2)); | 177 | + $url = $protocol .':'. end(explode(':', $url, 2)); |
| 177 | } | 178 | } |
| 178 | if (!empty($port)) { | 179 | if (!empty($port)) { |
| 179 | $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', | 180 | $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', |
| @@ -333,9 +334,11 @@ class InstallUtil { | @@ -333,9 +334,11 @@ class InstallUtil { | ||
| 333 | return false; | 334 | return false; |
| 334 | elseif(!is_dir($fullpath)) { | 335 | elseif(!is_dir($fullpath)) { |
| 335 | $perms = substr(sprintf('%o', fileperms($fullpath)), -4); | 336 | $perms = substr(sprintf('%o', fileperms($fullpath)), -4); |
| 336 | - if($perms != $filemode) | ||
| 337 | - if (!chmod($fullpath, $filemode)) | 337 | + if($perms != $filemode) { |
| 338 | + if (!chmod($fullpath, $filemode)) { | ||
| 338 | return false; | 339 | return false; |
| 340 | + } | ||
| 341 | + } | ||
| 339 | } elseif(!$this->chmodRecursive($fullpath, $filemode)) | 342 | } elseif(!$this->chmodRecursive($fullpath, $filemode)) |
| 340 | return false; | 343 | return false; |
| 341 | } | 344 | } |
| @@ -362,7 +365,8 @@ class InstallUtil { | @@ -362,7 +365,8 @@ class InstallUtil { | ||
| 362 | */ | 365 | */ |
| 363 | public function canWriteFile($filename) { | 366 | public function canWriteFile($filename) { |
| 364 | $fh = fopen($filename, "w+"); | 367 | $fh = fopen($filename, "w+"); |
| 365 | - if($fr = fwrite($fh, 'test') === false) { | 368 | + $fr = fwrite($fh, 'test'); |
| 369 | + if($fr === false) { | ||
| 366 | return false; | 370 | return false; |
| 367 | } | 371 | } |
| 368 | 372 | ||
| @@ -380,9 +384,9 @@ class InstallUtil { | @@ -380,9 +384,9 @@ class InstallUtil { | ||
| 380 | */ | 384 | */ |
| 381 | public function javaBridge() { | 385 | public function javaBridge() { |
| 382 | try { | 386 | try { |
| 383 | - $javaSystem = new Java('java.lang.System'); | 387 | + new Java('java.lang.System'); |
| 384 | } catch (JavaException $e) { | 388 | } catch (JavaException $e) { |
| 385 | - return false; | 389 | + return $e; |
| 386 | } | 390 | } |
| 387 | return true; | 391 | return true; |
| 388 | } | 392 | } |
| @@ -457,6 +461,8 @@ class InstallUtil { | @@ -457,6 +461,8 @@ class InstallUtil { | ||
| 457 | return preg_replace('/java:/', '', $r); | 461 | return preg_replace('/java:/', '', $r); |
| 458 | } | 462 | } |
| 459 | } | 463 | } |
| 464 | + | ||
| 465 | + return ''; | ||
| 460 | } | 466 | } |
| 461 | 467 | ||
| 462 | /** | 468 | /** |
| @@ -734,6 +740,7 @@ class InstallUtil { | @@ -734,6 +740,7 @@ class InstallUtil { | ||
| 734 | * @return string | 740 | * @return string |
| 735 | */ | 741 | */ |
| 736 | public function installEnvironment() { | 742 | public function installEnvironment() { |
| 743 | + $matches = false; | ||
| 737 | preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type | 744 | preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type |
| 738 | if($matches) { | 745 | if($matches) { |
| 739 | return 'Zend'; | 746 | return 'Zend'; |
| @@ -761,7 +768,7 @@ class InstallUtil { | @@ -761,7 +768,7 @@ class InstallUtil { | ||
| 761 | array_pop($sysdir); | 768 | array_pop($sysdir); |
| 762 | array_pop($sysdir); | 769 | array_pop($sysdir); |
| 763 | $zendsys = ''; | 770 | $zendsys = ''; |
| 764 | - foreach ($sysdir as $k=>$v) { | 771 | + foreach ($sysdir as $v) { |
| 765 | $zendsys .= $v.DS; | 772 | $zendsys .= $v.DS; |
| 766 | } | 773 | } |
| 767 | $bin = $zendsys."ZendServer".DS."bin".DS; | 774 | $bin = $zendsys."ZendServer".DS."bin".DS; |
| @@ -786,15 +793,16 @@ class InstallUtil { | @@ -786,15 +793,16 @@ class InstallUtil { | ||
| 786 | if(WINDOWS_OS) { // Mysql bin [Windows] | 793 | if(WINDOWS_OS) { // Mysql bin [Windows] |
| 787 | $serverPaths = explode(';',$_SERVER['PATH']); | 794 | $serverPaths = explode(';',$_SERVER['PATH']); |
| 788 | foreach ($serverPaths as $apath) { | 795 | foreach ($serverPaths as $apath) { |
| 796 | + $matches = false; | ||
| 789 | preg_match('/mysql/i', $apath, $matches); | 797 | preg_match('/mysql/i', $apath, $matches); |
| 790 | if($matches) { | 798 | if($matches) { |
| 791 | return $apath.DS; | 799 | return $apath.DS; |
| 792 | break; | 800 | break; |
| 793 | } | 801 | } |
| 794 | } | 802 | } |
| 795 | - } else { | ||
| 796 | - return "mysql"; // Assume its linux and can be executed from command line | ||
| 797 | } | 803 | } |
| 804 | + | ||
| 805 | + return "mysql"; // Assume its linux and can be executed from command line | ||
| 798 | } | 806 | } |
| 799 | 807 | ||
| 800 | public function sqlInstallDir() { | 808 | public function sqlInstallDir() { |
setup/wizard/installWizard.php
| @@ -63,8 +63,8 @@ function __autoload($class) { // Attempt and autoload classes | @@ -63,8 +63,8 @@ function __autoload($class) { // Attempt and autoload classes | ||
| 63 | if(preg_match('/Helper/', $class)) { | 63 | if(preg_match('/Helper/', $class)) { |
| 64 | require_once(HELPER_DIR."$class.php"); | 64 | require_once(HELPER_DIR."$class.php"); |
| 65 | } | 65 | } |
| 66 | - return null; | ||
| 67 | } | 66 | } |
| 67 | + return false; | ||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | class InstallWizard { | 70 | class InstallWizard { |
| @@ -263,8 +263,6 @@ class InstallWizard { | @@ -263,8 +263,6 @@ class InstallWizard { | ||
| 263 | return true; | 263 | return true; |
| 264 | break; | 264 | break; |
| 265 | } | 265 | } |
| 266 | - | ||
| 267 | - return $res; | ||
| 268 | } | 266 | } |
| 269 | 267 | ||
| 270 | /** | 268 | /** |
setup/wizard/installer.php
| @@ -157,7 +157,7 @@ class Installer { | @@ -157,7 +157,7 @@ class Installer { | ||
| 157 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); | 157 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); |
| 158 | } catch (Exception $e) { | 158 | } catch (Exception $e) { |
| 159 | $util = new InstallUtil(); | 159 | $util = new InstallUtil(); |
| 160 | - $util->error("Error reading configuration file: $name"); | 160 | + $util->error("Error reading configuration file: $e"); |
| 161 | exit(); | 161 | exit(); |
| 162 | } | 162 | } |
| 163 | } | 163 | } |
| @@ -431,8 +431,7 @@ class Installer { | @@ -431,8 +431,7 @@ class Installer { | ||
| 431 | if($class->runInstall()) { // Check if step needs to be installed | 431 | if($class->runInstall()) { // Check if step needs to be installed |
| 432 | $class->setDataFromSession($className); // Set Session Information | 432 | $class->setDataFromSession($className); // Set Session Information |
| 433 | $class->setPostConfig(); // Set any posted variables | 433 | $class->setPostConfig(); // Set any posted variables |
| 434 | - $response = $class->installStep(); // Run install step | ||
| 435 | - // TODO : Break on error response | 434 | + $class->installStep(); // Run install step |
| 436 | } | 435 | } |
| 437 | } else { | 436 | } else { |
| 438 | $util = new InstallUtil(); | 437 | $util = new InstallUtil(); |
setup/wizard/lib/helpers/htmlHelper.php
| @@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
| 41 | */ | 41 | */ |
| 42 | class htmlHelper { | 42 | class htmlHelper { |
| 43 | 43 | ||
| 44 | - var $tags = array( | 44 | + private $tags = array( |
| 45 | 'meta' => '<meta%s/>', | 45 | 'meta' => '<meta%s/>', |
| 46 | 'metalink' => '<link href="%s"%s/>', | 46 | 'metalink' => '<link href="%s"%s/>', |
| 47 | 'link' => '<a href="%s"%s>%s</a>', | 47 | 'link' => '<a href="%s"%s>%s</a>', |
setup/wizard/lib/services/unixLucene.php
| @@ -59,7 +59,7 @@ class unixLucene extends unixService { | @@ -59,7 +59,7 @@ class unixLucene extends unixService { | ||
| 59 | * @param string | 59 | * @param string |
| 60 | * @return void | 60 | * @return void |
| 61 | */ | 61 | */ |
| 62 | - public function load($options = null) { | 62 | + public function load() { |
| 63 | $this->setLuceneSource("ktlucene.jar"); | 63 | $this->setLuceneSource("ktlucene.jar"); |
| 64 | $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS); | 64 | $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS); |
| 65 | $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS); | 65 | $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS); |
| @@ -148,14 +148,13 @@ class unixLucene extends unixService { | @@ -148,14 +148,13 @@ class unixLucene extends unixService { | ||
| 148 | * @return array | 148 | * @return array |
| 149 | */ | 149 | */ |
| 150 | public function stop() { | 150 | public function stop() { |
| 151 | - // TODO: Breaks things | ||
| 152 | $state = $this->status(); | 151 | $state = $this->status(); |
| 153 | if($state != '') { | 152 | if($state != '') { |
| 154 | $cmd = "pkill -f ".$this->getLuceneSource(); | 153 | $cmd = "pkill -f ".$this->getLuceneSource(); |
| 155 | $response = $this->util->pexec($cmd); | 154 | $response = $this->util->pexec($cmd); |
| 156 | return $response; | 155 | return $response; |
| 157 | } | 156 | } |
| 158 | - | 157 | + return $state; |
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | public function install() { | 160 | public function install() { |
| @@ -173,6 +172,7 @@ class unixLucene extends unixService { | @@ -173,6 +172,7 @@ class unixLucene extends unixService { | ||
| 173 | if(is_array($response['out'])) { | 172 | if(is_array($response['out'])) { |
| 174 | if(count($response['out']) > 1) { | 173 | if(count($response['out']) > 1) { |
| 175 | foreach ($response['out'] as $r) { | 174 | foreach ($response['out'] as $r) { |
| 175 | + $matches = false; | ||
| 176 | preg_match('/grep/', $r, $matches); // Ignore grep | 176 | preg_match('/grep/', $r, $matches); // Ignore grep |
| 177 | if(!$matches) { | 177 | if(!$matches) { |
| 178 | return 'STARTED'; | 178 | return 'STARTED'; |
| @@ -207,20 +207,14 @@ class unixLucene extends unixService { | @@ -207,20 +207,14 @@ class unixLucene extends unixService { | ||
| 207 | $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!"; | 207 | $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!"; |
| 208 | if(DEBUG) { | 208 | if(DEBUG) { |
| 209 | echo "Command : $cmd<br/>"; | 209 | echo "Command : $cmd<br/>"; |
| 210 | - return ; | 210 | + return false; |
| 211 | } | 211 | } |
| 212 | $response = $this->util->pexec($cmd); | 212 | $response = $this->util->pexec($cmd); |
| 213 | 213 | ||
| 214 | return $response; | 214 | return $response; |
| 215 | - } elseif ($state == '') { | ||
| 216 | - // Start Service | ||
| 217 | - return true; | ||
| 218 | - } else { | ||
| 219 | - // Service Running Already | ||
| 220 | - return true; | ||
| 221 | } | 215 | } |
| 222 | 216 | ||
| 223 | - return false; | 217 | + return true; |
| 224 | } | 218 | } |
| 225 | 219 | ||
| 226 | public function getName() { | 220 | public function getName() { |
setup/wizard/lib/services/unixOpenOffice.php
| @@ -106,13 +106,14 @@ class unixOpenOffice extends unixService { | @@ -106,13 +106,14 @@ class unixOpenOffice extends unixService { | ||
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | - public function status($updrade = false) { | 109 | + public function status() { |
| 110 | sleep(1); | 110 | sleep(1); |
| 111 | $cmd = "ps ax | grep soffice"; | 111 | $cmd = "ps ax | grep soffice"; |
| 112 | $response = $this->util->pexec($cmd); | 112 | $response = $this->util->pexec($cmd); |
| 113 | if(is_array($response['out'])) { | 113 | if(is_array($response['out'])) { |
| 114 | if(count($response['out']) > 1) { | 114 | if(count($response['out']) > 1) { |
| 115 | foreach ($response['out'] as $r) { | 115 | foreach ($response['out'] as $r) { |
| 116 | + $matches = false; | ||
| 116 | preg_match('/grep/', $r, $matches); // Ignore grep | 117 | preg_match('/grep/', $r, $matches); // Ignore grep |
| 117 | if(!$matches) { | 118 | if(!$matches) { |
| 118 | return 'STARTED'; | 119 | return 'STARTED'; |
| @@ -140,20 +141,13 @@ class unixOpenOffice extends unixService { | @@ -140,20 +141,13 @@ class unixOpenOffice extends unixService { | ||
| 140 | $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -"accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!"; | 141 | $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -"accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!"; |
| 141 | if(DEBUG) { | 142 | if(DEBUG) { |
| 142 | echo "Command : $cmd<br/>"; | 143 | echo "Command : $cmd<br/>"; |
| 143 | - return ; | 144 | + return false; |
| 144 | } | 145 | } |
| 145 | - $response = $this->util->pexec($cmd); | ||
| 146 | - | ||
| 147 | - return $response; | ||
| 148 | - } elseif ($state == '') { | ||
| 149 | - // Start Service | ||
| 150 | - return true; | ||
| 151 | - } else { | ||
| 152 | - // Service Running Already | ||
| 153 | - return true; | 146 | + |
| 147 | + return $this->util->pexec($cmd); | ||
| 154 | } | 148 | } |
| 155 | 149 | ||
| 156 | - return false; | 150 | + return true; |
| 157 | } | 151 | } |
| 158 | 152 | ||
| 159 | /** | 153 | /** |
setup/wizard/lib/validation/openofficeValidation.php
| @@ -154,7 +154,7 @@ class openofficeValidation extends serviceValidation { | @@ -154,7 +154,7 @@ class openofficeValidation extends serviceValidation { | ||
| 154 | $bin = "soffice"; | 154 | $bin = "soffice"; |
| 155 | } | 155 | } |
| 156 | foreach ($locations as $loc) { | 156 | foreach ($locations as $loc) { |
| 157 | - $pathToBinary = $loc.$bin; | 157 | + $pathToBinary = $loc.DS.$bin; |
| 158 | if(file_exists($pathToBinary)) { | 158 | if(file_exists($pathToBinary)) { |
| 159 | return $pathToBinary; | 159 | return $pathToBinary; |
| 160 | } | 160 | } |
setup/wizard/steps/configuration.php
| @@ -312,23 +312,23 @@ class configuration extends Step | @@ -312,23 +312,23 @@ class configuration extends Step | ||
| 312 | $paths = $conf['paths']; | 312 | $paths = $conf['paths']; |
| 313 | if ($this->util->isMigration()) { // Check if its an upgrade | 313 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 314 | $this->readInstallation(); | 314 | $this->readInstallation(); |
| 315 | - $configPath = $paths['configFile']['path']; | 315 | + $this->confpaths['configIni'] = $paths['configFile']['path']; |
| 316 | } else { | 316 | } else { |
| 317 | $this->readConfigPath(); // initialise writing to config.ini | 317 | $this->readConfigPath(); // initialise writing to config.ini |
| 318 | } | 318 | } |
| 319 | $this->getFromConfigPath(); // Sets config Paths | 319 | $this->getFromConfigPath(); // Sets config Paths |
| 320 | - if(file_exists($configPath)) { | ||
| 321 | - $this->util->iniUtilities->load($configPath); | 320 | + if(file_exists($this->confpaths['configIni'])) { |
| 321 | + $this->util->iniUtilities->load($this->confpaths['configIni']); | ||
| 322 | } | 322 | } |
| 323 | - $this->writeUrlSection(); | ||
| 324 | - $this->writeDBSection($server); | ||
| 325 | - $this->writeDBPathSection($paths); | ||
| 326 | - if(!$this->util->iniUtilities === false){ // write out the config.ini file | ||
| 327 | - $this->util->iniUtilities->write(); | 323 | + if(!$this->util->iniUtilities=== false){ // write out the config.ini file |
| 324 | + $this->writeUrlSection(); | ||
| 325 | + $this->writeDBSection($server); | ||
| 326 | + $this->writeDBPathSection($paths); | ||
| 327 | + $this->util->iniUtilities->write(); | ||
| 328 | } | 328 | } |
| 329 | $this->util->dbUtilities->close(); // close the database connection | 329 | $this->util->dbUtilities->close(); // close the database connection |
| 330 | - $this->writeCachePath(); // Write cache path file | ||
| 331 | - $this->writeConfigPath($configPath); // Write config file | 330 | + $this->writeCachePath($this->getCachePath(), $paths['cacheDirectory']['path']); // Write cache path file |
| 331 | + $this->writeConfigPath($this->getContentPath(), $this->confpaths['configIni']); // Write config file | ||
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | private function writeUrlSection() { | 334 | private function writeUrlSection() { |