Commit ede85e5cf9551fe213c0e0e2b72474a795cc2d88

Authored by jarrett
1 parent f987f016

Story Id: 964068 Code Merge For Linux

Committed by: Jarrett Jordaan

Reviewed by: Paul Barrett
Showing 1 changed file with 186 additions and 75 deletions
setup/wizard/steps/services.php
@@ -64,6 +64,8 @@ class services extends Step @@ -64,6 +64,8 @@ class services extends Step
64 64
65 protected $java; 65 protected $java;
66 66
  67 + protected $php;
  68 +
67 protected $util; 69 protected $util;
68 70
69 private $javaVersion = '1.5'; 71 private $javaVersion = '1.5';
@@ -75,7 +77,7 @@ class services extends Step @@ -75,7 +77,7 @@ class services extends Step
75 * @access private 77 * @access private
76 * @var mixed 78 * @var mixed
77 */ 79 */
78 - private $java_check = 'cross'; 80 + private $javaCheck = 'cross';
79 81
80 /** 82 /**
81 * Java Bridge Installed 83 * Java Bridge Installed
@@ -84,7 +86,7 @@ class services extends Step @@ -84,7 +86,7 @@ class services extends Step
84 * @access private 86 * @access private
85 * @var mixed 87 * @var mixed
86 */ 88 */
87 - private $java_ext_check = 'cross_orange'; 89 + private $javaExtCheck = 'cross_orange';
88 90
89 /** 91 /**
90 * Service Installed 92 * Service Installed
@@ -93,7 +95,7 @@ class services extends Step @@ -93,7 +95,7 @@ class services extends Step
93 * @access private 95 * @access private
94 * @var array 96 * @var array
95 */ 97 */
96 - private $service_check = 'tick'; 98 + private $serviceCheck = 'tick';
97 99
98 /** 100 /**
99 * Flag to store class information in session 101 * Flag to store class information in session
@@ -104,6 +106,13 @@ class services extends Step @@ -104,6 +106,13 @@ class services extends Step
104 */ 106 */
105 protected $storeInSession = false; 107 protected $storeInSession = false;
106 108
  109 + /**
  110 + * List of variables to be loaded to template
  111 + *
  112 + * @author KnowledgeTree Team
  113 + * @access public
  114 + * @var array
  115 + */
107 protected $temp_variables; 116 protected $temp_variables;
108 117
109 /** 118 /**
@@ -116,6 +125,24 @@ class services extends Step @@ -116,6 +125,24 @@ class services extends Step
116 protected $silent = true; 125 protected $silent = true;
117 126
118 /** 127 /**
  128 + * Flag if bridge extension needs to be disabled
  129 + *
  130 + * @author KnowledgeTree Team
  131 + * @access public
  132 + * @var boolean
  133 + */
  134 + private $disableExtension = false;
  135 +
  136 + /**
  137 + * Holds path error, if java is specified
  138 + *
  139 + * @author KnowledgeTree Team
  140 + * @access public
  141 + * @var mixed
  142 + */
  143 + private $javaExeError = false;
  144 +
  145 + /**
119 * Constructs services object 146 * Constructs services object
120 * 147 *
121 * @author KnowledgeTree Team 148 * @author KnowledgeTree Team
@@ -154,13 +181,33 @@ class services extends Step @@ -154,13 +181,33 @@ class services extends Step
154 return 'landing'; 181 return 'landing';
155 } 182 }
156 183
157 - /*  
158 - Get service names  
159 - */ 184 + /**
  185 + * Get service names
  186 + *
  187 + * @author KnowledgeTree Team
  188 + * @param none
  189 + * @access public
  190 + * @return array
  191 + */
160 public function getServices() { 192 public function getServices() {
161 return $this->services; 193 return $this->services;
162 } 194 }
163 195
  196 + /**
  197 + * Check if java executable was found
  198 + *
  199 + * @author KnowledgeTree Team
  200 + * @param none
  201 + * @access private
  202 + * @return array
  203 + */
  204 + private function setJava() {
  205 + if($this->java != '') { // Java JRE Found
  206 + $this->javaCheck = 'tick';
  207 + $this->javaInstalled();
  208 + }
  209 + }
  210 +
