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 | 122 | $manual = false; // If file was exported manually |
| 123 | 123 | $dbSettings = $installation['dbSettings']; |
| 124 | 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 | 127 | $port = $this->util->getPort($location); |
| 128 | 128 | $tmpFolder = $this->resolveTempDir(); |
| 129 | 129 | if(WINDOWS_OS) { |
| 130 | 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 | 132 | } else { |
| 133 | 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 | 136 | $date = date('Y-m-d-H-i-s'); |
| 137 | 137 | if(isset($database['manual_export'])) { |
| ... | ... | @@ -147,7 +147,7 @@ class migrateDatabase extends Step |
| 147 | 147 | if(!$manual) { // Try to export database |
| 148 | 148 | $sqlFile = $tmpFolder."/kt-backup-$date.sql"; |
| 149 | 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 | 152 | if(file_exists($sqlFile)) { |
| 153 | 153 | $fileContents = file_get_contents($sqlFile); | ... | ... |
setup/migrate/steps/migrateInstallation.php
| ... | ... | @@ -85,10 +85,6 @@ class migrateInstallation extends step |
| 85 | 85 | private $ktSettings = array(); |
| 86 | 86 | |
| 87 | 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 | 90 | * Installation Settings |
| ... | ... | @@ -132,12 +128,14 @@ class migrateInstallation extends step |
| 132 | 128 | |
| 133 | 129 | public function detectInstallation() { |
| 134 | 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 | 133 | if(file_exists($configPath)) |
| 137 | 134 | $this->location = $loc; |
| 138 | 135 | } |
| 139 | 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 | 139 | if(file_exists($configPath)) |
| 142 | 140 | $this->location = $loc; |
| 143 | 141 | } |
| ... | ... | @@ -162,9 +160,10 @@ class migrateInstallation extends step |
| 162 | 160 | if($this->foundVersion < $this->supportedVersion) { |
| 163 | 161 | $this->versionError = true; |
| 164 | 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 | 169 | public function readVersion() { |
| ... | ... | @@ -222,6 +221,8 @@ class migrateInstallation extends step |
| 222 | 221 | } else { |
| 223 | 222 | $this->error[] = "Please Enter a Location"; |
| 224 | 223 | } |
| 224 | + | |
| 225 | + return false; | |
| 225 | 226 | } |
| 226 | 227 | |
| 227 | 228 | private function loadConfig($path) { |
| ... | ... | @@ -246,7 +247,7 @@ class migrateInstallation extends step |
| 246 | 247 | $this->ktSettings = array('fileSystemRoot'=> $froot, |
| 247 | 248 | ); |
| 248 | 249 | // $urlPaths = $ini->getSection('urls'); |
| 249 | - $urlPaths = $this->util->iniUtilities->getSection('urls'); | |
| 250 | +// $urlPaths = $this->util->iniUtilities->getSection('urls'); | |
| 250 | 251 | $varDir = $froot.DS.'var'; |
| 251 | 252 | $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), |
| 252 | 253 | array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), | ... | ... |
setup/migrate/steps/migrateServices.php
| ... | ... | @@ -201,11 +201,11 @@ class migrateServices extends Step |
| 201 | 201 | */ |
| 202 | 202 | public function unixStop() { |
| 203 | 203 | $cmd = $this->conf['location']."/dmsctl.sh stop lucene"; |
| 204 | - $res = $this->util->pexec($cmd); | |
| 204 | + $this->util->pexec($cmd); | |
| 205 | 205 | $cmd = $this->conf['location']."/dmsctl.sh stop scheduler"; |
| 206 | - $res = $this->util->pexec($cmd); | |
| 206 | + $this->util->pexec($cmd); | |
| 207 | 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 | 214 | */ |
| 215 | 215 | public function windowsStop() { |
| 216 | 216 | $cmd = "sc delete KTLucene"; |
| 217 | - $res = $this->util->pexec($cmd); | |
| 217 | + $this->util->pexec($cmd); | |
| 218 | 218 | $cmd = "sc delete KTScheduler"; |
| 219 | - $res = $this->util->pexec($cmd); | |
| 219 | + $this->util->pexec($cmd); | |
| 220 | 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 | 232 | $serv->load(); |
| 233 | 233 | $sStatus = $serv->status(); |
| 234 | 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 | 105 | } |
| 106 | 106 | |
| 107 | 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 | 117 | public function isConnected($dhost = 'localhost', $duname, $dpassword, $dbname) { |
| ... | ... | @@ -235,6 +233,9 @@ class dbUtilities { |
| 235 | 233 | * @return array. |
| 236 | 234 | */ |
| 237 | 235 | public function getErrors() { |
| 236 | + if(!$this->dbconnection) { | |
| 237 | + $this->error[] = @mysql_error(); | |
| 238 | + } | |
| 238 | 239 | return $this->error; |
| 239 | 240 | } |
| 240 | 241 | ... | ... |
setup/wizard/iniUtilities.php
| ... | ... | @@ -67,23 +67,23 @@ class iniUtilities { |
| 67 | 67 | function backupIni($iniFile) |
| 68 | 68 | { |
| 69 | 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 | 82 | function read($iniFile) { |
| 83 | 83 | $iniArray = file($iniFile); |
| 84 | 84 | $section = ''; |
| 85 | 85 | foreach($iniArray as $iniLine) { |
| 86 | - $this->lineNum++; | |
| 86 | + ++$this->lineNum; | |
| 87 | 87 | $iniLine = trim($iniLine); |
| 88 | 88 | $firstChar = substr($iniLine, 0, 1); |
| 89 | 89 | if($firstChar == ';') { |
| ... | ... | @@ -163,12 +163,12 @@ class iniUtilities { |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | function itemExists($checkSection, $checkItem) { |
| 166 | - | |
| 167 | 166 | $this->exists = ''; |
| 168 | 167 | foreach($this->cleanArray as $section => $items) { |
| 169 | 168 | if($section == $checkSection) { |
| 170 | 169 | $this->exists = 'section'; |
| 171 | - foreach ($items as $key => $value) { | |
| 170 | + $items = array_flip($items); | |
| 171 | + foreach ($items as $key) { | |
| 172 | 172 | if($key == $checkItem) { |
| 173 | 173 | return true; |
| 174 | 174 | } | ... | ... |
setup/wizard/installUtil.php
| ... | ... | @@ -39,12 +39,11 @@ |
| 39 | 39 | * @package Installer |
| 40 | 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 | 46 | class InstallUtil { |
| 47 | - | |
| 48 | 47 | private $salt = 'installers'; |
| 49 | 48 | public $dbUtilities = null; |
| 50 | 49 | public $iniUtilities = null; |
| ... | ... | @@ -78,15 +77,17 @@ class InstallUtil { |
| 78 | 77 | public function error($error) { |
| 79 | 78 | $template_vars['error'] = $error; |
| 80 | 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 | 93 | * Check if system needs to be installed |
| ... | ... | @@ -173,7 +174,7 @@ class InstallUtil { |
| 173 | 174 | return $url; |
| 174 | 175 | } |
| 175 | 176 | if (!empty($protocol)) { |
| 176 | - $url = $protocol .':'. end($array = explode(':', $url, 2)); | |
| 177 | + $url = $protocol .':'. end(explode(':', $url, 2)); | |
| 177 | 178 | } |
| 178 | 179 | if (!empty($port)) { |
| 179 | 180 | $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', |
| ... | ... | @@ -333,9 +334,11 @@ class InstallUtil { |
| 333 | 334 | return false; |
| 334 | 335 | elseif(!is_dir($fullpath)) { |
| 335 | 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 | 339 | return false; |
| 340 | + } | |
| 341 | + } | |
| 339 | 342 | } elseif(!$this->chmodRecursive($fullpath, $filemode)) |
| 340 | 343 | return false; |
| 341 | 344 | } |
| ... | ... | @@ -362,7 +365,8 @@ class InstallUtil { |
| 362 | 365 | */ |
| 363 | 366 | public function canWriteFile($filename) { |
| 364 | 367 | $fh = fopen($filename, "w+"); |
| 365 | - if($fr = fwrite($fh, 'test') === false) { | |
| 368 | + $fr = fwrite($fh, 'test'); | |
| 369 | + if($fr === false) { | |
| 366 | 370 | return false; |
| 367 | 371 | } |
| 368 | 372 | |
| ... | ... | @@ -380,9 +384,9 @@ class InstallUtil { |
| 380 | 384 | */ |
| 381 | 385 | public function javaBridge() { |
| 382 | 386 | try { |
| 383 | - $javaSystem = new Java('java.lang.System'); | |
| 387 | + new Java('java.lang.System'); | |
| 384 | 388 | } catch (JavaException $e) { |
| 385 | - return false; | |
| 389 | + return $e; | |
| 386 | 390 | } |
| 387 | 391 | return true; |
| 388 | 392 | } |
| ... | ... | @@ -457,6 +461,8 @@ class InstallUtil { |
| 457 | 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 | 740 | * @return string |
| 735 | 741 | */ |
| 736 | 742 | public function installEnvironment() { |
| 743 | + $matches = false; | |
| 737 | 744 | preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type |
| 738 | 745 | if($matches) { |
| 739 | 746 | return 'Zend'; |
| ... | ... | @@ -761,7 +768,7 @@ class InstallUtil { |
| 761 | 768 | array_pop($sysdir); |
| 762 | 769 | array_pop($sysdir); |
| 763 | 770 | $zendsys = ''; |
| 764 | - foreach ($sysdir as $k=>$v) { | |
| 771 | + foreach ($sysdir as $v) { | |
| 765 | 772 | $zendsys .= $v.DS; |
| 766 | 773 | } |
| 767 | 774 | $bin = $zendsys."ZendServer".DS."bin".DS; |
| ... | ... | @@ -786,15 +793,16 @@ class InstallUtil { |
| 786 | 793 | if(WINDOWS_OS) { // Mysql bin [Windows] |
| 787 | 794 | $serverPaths = explode(';',$_SERVER['PATH']); |
| 788 | 795 | foreach ($serverPaths as $apath) { |
| 796 | + $matches = false; | |
| 789 | 797 | preg_match('/mysql/i', $apath, $matches); |
| 790 | 798 | if($matches) { |
| 791 | 799 | return $apath.DS; |
| 792 | 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 | 808 | public function sqlInstallDir() { | ... | ... |
setup/wizard/installWizard.php
| ... | ... | @@ -63,8 +63,8 @@ function __autoload($class) { // Attempt and autoload classes |
| 63 | 63 | if(preg_match('/Helper/', $class)) { |
| 64 | 64 | require_once(HELPER_DIR."$class.php"); |
| 65 | 65 | } |
| 66 | - return null; | |
| 67 | 66 | } |
| 67 | + return false; | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | class InstallWizard { |
| ... | ... | @@ -263,8 +263,6 @@ class InstallWizard { |
| 263 | 263 | return true; |
| 264 | 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 | 157 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); |
| 158 | 158 | } catch (Exception $e) { |
| 159 | 159 | $util = new InstallUtil(); |
| 160 | - $util->error("Error reading configuration file: $name"); | |
| 160 | + $util->error("Error reading configuration file: $e"); | |
| 161 | 161 | exit(); |
| 162 | 162 | } |
| 163 | 163 | } |
| ... | ... | @@ -431,8 +431,7 @@ class Installer { |
| 431 | 431 | if($class->runInstall()) { // Check if step needs to be installed |
| 432 | 432 | $class->setDataFromSession($className); // Set Session Information |
| 433 | 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 | 436 | } else { |
| 438 | 437 | $util = new InstallUtil(); | ... | ... |
setup/wizard/lib/helpers/htmlHelper.php
setup/wizard/lib/services/unixLucene.php
| ... | ... | @@ -59,7 +59,7 @@ class unixLucene extends unixService { |
| 59 | 59 | * @param string |
| 60 | 60 | * @return void |
| 61 | 61 | */ |
| 62 | - public function load($options = null) { | |
| 62 | + public function load() { | |
| 63 | 63 | $this->setLuceneSource("ktlucene.jar"); |
| 64 | 64 | $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS); |
| 65 | 65 | $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS); |
| ... | ... | @@ -148,14 +148,13 @@ class unixLucene extends unixService { |
| 148 | 148 | * @return array |
| 149 | 149 | */ |
| 150 | 150 | public function stop() { |
| 151 | - // TODO: Breaks things | |
| 152 | 151 | $state = $this->status(); |
| 153 | 152 | if($state != '') { |
| 154 | 153 | $cmd = "pkill -f ".$this->getLuceneSource(); |
| 155 | 154 | $response = $this->util->pexec($cmd); |
| 156 | 155 | return $response; |
| 157 | 156 | } |
| 158 | - | |
| 157 | + return $state; | |
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | public function install() { |
| ... | ... | @@ -173,6 +172,7 @@ class unixLucene extends unixService { |
| 173 | 172 | if(is_array($response['out'])) { |
| 174 | 173 | if(count($response['out']) > 1) { |
| 175 | 174 | foreach ($response['out'] as $r) { |
| 175 | + $matches = false; | |
| 176 | 176 | preg_match('/grep/', $r, $matches); // Ignore grep |
| 177 | 177 | if(!$matches) { |
| 178 | 178 | return 'STARTED'; |
| ... | ... | @@ -207,20 +207,14 @@ class unixLucene extends unixService { |
| 207 | 207 | $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!"; |
| 208 | 208 | if(DEBUG) { |
| 209 | 209 | echo "Command : $cmd<br/>"; |
| 210 | - return ; | |
| 210 | + return false; | |
| 211 | 211 | } |
| 212 | 212 | $response = $this->util->pexec($cmd); |
| 213 | 213 | |
| 214 | 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 | 220 | public function getName() { | ... | ... |
setup/wizard/lib/services/unixOpenOffice.php
| ... | ... | @@ -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 | 110 | sleep(1); |
| 111 | 111 | $cmd = "ps ax | grep soffice"; |
| 112 | 112 | $response = $this->util->pexec($cmd); |
| 113 | 113 | if(is_array($response['out'])) { |
| 114 | 114 | if(count($response['out']) > 1) { |
| 115 | 115 | foreach ($response['out'] as $r) { |
| 116 | + $matches = false; | |
| 116 | 117 | preg_match('/grep/', $r, $matches); // Ignore grep |
| 117 | 118 | if(!$matches) { |
| 118 | 119 | return 'STARTED'; |
| ... | ... | @@ -140,20 +141,13 @@ class unixOpenOffice extends unixService { |
| 140 | 141 | $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -"accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!"; |
| 141 | 142 | if(DEBUG) { |
| 142 | 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 | 154 | $bin = "soffice"; |
| 155 | 155 | } |
| 156 | 156 | foreach ($locations as $loc) { |
| 157 | - $pathToBinary = $loc.$bin; | |
| 157 | + $pathToBinary = $loc.DS.$bin; | |
| 158 | 158 | if(file_exists($pathToBinary)) { |
| 159 | 159 | return $pathToBinary; |
| 160 | 160 | } | ... | ... |
setup/wizard/steps/configuration.php
| ... | ... | @@ -312,23 +312,23 @@ class configuration extends Step |
| 312 | 312 | $paths = $conf['paths']; |
| 313 | 313 | if ($this->util->isMigration()) { // Check if its an upgrade |
| 314 | 314 | $this->readInstallation(); |
| 315 | - $configPath = $paths['configFile']['path']; | |
| 315 | + $this->confpaths['configIni'] = $paths['configFile']['path']; | |
| 316 | 316 | } else { |
| 317 | 317 | $this->readConfigPath(); // initialise writing to config.ini |
| 318 | 318 | } |
| 319 | 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 | 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 | 334 | private function writeUrlSection() { | ... | ... |