From 432cca1a143c72a969cd9368ce324a4e790ad346 Mon Sep 17 00:00:00 2001
From: Jarrett Jordaan
Date: Mon, 2 Nov 2009 20:11:13 +0200
Subject: [PATCH] External Binary Settings updated after installation
---
setup/wizard/lib/validation/luceneValidation.php | 50 ++++++++++++++++++++++++++++++--------------------
setup/wizard/lib/validation/schedulerValidation.php | 16 ++++++++--------
setup/wizard/steps/database.php | 17 ++++++++++++++++-
setup/wizard/steps/services.php | 7 +++++--
setup/wizard/templates/install.tpl | 4 ++--
5 files changed, 61 insertions(+), 33 deletions(-)
diff --git a/setup/wizard/lib/validation/luceneValidation.php b/setup/wizard/lib/validation/luceneValidation.php
index 2bf3205..ac1f4ea 100644
--- a/setup/wizard/lib/validation/luceneValidation.php
+++ b/setup/wizard/lib/validation/luceneValidation.php
@@ -262,28 +262,33 @@ class luceneValidation extends serviceValidation {
* @return boolean
*/
public function binaryChecks() {
- if($this->util->javaSpecified()) {
- $this->disableExtension = true; // Disable the use of the php bridge extension
- if($this->detSettings(true)) { // AutoDetect java settings
- return true;
- } else {
- $this->specifyJava(); // Ask for settings
- }
- } else {
- $auto = $this->useBridge(); // Use Bridge to get java settings
- if($auto) {
+ $java = $this->useZendJava();
+ if(!$java) {
+ if($this->util->javaSpecified()) {
+ $this->disableExtension = true; // Disable the use of the php bridge extension
+ if($this->detSettings(true)) { // AutoDetect java settings
+ return true;
+ } else {
+ $this->specifyJava(); // Ask for settings
+ }
+ } else {
+ $auto = $this->useBridge(); // Use Bridge to get java settings
+ if($auto) {
+ return $auto;
+ } else {
+ $auto = $this->detSettings(); // Check if auto detected java works
+ if($auto) {
+ $this->disableExtension = true; // Disable the use of the php bridge extension
+ return $auto;
+ } else {
+ $this->specifyJava(); // Ask for settings
+ }
+ }
return $auto;
- } else {
- $auto = $this->detSettings(); // Check if auto detected java works
- if($auto) {
- $this->disableExtension = true; // Disable the use of the php bridge extension
- return $auto;
- } else {
- $this->specifyJava(); // Ask for settings
- }
- }
- return $auto;
+ }
}
+
+ return $java;
}
/**
@@ -368,6 +373,11 @@ class luceneValidation extends serviceValidation {
$java = $zendsys."jre".DS."bin".DS."java.exe";
if(file_exists($java))
return $java;
+ } else {
+ $java = "/usr/bin/java";
+ if(file_exists($java)) {
+ return $java;
+ }
}
}
diff --git a/setup/wizard/lib/validation/schedulerValidation.php b/setup/wizard/lib/validation/schedulerValidation.php
index b39b9ad..1c88f7c 100644
--- a/setup/wizard/lib/validation/schedulerValidation.php
+++ b/setup/wizard/lib/validation/schedulerValidation.php
@@ -91,13 +91,14 @@ class schedulerValidation extends serviceValidation {
public function binaryChecks() {
// TODO: Better detection
- return true;
- $this->setPhp();
- if($this->util->phpSpecified()) {
- return $this->detPhpSettings();
+ $phpDir = $this->util->useZendPhp();
+ if(WINDOWS_OS) {
+ $phpPath = "$phpDir"."php.exe";
} else {
- $this->specifyPhp();// Ask for settings
- return false;
+ $phpPath = "$phpDir"."php";
+ }
+ if(file_exists($phpPath)) {
+ return $phpPath;
}
}
@@ -141,9 +142,8 @@ class schedulerValidation extends serviceValidation {
$this->phpCheck = 'tick';
} elseif ($phpDir = $this->util->useZendPhp()) { // Use System Defined Settings
$this->php = $phpDir;
- } else {
-
}
+
$this->temp_variables['php']['location'] = $this->php;
}
diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php
index 0e658af..c7d2cdd 100644
--- a/setup/wizard/steps/database.php
+++ b/setup/wizard/steps/database.php
@@ -641,7 +641,8 @@ class database extends Step
if(!$this->populateSchema()) {
$this->error['con'] = "Could not populate schema ";
}
-
+ $this->writeBinaries();
+
return true;
}
@@ -769,8 +770,22 @@ class database extends Step
$this->util->dbUtilities->query($dropPluginHelper);
$updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";';
$this->util->dbUtilities->query($updateUrls);
+ $this->writeBinaries();
+
return true;
}
+
+ private function writeBinaries() {
+ $services = $this->util->getDataFromSession('services');
+ $binaries = $services['binaries'];
+ foreach ($binaries as $k=>$bin) {
+ if($k != 1) {
+ $updateBin = 'UPDATE config_settings c SET c.value = "'.$bin.'" where c.group_name = "externalBinary" and c.display_name = "'.$k.'";';
+ $this->util->dbUtilities->query($updateBin);
+ }
+ }
+ }
+
/**
* Close connection if it exists
*
diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php
index 0baea83..de221f7 100644
--- a/setup/wizard/steps/services.php
+++ b/setup/wizard/steps/services.php
@@ -67,7 +67,7 @@ class services extends Step
* @access private
* @var array
*/
- private $services = array('Lucene', 'Scheduler', 'OpenOffice');
+ private $services = array('java'=>'Lucene', 'php'=>'Scheduler', 'soffice'=>'OpenOffice');
/**
* Flag if services are already Installed
@@ -144,6 +144,7 @@ class services extends Step
*/
public $schedulerValidation;
+ public $binaries = array();
/**
* Main control of services setup
*
@@ -202,7 +203,7 @@ class services extends Step
$this->alreadyInstalled = true;
$this->serviceCheck = 'tick';
} else {
- foreach ($this->getServices() as $service) {
+ foreach ($this->getServices() as $bin=>$service) {
$class = strtolower($service)."Validation";
$this->$class->preset(); // Sets defaults
$className = OS.$service;
@@ -212,6 +213,7 @@ class services extends Step
if($status != 'STARTED' || $status != 'STOPPED') {
if(!WINDOWS_OS) { $binary = $this->$class->getBinary(); } // Get binary, if it exists
$passed = $this->$class->binaryChecks(); // Run Binary Pre Checks
+ $this->binaries[$bin] = $passed;
if ($passed) { // Install Service
$this->installService($service, $passed);
}
@@ -520,6 +522,7 @@ class services extends Step
}
$this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
$this->temp_variables['serviceCheck'] = $this->serviceCheck;
+ $this->temp_variables['binaries'] = $this->binaries;
}
diff --git a/setup/wizard/templates/install.tpl b/setup/wizard/templates/install.tpl
index b055deb..d837833 100644
--- a/setup/wizard/templates/install.tpl
+++ b/setup/wizard/templates/install.tpl
@@ -10,8 +10,8 @@
image('greenit.jpg', array('style'=>'padding-left: 35px;')); ?>
-
- Help to improve KnowledgeTree by providing anonymous usage statistics
+
+
--
libgit2 0.21.4