164 /** 211 /**
165 * Run step 212 * Run step
166 * 213 *
@@ -179,7 +226,7 @@ class services extends Step @@ -179,7 +226,7 @@ class services extends Step
179 foreach ($this->getServices() as $serviceName) { 226 foreach ($this->getServices() as $serviceName) {
180 $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$serviceName." Could not be added as a Service"); 227 $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$serviceName." Could not be added as a Service");
181 } 228 }
182 - $this->service_check = 'cross_orange'; 229 + $this->serviceCheck = 'cross_orange';
183 } 230 }
184 $this->storeSilent(); // Store info needed for silent mode 231 $this->storeSilent(); // Store info needed for silent mode
185 if(!empty($errors)) 232 if(!empty($errors))
@@ -187,21 +234,35 @@ class services extends Step @@ -187,21 +234,35 @@ class services extends Step
187 return true; 234 return true;
188 } 235 }
189 236
190 - public function javaChecks() { 237 + /**
  238 + * Do some basic checks to help the user overcome java problems
  239 + *
  240 + * @author KnowledgeTree Team
  241 + * @param none
  242 + * @access private
  243 + * @return boolean
  244 + */
  245 + private function javaChecks() {
191 $this->zendBridgeNotInstalled(); // Set bridge not installed 246 $this->zendBridgeNotInstalled(); // Set bridge not installed
192 $this->javaVersionInCorrect(); // Set version to incorrect 247 $this->javaVersionInCorrect(); // Set version to incorrect
193 $this->javaNotInstalled(); // Set java to not installed 248 $this->javaNotInstalled(); // Set java to not installed
  249 + $this->setJava(); // Check if java has been auto detected
194 if($this->util->javaSpecified()) { 250 if($this->util->javaSpecified()) {
195 - $this->detSettings(); // AutoDetect java settings 251 + $this->disableExtension = true; // Disable the use of the php bridge extension
  252 + return $this->detSettings(); // AutoDetect java settings
196 } else { 253 } else {
197 - $this->useBridge(); // Use Bridge to get java settings 254 + return $this->useBridge(); // Use Bridge to get java settings
198 } 255 }
199 -  
200 } 256 }
201 257
202 - /*  
203 - Attempts to use user input and configure java settings  
204 - */ 258 + /**
  259 + * Attempts to use user input and configure java settings
  260 + *
  261 + * @author KnowledgeTree Team
  262 + * @param none
  263 + * @access private
  264 + * @return boolean
  265 + */
205 private function detSettings() { 266 private function detSettings() {
206 $javaExecutable = $this->util->javaSpecified();// Retrieve java bin 267 $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
207 $cmd = "$javaExecutable -version > output/outJV 2>&1 echo $!"; 268 $cmd = "$javaExecutable -version > output/outJV 2>&1 echo $!";
@@ -209,28 +270,42 @@ class services extends Step @@ -209,28 +270,42 @@ class services extends Step
209 if(file_exists(OUTPUT_DIR.'outJV')) { 270 if(file_exists(OUTPUT_DIR.'outJV')) {
210 $tmp = file_get_contents(OUTPUT_DIR.'outJV'); 271 $tmp = file_get_contents(OUTPUT_DIR.'outJV');
211 preg_match('/"(.*)"/',$tmp, $matches); 272 preg_match('/"(.*)"/',$tmp, $matches);
212 - if($matches[1] < $this->javaVersion) { // Check Version of java  
213 - $this->javaVersionInCorrect(); 273 + if($matches) {
  274 + if($matches[1] < $this->javaVersion) { // Check Version of java
  275 + $this->javaVersionInCorrect();
  276 + $this->javaCheck = 'cross';
  277 + $this->error[] = "Requires Java 1.5+ to be installed";
  278 + return false;
  279 + } else {
  280 + $this->javaVersionCorrect();
  281 + $this->javaInstalled();
  282 + $this->javaCheck = 'tick';
  283 + return true;
  284 + }
  285 + } else {
  286 + $this->javaVersionWarning();
  287 + $this->javaCheck = 'cross_orange';
  288 + $this->javaExeError = "Incorrect path specified";
214 $this->error[] = "Requires Java 1.5+ to be installed"; 289 $this->error[] = "Requires Java 1.5+ to be installed";
215 return false; 290 return false;
216 - } else {  
217 - $this->javaVersionCorrect();  
218 - $this->javaInstalled();  
219 - $this->java_check = 'tick';  
220 - return true;  
221 } 291 }
222 } 292 }
223 } 293 }
224 294
225 - /*  
226 - Attempts to use bridge and configure java settings  
227 - */ 295 + /**
  296 + * Attempts to use bridge and configure java settings
  297 + *
  298 + * @author KnowledgeTree Team
  299 + * @param none
  300 + * @access private
  301 + * @return boolean
  302 + */
