Commit 432cca1a143c72a969cd9368ce324a4e790ad346

Authored by Jarrett Jordaan
1 parent 0b6dcbd8

External Binary Settings updated after installation

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
setup/wizard/lib/validation/luceneValidation.php
@@ -262,28 +262,33 @@ class luceneValidation extends serviceValidation { @@ -262,28 +262,33 @@ class luceneValidation extends serviceValidation {
262 * @return boolean 262 * @return boolean
263 */ 263 */
264 public function binaryChecks() { 264 public function binaryChecks() {
265 - if($this->util->javaSpecified()) {  
266 - $this->disableExtension = true; // Disable the use of the php bridge extension  
267 - if($this->detSettings(true)) { // AutoDetect java settings  
268 - return true;  
269 - } else {  
270 - $this->specifyJava(); // Ask for settings  
271 - }  
272 - } else {  
273 - $auto = $this->useBridge(); // Use Bridge to get java settings  
274 - if($auto) { 265 + $java = $this->useZendJava();
  266 + if(!$java) {
  267 + if($this->util->javaSpecified()) {
  268 + $this->disableExtension = true; // Disable the use of the php bridge extension
  269 + if($this->detSettings(true)) { // AutoDetect java settings
  270 + return true;
  271 + } else {
  272 + $this->specifyJava(); // Ask for settings
  273 + }
  274 + } else {
  275 + $auto = $this->useBridge(); // Use Bridge to get java settings
  276 + if($auto) {
  277 + return $auto;
  278 + } else {
  279 + $auto = $this->detSettings(); // Check if auto detected java works
  280 + if($auto) {
  281 + $this->disableExtension = true; // Disable the use of the php bridge extension
  282 + return $auto;
  283 + } else {
  284 + $this->specifyJava(); // Ask for settings
  285 + }
  286 + }
275 return $auto; 287 return $auto;
276 - } else {  
277 - $auto = $this->detSettings(); // Check if auto detected java works  
278 - if($auto) {  
279 - $this->disableExtension = true; // Disable the use of the php bridge extension  
280 - return $auto;  
281 - } else {  
282 - $this->specifyJava(); // Ask for settings  
283 - }  
284 - }  
285 - return $auto; 288 + }
286 } 289 }
  290 +
  291 + return $java;
287 } 292 }
288 293
289 /** 294 /**
@@ -368,6 +373,11 @@ class luceneValidation extends serviceValidation { @@ -368,6 +373,11 @@ class luceneValidation extends serviceValidation {
368 $java = $zendsys."jre".DS."bin".DS."java.exe"; 373 $java = $zendsys."jre".DS."bin".DS."java.exe";
369 if(file_exists($java)) 374 if(file_exists($java))
370 return $java; 375 return $java;
  376 + } else {
  377 + $java = "/usr/bin/java";
  378 + if(file_exists($java)) {
  379 + return $java;
  380 + }
371 } 381 }
372 } 382 }
373 383
setup/wizard/lib/validation/schedulerValidation.php
@@ -91,13 +91,14 @@ class schedulerValidation extends serviceValidation { @@ -91,13 +91,14 @@ class schedulerValidation extends serviceValidation {
91 91
92 public function binaryChecks() { 92 public function binaryChecks() {
93 // TODO: Better detection 93 // TODO: Better detection
94 - return true;  
95 - $this->setPhp();  
96 - if($this->util->phpSpecified()) {  
97 - return $this->detPhpSettings(); 94 + $phpDir = $this->util->useZendPhp();
  95 + if(WINDOWS_OS) {
  96 + $phpPath = "$phpDir"."php.exe";
98 } else { 97 } else {
99 - $this->specifyPhp();// Ask for settings  
100 - return false; 98 + $phpPath = "$phpDir"."php";
  99 + }
  100 + if(file_exists($phpPath)) {
  101 + return $phpPath;
101 } 102 }
102 } 103 }
103 104
@@ -141,9 +142,8 @@ class schedulerValidation extends serviceValidation { @@ -141,9 +142,8 @@ class schedulerValidation extends serviceValidation {
141 $this->phpCheck = 'tick'; 142 $this->phpCheck = 'tick';
142 } elseif ($phpDir = $this->util->useZendPhp()) { // Use System Defined Settings 143 } elseif ($phpDir = $this->util->useZendPhp()) { // Use System Defined Settings
143 $this->php = $phpDir; 144 $this->php = $phpDir;
144 - } else {  
145 -  
146 } 145 }
  146 +
147 $this->temp_variables['php']['location'] = $this->php; 147 $this->temp_variables['php']['location'] = $this->php;
148 } 148 }
149 149
setup/wizard/steps/database.php
@@ -641,7 +641,8 @@ class database extends Step @@ -641,7 +641,8 @@ class database extends Step
641 if(!$this->populateSchema()) { 641 if(!$this->populateSchema()) {
642 $this->error['con'] = "Could not populate schema "; 642 $this->error['con'] = "Could not populate schema ";
643 } 643 }
644 - 644 + $this->writeBinaries();
  645 +
645 return true; 646 return true;
646 } 647 }
647 648
@@ -769,8 +770,22 @@ class database extends Step @@ -769,8 +770,22 @@ class database extends Step
769 $this->util->dbUtilities->query($dropPluginHelper); 770 $this->util->dbUtilities->query($dropPluginHelper);
770 $updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";'; 771 $updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";';
771 $this->util->dbUtilities->query($updateUrls); 772 $this->util->dbUtilities->query($updateUrls);
  773 + $this->writeBinaries();
  774 +
772 return true; 775 return true;
773 } 776 }
  777 +
  778 + private function writeBinaries() {
  779 + $services = $this->util->getDataFromSession('services');
  780 + $binaries = $services['binaries'];
  781 + foreach ($binaries as $k=>$bin) {
  782 + if($k != 1) {
  783 + $updateBin = 'UPDATE config_settings c SET c.value = "'.$bin.'" where c.group_name = "externalBinary" and c.display_name = "'.$k.'";';
  784 + $this->util->dbUtilities->query($updateBin);
  785 + }
  786 + }
  787 + }
  788 +
774 /** 789 /**
775 * Close connection if it exists 790 * Close connection if it exists
776 * 791 *
setup/wizard/steps/services.php
@@ -67,7 +67,7 @@ class services extends Step @@ -67,7 +67,7 @@ class services extends Step
67 * @access private 67 * @access private
68 * @var array 68 * @var array
69 */ 69 */
70 - private $services = array('Lucene', 'Scheduler', 'OpenOffice'); 70 + private $services = array('java'=>'Lucene', 'php'=>'Scheduler', 'soffice'=>'OpenOffice');
71 71
72 /** 72 /**
73 * Flag if services are already Installed 73 * Flag if services are already Installed
@@ -144,6 +144,7 @@ class services extends Step @@ -144,6 +144,7 @@ class services extends Step
144 */ 144 */
145 public $schedulerValidation; 145 public $schedulerValidation;
146 146
  147 + public $binaries = array();
147 /** 148 /**
148 * Main control of services setup 149 * Main control of services setup
149 * 150 *
@@ -202,7 +203,7 @@ class services extends Step @@ -202,7 +203,7 @@ class services extends Step
202 $this->alreadyInstalled = true; 203 $this->alreadyInstalled = true;
203 $this->serviceCheck = 'tick'; 204 $this->serviceCheck = 'tick';
204 } else { 205 } else {
205 - foreach ($this->getServices() as $service) { 206 + foreach ($this->getServices() as $bin=>$service) {
206 $class = strtolower($service)."Validation"; 207 $class = strtolower($service)."Validation";
207 $this->$class->preset(); // Sets defaults 208 $this->$class->preset(); // Sets defaults
208 $className = OS.$service; 209 $className = OS.$service;
@@ -212,6 +213,7 @@ class services extends Step @@ -212,6 +213,7 @@ class services extends Step
212 if($status != 'STARTED' || $status != 'STOPPED') { 213 if($status != 'STARTED' || $status != 'STOPPED') {
213 if(!WINDOWS_OS) { $binary = $this->$class->getBinary(); } // Get binary, if it exists 214 if(!WINDOWS_OS) { $binary = $this->$class->getBinary(); } // Get binary, if it exists
214 $passed = $this->$class->binaryChecks(); // Run Binary Pre Checks 215 $passed = $this->$class->binaryChecks(); // Run Binary Pre Checks
  216 + $this->binaries[$bin] = $passed;
215 if ($passed) { // Install Service 217 if ($passed) { // Install Service
216 $this->installService($service, $passed); 218 $this->installService($service, $passed);
217 } 219 }
@@ -520,6 +522,7 @@ class services extends Step @@ -520,6 +522,7 @@ class services extends Step
520 } 522 }
521 $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled; 523 $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
522 $this->temp_variables['serviceCheck'] = $this->serviceCheck; 524 $this->temp_variables['serviceCheck'] = $this->serviceCheck;
  525 + $this->temp_variables['binaries'] = $this->binaries;
523 } 526 }
524 527
525 528
setup/wizard/templates/install.tpl
@@ -10,8 +10,8 @@ @@ -10,8 +10,8 @@
10 </p> 10 </p>
11 <div class="demo"><?php echo $html->image('greenit.jpg', array('style'=>'padding-left: 35px;')); ?></div> 11 <div class="demo"><?php echo $html->image('greenit.jpg', array('style'=>'padding-left: 35px;')); ?></div>
12 <br/><br/><br/><br/> 12 <br/><br/><br/><br/>
13 -<p> <input class="" type='checkbox' name='call_home' value='enable' checked style="float:left;"/>&nbsp;&nbsp;  
14 - Help to improve KnowledgeTree by providing anonymous usage statistics</p> 13 +<p> <input type='checkbox' name='call_home' value='enable' checked style="float:left;"/>&nbsp;&nbsp;
  14 + <label for='call_home'>Help to improve KnowledgeTree by providing anonymous usage statistics</label></p>
15 </div> 15 </div>
16 <input type="submit" name="Previous" value="Previous" class="button_previous"/> 16 <input type="submit" name="Previous" value="Previous" class="button_previous"/>
17 <input type="submit" name="Install" value="Install" class="button_next"/> 17 <input type="submit" name="Install" value="Install" class="button_next"/>