diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index eefa6a3..f2f62a5 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -327,7 +327,8 @@ class InstallUtil { return false; } - return array('response'=>$response, 'java'=>'java'); + return 'java'; +// return array('response'=>$response, 'java'=>'java'); } function tryJava2() { @@ -336,7 +337,8 @@ class InstallUtil { return false; } - return array('response'=>$response, 'java'=>'java'); + return 'java'; +// return array('response'=>$response, 'java'=>'java'); } function tryJava3() { @@ -348,20 +350,54 @@ class InstallUtil { foreach ($broke as $r) { $match = preg_match('/bin/', $r); if($match) { - return array('response'=>$response, 'java'=>preg_replace('/java:/', '', $r)); + return preg_replace('/java:/', '', $r); +// return array('response'=>$response, 'java'=>preg_replace('/java:/', '', $r)); } } } - function getJava() { - $response = $this->tryJava1(); - if(!is_array($response)) { - $response = $this->tryJava2(); - if(!is_array($response)) { - $response = $this->tryJava3(); + /** + * Check if user entered location of JRE + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return mixed + */ + public function javaSpecified() { + if(isset($_POST['java'])) { + if($_POST['java'] != '') { + return $_POST['java']; + } else { + return false; } + } else { + return false; } - + } + + /** + * Determine the location of JAVA_HOME + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return mixed + */ + function getJava() { +// $javaSpecified = $this->javaSpecified(); +// if($javaSpecified) { +// return $javaSpecified; +// } else { + $response = $this->tryJava1(); + if(!is_array($response)) { + $response = $this->tryJava2(); + if(!is_array($response)) { + $response = $this->tryJava3(); + } + } +// } + return $response; } diff --git a/setup/wizard/installer.php b/setup/wizard/installer.php index c5cb3cb..3ebd069 100644 --- a/setup/wizard/installer.php +++ b/setup/wizard/installer.php @@ -138,7 +138,7 @@ class Installer { } catch (Exception $e) { $iutil = new InstallUtil(); $iutil->error("Error reading configuration file: $name"); - die; + exit(); } } @@ -397,7 +397,7 @@ class Installer { } else { $iutil = new InstallUtil(); $iutil->error("Class File Missing in Step Directory: $className"); - die; + exit(); } } diff --git a/setup/wizard/path.php b/setup/wizard/path.php index 0f661ea..3bb3a1f 100644 --- a/setup/wizard/path.php +++ b/setup/wizard/path.php @@ -73,6 +73,8 @@ define('RES_DIR', WIZARD_DIR."resources".DS); define('STEP_DIR', WIZARD_DIR."steps".DS); define('TEMP_DIR', WIZARD_DIR."templates".DS); + define('SHELL_DIR', WIZARD_DIR."shells".DS); + define('OUTPUT_DIR', WIZARD_DIR."output".DS); // Define paths to system webroot define('SYSTEM_DIR', $sys); define('SYS_BIN_DIR', SYSTEM_DIR."bin".DS); diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php index 2686d75..63b306a 100644 --- a/setup/wizard/steps/services.php +++ b/setup/wizard/steps/services.php @@ -66,11 +66,38 @@ class services extends Step protected $util; - private $response; + //private $response; private $javaVersion = '1.5'; /** + * Java Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $java_check = 'cross'; + + /** + * Java Bridge Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $java_ext_check = 'cross'; + + /** + * Service Installed + * + * @author KnowledgeTree Team + * @access private + * @var array + */ + private $service_check = 'tick'; + + /** * Flag to store class information in session * * @author KnowledgeTree Team @@ -104,9 +131,9 @@ class services extends Step - function getJavaResponse() { - return $this->response; - } +// function getJavaResponse() { +// return $this->response; +// } /** * Main control of services setup @@ -144,10 +171,7 @@ class services extends Step * @return boolean */ private function doRun() { - $javaSettings = $this->util->getJava(); - $this->response = $javaSettings['response']; - $this->java = $javaSettings['java']; - $this->temp_variables['service_check'] = 'tick'; + $this->java = $this->util->getJava(); if($this->javaChecks()) { $this->installService(); } else { // Services not installed @@ -155,63 +179,81 @@ class services extends Step $this->temp_variables['services'][] = array('class'=>'cross', 'msg'=>$serviceName." Could not be added as a Service"); } } + $this->temp_variables['java_check'] = $this->java_check; + $this->temp_variables['java_ext_check'] = $this->java_ext_check; + $this->temp_variables['service_check'] = $this->service_check; $errors = $this->getErrors(); if(!empty($errors)) return false; return true; } - - public function zendBridge() { - $mods = get_loaded_extensions(); - if(in_array('Zend Java Bridge', $mods)) - return true; - else - return false; - } - - public function checkZendBridge() { - if($this->util->javaBridge()) { // Check if java bridge is functional - $javaSystem = new Java('java.lang.System'); - $version = $javaSystem->getProperty('java.version'); - $ver = substr($version, 0, 3); - if($ver < $this->javaVersion) { - $this->temp_variables['version']['class'] = 'cross'; - $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; - $this->error[] = "Requires Java 1.5+ to be installed"; - } else { - $this->temp_variables['version']['class'] = 'tick'; - $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; - } - } else { - $this->warnings[] = "Zend Java Bridge Error"; - $this->temp_variables['version']['class'] = 'cross_orange'; - $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected"; - $this->temp_variables['extensions']['class'] = 'cross_orange'; - $this->temp_variables['extensions']['found'] = "Zend Java Bridge Error"; - return false; - } + + private function detSettings() { +// $cmd = $this->java." -version > output/outJV 2>&1 echo $!"; +// echo $cmd; +// die('bb'); +// $response = $this->util->pexec(SHELL_DIR."javaVersion.sh"); +// if(file_exists(OUTPUT_DIR.'outJV')) { +// $tmp = file_get_contents(OUTPUT_DIR.'outJV'); +// echo $tmp; +// preg_match('/"(.*)"/',$tmp, $matches); +// var_dump($matches); +// $fp-> +// echo 'a'; +// } +// var_dump($response); +// die('aa'); +// var_dump($this->util->pexec($this->java."")); +// var_dump($this->util->pexec($this->java." -version")); } public function javaChecks() { - $zendBridge = $this->zendBridge(); // Find Zend Bridge - $this->temp_variables['java_check'] = 'tick'; - $this->temp_variables['java_ext_check'] = 'tick'; $this->temp_variables['extensions']['class'] = 'cross'; $this->temp_variables['extensions']['found'] = "Zend Java Bridge Required"; $this->temp_variables['version']['class'] = 'cross'; $this->temp_variables['version']['found'] = "Java Runtime Version Incorrect"; $this->temp_variables['java']['class'] = 'cross'; $this->temp_variables['java']['found'] = "Java runtime environment required"; + if($this->util->javaSpecified()) { + $this->detSettings(); + } else { + $this->useBridge(); + } + + } + + function useBridge() { + $zendBridge = $this->zendBridge(); // Find Zend Bridge if($zendBridge) { $this->temp_variables['extensions']['class'] = 'tick'; $this->temp_variables['extensions']['found'] = "Java Bridge Installed"; - $this->checkZendBridge(); // Make sure the Zend Bridge is functional + if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional + $javaSystem = new Java('java.lang.System'); + $version = $javaSystem->getProperty('java.version'); + $ver = substr($version, 0, 3); + if($ver < $this->javaVersion) { + $this->temp_variables['version']['class'] = 'cross'; + $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; + $this->error[] = "Requires Java 1.5+ to be installed"; + } else { + $this->temp_variables['version']['class'] = 'tick'; + $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; + } + } else { + $this->warnings[] = "Zend Java Bridge Error"; + $this->temp_variables['version']['class'] = 'cross_orange'; + $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected"; + $this->temp_variables['extensions']['class'] = 'cross_orange'; + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Error"; + $this->java_ext_check = 'cross_orange'; + } } else { $this->warnings[] = "Zend Java Bridge Required"; } if($this->java != '') { // Find Java JRE $this->temp_variables['java']['class'] = 'tick'; $this->temp_variables['java']['found'] = "Java Runtime Installed"; + $this->java_check = 'tick'; } else { $this->error[] = "Java runtime environment required"; } @@ -220,6 +262,39 @@ class services extends Step } /** + * Check if Zend Bridge is enabled + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return boolean + */ + public function zendBridge() { + $mods = get_loaded_extensions(); + if(in_array('Zend Java Bridge', $mods)) + return true; + else + return false; + } + + /** + * Check if Zend Bridge is functional + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return boolean + */ + public function checkZendBridge() { + if($this->util->javaBridge()) { // Check if java bridge is functional + return true; + } else { + return false; + } + } + + + /** * Installs services * * @author KnowledgeTree Team @@ -236,7 +311,6 @@ class services extends Step $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); } else { $this->temp_variables['services'][] = array('class'=>'cross', 'msg'=>$service->getName()." Could not be added as a Service"); - $this->temp_variables['service_check'] = 'cross'; } } @@ -328,7 +402,7 @@ class services extends Step } /** - * Returns service errors + * Returns services errors * * @author KnowledgeTree Team * @access public @@ -339,6 +413,18 @@ class services extends Step return $this->error; } + /** + * Returns services warnings + * + * @author KnowledgeTree Team + * @access public + * @params none + * @return array + */ + public function getWarnings() { + return $this->warnings; + } + /** * Get the variables to be passed to the template * diff --git a/setup/wizard/templates/services.tpl b/setup/wizard/templates/services.tpl index e80d326..0828374 100644 --- a/setup/wizard/templates/services.tpl +++ b/setup/wizard/templates/services.tpl @@ -1,3 +1,4 @@ +

Services Dependencies Check

@@ -11,7 +12,7 @@ if($errors || $warnings){ } ?> -

     "; ?>Java Version Check

+

     "; ?>Java Check

Show Details
@@ -58,9 +65,10 @@ if($step_vars){ - +
+
\ No newline at end of file