228 private function useBridge() { 303 private function useBridge() {
229 $zendBridge = $this->zendBridge(); // Find Zend Bridge 304 $zendBridge = $this->zendBridge(); // Find Zend Bridge
230 if($zendBridge) { // Bridge installed implies java exists 305 if($zendBridge) { // Bridge installed implies java exists
231 $this->zendBridgeInstalled(); 306 $this->zendBridgeInstalled();
232 if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional 307 if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional
233 - $this->java_ext_check = 'tick'; // Set bridge to functional 308 + $this->javaExtCheck = 'tick'; // Set bridge to functional
234 $this->javaInstalled(); // Set java to installed 309 $this->javaInstalled(); // Set java to installed
235 $javaSystem = new Java('java.lang.System'); 310 $javaSystem = new Java('java.lang.System');
236 $version = $javaSystem->getProperty('java.version'); 311 $version = $javaSystem->getProperty('java.version');
@@ -241,14 +316,14 @@ class services extends Step @@ -241,14 +316,14 @@ class services extends Step
241 return false; 316 return false;
242 } else { 317 } else {
243 $this->javaVersionCorrect(); // Set version to correct 318 $this->javaVersionCorrect(); // Set version to correct
244 - $this->java_check = 'tick'; 319 + $this->javaCheck = 'tick';
245 return true; 320 return true;
246 } 321 }
247 } else { 322 } else {
248 $this->javaVersionWarning(); 323 $this->javaVersionWarning();
249 $this->zendBridgeWarning(); 324 $this->zendBridgeWarning();
250 $this->warnings[] = "Zend Java Bridge Not Functional"; 325 $this->warnings[] = "Zend Java Bridge Not Functional";
251 - $this->java_ext_check = 'cross_orange'; 326 + $this->javaExtCheck = 'cross_orange';
252 return false; 327 return false;
253 } 328 }
254 } else { 329 } else {
@@ -307,7 +382,7 @@ class services extends Step @@ -307,7 +382,7 @@ class services extends Step
307 $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); 382 $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service");
308 } else { 383 } else {
309 $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service"); 384 $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service");
310 - $this->service_check = 'cross_orange'; 385 + $this->serviceCheck = 'cross_orange';
311 } 386 }
312 } 387 }
313 388
@@ -422,99 +497,135 @@ class services extends Step @@ -422,99 +497,135 @@ class services extends Step
422 return $this->warnings; 497 return $this->warnings;
423 } 498 }
424 499
425 - /**  
426 - * Get the variables to be passed to the template  
427 - *  
428 - * @author KnowledgeTree Team  
429 - * @access public  
430 - * @return array  
431 - */ 500 + /**
  501 + * Get the variables to be passed to the template
  502 + *
  503 + * @author KnowledgeTree Team
  504 + * @access public
  505 + * @return array
  506 + */
432 public function getStepVars() 507 public function getStepVars()
433 { 508 {
434 return $this->temp_variables; 509 return $this->temp_variables;
435 } 510 }
436 511
437 - /* Helpers */  
438 - /**  
439 - * Store Java state as installed  
440 - *  
441 - */ 512 + /**
  513 + * Store Java state as installed
  514 + *
  515 + * @author KnowledgeTree Team
  516 + * @param none
  517 + * @access private
  518 + * @return void
  519 + */
442 private function javaInstalled() { 520 private function javaInstalled() {
443 $this->temp_variables['java']['class'] = 'tick'; 521 $this->temp_variables['java']['class'] = 'tick';
444 $this->temp_variables['java']['found'] = "Java Runtime Installed"; 522 $this->temp_variables['java']['found'] = "Java Runtime Installed";
445 } 523 }
446 524
447 - /**  
448 - * Store Java state as not installed  
449 - *  
450 - */ 525 + /**
  526 + * Store Java state as not installed
  527 + *
  528 + * @author KnowledgeTree Team
  529 + * @param none
  530 + * @access private
  531 + * @return void
  532 + */
451 private function javaNotInstalled() { 533 private function javaNotInstalled() {
452 $this->temp_variables['java']['class'] = 'cross'; 534 $this->temp_variables['java']['class'] = 'cross';
453 $this->temp_variables['java']['found'] = "Java runtime environment required"; 535 $this->temp_variables['java']['found'] = "Java runtime environment required";
454 } 536 }
455 537
456 - /**  
457 - * Store Java version state as correct  
458 - *  
459 - */ 538 + /**
  539 + * Store Java version state as correct
  540 + *
  541 + * @author KnowledgeTree Team
  542 + * @param none
  543 + * @access private
  544 + * @return void
  545 + */
460 private function javaVersionCorrect() { 546 private function javaVersionCorrect() {
461 $this->temp_variables['version']['class'] = 'tick'; 547 $this->temp_variables['version']['class'] = 'tick';
462 $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; 548 $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed";
463 } 549 }
464 550
465 - /**  
466 - * Store Java version state as warning  
467 - *  
468 - */ 551 + /**
  552 + * Store Java version state as warning
  553 + * @author KnowledgeTree Team
  554 + * @param none
  555 + * @access private
  556 + * @return void
  557 + */
469 private function javaVersionWarning() { 558 private function javaVersionWarning() {
470 $this->temp_variables['version']['class'] = 'cross_orange'; 559 $this->temp_variables['version']['class'] = 'cross_orange';
471 $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected"; 560 $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected";
472 } 561 }
473 562
474 - /**  
475 - * Store Java version as state incorrect  
476 - *  
477 - */ 563 + /**
  564 + * Store Java version as state incorrect
  565 + *
  566 + * @author KnowledgeTree Team
  567 + * @param none
  568 + * @access private
  569 + * @return void
  570 + */
478 private function javaVersionInCorrect() { 571 private function javaVersionInCorrect() {
479 $this->temp_variables['version']['class'] = 'cross'; 572 $this->temp_variables['version']['class'] = 'cross';
480 $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; 573 $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed";
481 } 574 }
482 575
483 - /**  
484 - * Store Zend Bridge state as installed  
485 - *  
486 - */ 576 + /**
  577 + * Store Zend Bridge state as installed
  578 + *
  579 + * @author KnowledgeTree Team
  580 + * @param none
  581 + * @access private
  582 + * @return void
  583 + */
487 private function zendBridgeInstalled() { 584 private function zendBridgeInstalled() {
488 $this->temp_variables['extensions']['class'] = 'tick'; 585 $this->temp_variables['extensions']['class'] = 'tick';
489 $this->temp_variables['extensions']['found'] = "Java Bridge Installed"; 586 $this->temp_variables['extensions']['found'] = "Java Bridge Installed";
490 } 587 }
491 588
492 - /**  
493 - * Store Zend Bridge state as not installed  
494 - *  
495 - */ 589 + /**
  590 + * Store Zend Bridge state as not installed
  591 + *
  592 + * @author KnowledgeTree Team
  593 + * @param none
  594 + * @access private
  595 + * @return void
  596 + */
496 private function zendBridgeNotInstalled() { 597 private function zendBridgeNotInstalled() {
497 $this->temp_variables['extensions']['class'] = 'cross_orange'; 598 $this->temp_variables['extensions']['class'] = 'cross_orange';
498 $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed"; 599 $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed";
499 } 600 }
500 601
501 - /**  
502 - * Store Zend Bridge state as warning  
503 - *  
504 - */ 602 + /**
  603 + * Store Zend Bridge state as warning
  604 + *
  605 + * @author KnowledgeTree Team
  606 + * @param none
  607 + * @access private
  608 + * @return void
  609 + */
505 private function zendBridgeWarning() { 610 private function zendBridgeWarning() {
506 $this->temp_variables['extensions']['class'] = 'cross_orange'; 611 $this->temp_variables['extensions']['class'] = 'cross_orange';
507 $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional"; 612 $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional";
508 } 613 }
509 614
510 - /**  
511 - * Set all silent mode varibles  
512 - *  
513 - */ 615 + /**
  616 + * Set all silent mode varibles
  617 + *
  618 + * @author KnowledgeTree Team
  619 + * @param none
  620 + * @access private
  621 + * @return void
  622 + */
514 private function storeSilent() { 623 private function storeSilent() {
515 - $this->temp_variables['java_check'] = $this->java_check;  
516 - $this->temp_variables['java_ext_check'] = $this->java_ext_check;  
517 - $this->temp_variables['service_check'] = $this->service_check; 624 + $this->temp_variables['javaExeError'] = $this->javaExeError;
  625 + $this->temp_variables['javaCheck'] = $this->javaCheck;
  626 + $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
  627 + $this->temp_variables['serviceCheck'] = $this->serviceCheck;
  628 + $this->temp_variables['disableExtension'] = $this->disableExtension;
518 } 629 }
519 } 630 }
520 ?> 631 ?>
521 \ No newline at end of file 632 \ No newline at end of file