diff --git a/.gitignore b/.gitignore index d7a1e80..bed2b56 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ clienttools/Karoo clienttools/Office .gitmodules *.out +baobab/ diff --git a/bin/win32/winserv.exe b/bin/win32/winserv.exe new file mode 100644 index 0000000..f687daa --- /dev/null +++ b/bin/win32/winserv.exe diff --git a/plugins/thumbnails/templates/shadow.gif b/plugins/thumbnails/templates/shadow.gif new file mode 100644 index 0000000..af7f537 --- /dev/null +++ b/plugins/thumbnails/templates/shadow.gif diff --git a/plugins/thumbnails/templates/shadowAlpha.png b/plugins/thumbnails/templates/shadowAlpha.png new file mode 100644 index 0000000..a2561df --- /dev/null +++ b/plugins/thumbnails/templates/shadowAlpha.png diff --git a/plugins/thumbnails/templates/thumbnail_viewlet.smarty b/plugins/thumbnails/templates/thumbnail_viewlet.smarty index 804706e..6801153 100755 --- a/plugins/thumbnails/templates/thumbnail_viewlet.smarty +++ b/plugins/thumbnails/templates/thumbnail_viewlet.smarty @@ -1,3 +1,23 @@ -
-
-
\ No newline at end of file +{literal} + +{/literal} +
+
+
diff --git a/scripts/diagnoseIndexing.sh b/scripts/diagnoseIndexing.sh index 536746b..3f790ba 100755 --- a/scripts/diagnoseIndexing.sh +++ b/scripts/diagnoseIndexing.sh @@ -1,4 +1,4 @@ #!/bin/sh cd ../search2/indexing/bin -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq diagnose.php +../../../scripts/php.sh -Cq diagnose.php diff --git a/scripts/indexMigrationTask.sh b/scripts/indexMigrationTask.sh index 3c33c9c..cfcc061 100755 --- a/scripts/indexMigrationTask.sh +++ b/scripts/indexMigrationTask.sh @@ -1,4 +1,4 @@ #!/bin/sh cd ../search2/indexing/bin -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq cronMigration.php +../../../scripts/php.sh -Cq cronMigration.php diff --git a/scripts/indexingTask.sh b/scripts/indexingTask.sh index eb3eb29..d17d1f5 100755 --- a/scripts/indexingTask.sh +++ b/scripts/indexingTask.sh @@ -1,4 +1,4 @@ #!/bin/sh cd ../search2/indexing/bin -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq cronIndexer.php +../../../scripts/php.sh -Cq cronIndexer.php diff --git a/scripts/optimizeIndexes.sh b/scripts/optimizeIndexes.sh index d2f30b1..4a2868b 100755 --- a/scripts/optimizeIndexes.sh +++ b/scripts/optimizeIndexes.sh @@ -1,4 +1,4 @@ #!/bin/sh cd ../search2/indexing/bin -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq optimise.php +../../../scripts/php.sh -Cq optimise.php diff --git a/scripts/php.sh b/scripts/php.sh new file mode 100755 index 0000000..a723c1c --- /dev/null +++ b/scripts/php.sh @@ -0,0 +1,8 @@ +#!/bin/sh +PHPRC=/usr/local/zend/etc +export PHPRC +PHP_PEAR_SYSCONF_DIR=/usr/local/zend/etc +export PHP_PEAR_SYSCONF_DIR +LD_LIBRARY_PATH="/usr/lib32:/usr/local/zend/lib:/usr/local/zend/lib/php_extensions:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH +exec /usr/local/zend/bin/php "$@" diff --git a/scripts/registerExtractorTypes.sh b/scripts/registerExtractorTypes.sh index 8e9cf8b..934f015 100755 --- a/scripts/registerExtractorTypes.sh +++ b/scripts/registerExtractorTypes.sh @@ -1,4 +1,4 @@ #!/bin/sh cd ../search2/indexing/bin -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq registerTypes.php +../../../scripts/php.sh -Cq registerTypes.php diff --git a/scripts/savedSearchTask.sh b/scripts/savedSearchTask.sh index 7bc72a0..d39ffc3 100755 --- a/scripts/savedSearchTask.sh +++ b/scripts/savedSearchTask.sh @@ -1,4 +1,4 @@ #!/bin/sh cd ../search2/indexing/bin -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq cronSavedSearch.php +../../../scripts/php.sh -Cq cronSavedSearch.php diff --git a/scripts/schedulerTask.sh b/scripts/schedulerTask.sh index de708c8..df34113 100755 --- a/scripts/schedulerTask.sh +++ b/scripts/schedulerTask.sh @@ -2,6 +2,6 @@ cd ../bin while true; do -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq scheduler.php +../scripts/php.sh -Cq scheduler.php sleep 30 done diff --git a/setup/migrate/templates/complete.tpl b/setup/migrate/templates/complete.tpl index b507927..f0487b2 100644 --- a/setup/migrate/templates/complete.tpl +++ b/setup/migrate/templates/complete.tpl @@ -24,21 +24,21 @@ - + - + - + diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 441797e..67f3a07 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -40,6 +40,8 @@ * @version Version 0.1 */ class InstallUtil { + + private $salt = 'installers'; /** * Constructs installation object * @@ -508,11 +510,11 @@ class InstallUtil { * @return boolean */ public function getDataFromSession($class) { - if(empty($_SESSION[$class])) { + if(empty($_SESSION[$this->salt][$class])) { return false; } - return $_SESSION[$class]; + return $_SESSION[$this->salt][$class]; } /** diff --git a/setup/wizard/installer.php b/setup/wizard/installer.php index 96cb136..11dc112 100644 --- a/setup/wizard/installer.php +++ b/setup/wizard/installer.php @@ -646,7 +646,7 @@ class Installer { */ public function showSession() { echo '
';
-        print_r($_SESSION);
+        print_r($_SESSION['installers']);
         echo '
'; } diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index 521fd42..ad71868 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -51,12 +51,12 @@ class unixScheduler extends unixService { $this->name = "KTSchedulerTest"; $this->util = new InstallUtil(); $this->scheduler = 'scheduler'; + $this->setSchedulerSource('schedulerTask.sh'); } public function load() { $this->setSystemDir(SYSTEM_ROOT."bin".DS); $this->setSchedulerDir(SYSTEM_DIR."bin".DS); - $this->setSchedulerSource('schedulerTask.sh'); $this->setSchedulerSourceLoc('schedulerTask.sh'); } @@ -171,4 +171,4 @@ class unixScheduler extends unixService { } -?> \ No newline at end of file +?> diff --git a/setup/wizard/lib/services/windowsOpenOffice.php b/setup/wizard/lib/services/windowsOpenOffice.php index 68cf981..5aad864 100644 --- a/setup/wizard/lib/services/windowsOpenOffice.php +++ b/setup/wizard/lib/services/windowsOpenOffice.php @@ -1,241 +1,244 @@ -. -* -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, -* California 94120-7775, or email info@knowledgetree.com. -* -* The interactive user interfaces in modified source and object code versions -* of this program must display Appropriate Legal Notices, as required under -* Section 5 of the GNU General Public License version 3. -* -* In accordance with Section 7(b) of the GNU General Public License version 3, -* these Appropriate Legal Notices must retain the display of the "Powered by -* KnowledgeTree" logo and retain the original copyright notice. If the display of the -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices -* must display the words "Powered by KnowledgeTree" and retain the original -* copyright notice. -* -* @copyright 2008-2009, KnowledgeTree Inc. -* @license GNU General Public License version 3 -* @author KnowledgeTree Team -* @package Installer -* @version Version 0.1 -*/ - -class windowsOpenOffice extends windowsService { - - /** - * Reference to utility object - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - public $util; - - /** - * Path to office executable - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $path; - - /** - * Web server - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $host; - - /** - * Path to temp pid file - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $pidFile; - - /** - * Web server Port - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $port; - - /** - * Web server - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $bin; - - /** - * Office executable name - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $soffice; - - /** - * Log file - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $log; - - /** - * Open office options - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $options; - - /** - * Path to win service - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $winservice; - - /** - * Service name - * - * @author KnowledgeTree Team - * @access public - * @param none - * @return string - */ - public $name = "KTOpenOfficeTest"; - - public function load() { - // hack for testing - $this->setPort("8100"); - $this->setHost("127.0.0.1"); - $this->setLog("openoffice.log"); - $this->setWinservice("winserv.exe"); - $this->setOption(); - } - - private function setPort($port = "8100") { - $this->port = $port; - } - - public function getPort() { - return $this->port; - } - - private function setHost($host = "127.0.0.1") { - $this->host = $host; - } - - public function getHost() { - return $this->host; - } - - private function setLog($log = "openoffice.log") { - $this->log = $log; - } - - public function getLog() { - return $this->log; - } - - private function setBin($bin) { - $this->bin = "\"".$bin."\""; - } - - public function getBin() { - return $this->bin; - } - - private function setWinservice($winservice = "winserv.exe") { - $this->winservice = SYS_BIN_DIR . $winservice; - } - - public function getWinservice() { - return $this->winservice; - } - - private function setOption() { - $this->options = "-displayname {$this->name} -start auto {$this->getBin()} -headless -invisible -nofirststartwizard" - . "-accept=\"socket,host={$this->host},port={$this->port};urp;StarOffice.ServiceManager\""; - } - - public function getOption() { - return $this->options; - } - - public function install() { - $status = $this->status(); - if($status == '') { - $services = $this->util->getDataFromSession('services'); - $this->setBin("{$services['openOfficeExe']}"); - $this->setOption(); - $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}"; - if(DEBUG) { - echo "$cmd
"; - return ; - } - $response = $this->util->pexec($cmd); - return $response; - } - else { - return $status; - } - } - - /** - * Retrieve Status Service - * - * @author KnowledgeTree Team - * @access public - * @param none - * @return string - */ - public function status() { - $cmd = "sc query {$this->name}"; - $response = $this->util->pexec($cmd); - if($response['out']) { - $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key - return $state; - } - - return ''; - } -} +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package Installer +* @version Version 0.1 +*/ + +class windowsOpenOffice extends windowsService { + + /** + * Reference to utility object + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + public $util; + + /** + * Path to office executable + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $path; + + /** + * Web server + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $host; + + /** + * Path to temp pid file + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $pidFile; + + /** + * Web server Port + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $port; + + /** + * Web server + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $bin; + + /** + * Office executable name + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $soffice; + + /** + * Log file + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $log; + + /** + * Open office options + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $options; + + /** + * Path to win service + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $winservice; + + /** + * Service name + * + * @author KnowledgeTree Team + * @access public + * @param none + * @return string + */ + public $name = "KTOpenOfficeTest"; + + public function load() { + // hack for testing + $this->setPort("8100"); + $this->setHost("127.0.0.1"); + $this->setLog("openoffice.log"); + $this->setWinservice("winserv.exe"); + $this->setOption(); + } + + private function setPort($port = "8100") { + $this->port = $port; + } + + public function getPort() { + return $this->port; + } + + private function setHost($host = "127.0.0.1") { + $this->host = $host; + } + + public function getHost() { + return $this->host; + } + + private function setLog($log = "openoffice.log") { + $this->log = $log; + } + + public function getLog() { + return $this->log; + } + + private function setBin($bin) { + $this->bin = "\"".$bin."\""; + } + + public function getBin() { + return $this->bin; + } + + private function setWinservice($winservice = "winserv.exe") { + if(file_exists(SYS_BIN_DIR . $winservice)) + $this->winservice = SYS_BIN_DIR . $winservice; + else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice)) + $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice; + } + + public function getWinservice() { + return $this->winservice; + } + + private function setOption() { + $this->options = "-displayname {$this->name} -start auto {$this->getBin()} -headless -nofirststartwizard " + . "-accept=\"socket,host={$this->host},port={$this->port};urp;StarOffice.ServiceManager\""; + } + + public function getOption() { + return $this->options; + } + + public function install() { + $status = $this->status(); + if($status == '') { + $services = $this->util->getDataFromSession('services'); + $this->setBin("{$services['openOfficeExe']}"); + $this->setOption(); + $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}"; + if(DEBUG) { + echo "$cmd
"; + return ; + } + $response = $this->util->pexec($cmd); + return $response; + } + else { + return $status; + } + } + + /** + * Retrieve Status Service + * + * @author KnowledgeTree Team + * @access public + * @param none + * @return string + */ + public function status() { + $cmd = "sc query {$this->name}"; + $response = $this->util->pexec($cmd); + if($response['out']) { + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key + return $state; + } + + return ''; + } +} ?> \ No newline at end of file diff --git a/setup/wizard/lib/services/windowsScheduler.php b/setup/wizard/lib/services/windowsScheduler.php index 58c2f2a..ecf2dda 100644 --- a/setup/wizard/lib/services/windowsScheduler.php +++ b/setup/wizard/lib/services/windowsScheduler.php @@ -227,7 +227,7 @@ class windowsScheduler extends windowsService { } private function setWinservice($winservice = "winserv.exe") { - $this->winservice = SYS_BIN_DIR . $winservice; + $this->winservice = SYS_BIN_DIR . "win32" . DS . $winservice; } private function setOptions() { diff --git a/setup/wizard/output/dummy.txt b/setup/wizard/output/dummy.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/setup/wizard/output/dummy.txt diff --git a/setup/wizard/path.php b/setup/wizard/path.php index 9f13359..c3ecaa0 100644 --- a/setup/wizard/path.php +++ b/setup/wizard/path.php @@ -40,7 +40,7 @@ * @version Version 0.1 */ // Define installer environment - define('DEBUG', 1); + define('DEBUG', 0); define('AJAX', 0); if (substr(php_uname(), 0, 7) == "Windows"){ define('WINDOWS_OS', true); diff --git a/setup/wizard/resources/form.js b/setup/wizard/resources/form.js index 7e1815b..b88c521 100644 --- a/setup/wizard/resources/form.js +++ b/setup/wizard/resources/form.js @@ -9,5 +9,4 @@ $(document).ready(function() { var options = {target: '#content_container', beforeSubmit: w.validateRegistration, success: w.adjustMenu($('form').attr('id'))}; $('form').ajaxForm(options); } -}); - +}); \ No newline at end of file diff --git a/setup/wizard/resources/wizard.css b/setup/wizard/resources/wizard.css index f33f440..3170842 100644 --- a/setup/wizard/resources/wizard.css +++ b/setup/wizard/resources/wizard.css @@ -82,7 +82,7 @@ select { } #wrapper { - background: white url("graphics/background.gif") repeat-y left; + /*background: white url("graphics/background.gif") repeat-y left;*/ } #container { diff --git a/setup/wizard/resources/wizard.js b/setup/wizard/resources/wizard.js index 1694539..68ed23a 100644 --- a/setup/wizard/resources/wizard.js +++ b/setup/wizard/resources/wizard.js @@ -215,4 +215,14 @@ wizard.prototype.sendJavaLocation = function () { wizard.prototype.sendRegistration = function () { $('form').submit(); +} + +wizard.prototype.clearSessions = function () { + var address = 'session.php?action=destroyInstall'; + $.ajax({ + url: address, + dataType: "html", + type: "POST", + cache: false, + }); } \ No newline at end of file diff --git a/setup/wizard/session.php b/setup/wizard/session.php index 0147aa8..4bb0487 100644 --- a/setup/wizard/session.php +++ b/setup/wizard/session.php @@ -36,11 +36,12 @@ * @copyright 2008-2009, KnowledgeTree Inc. * @license GNU General Public License version 3 * @author KnowledgeTree Team -* @package Installer +* @package Migrater * @version Version 0.1 */ class Session { + private $salt = 'installers'; /** * Constructs session object * @@ -61,9 +62,9 @@ class Session * @return void */ public function startSession() { - if(!isset($_SESSION['ready'])) { + if(!isset($_SESSION[$this->salt]['ready'])) { session_start(); - $_SESSION ['ready'] = TRUE; + $_SESSION[$this->salt] ['ready'] = TRUE; } } @@ -78,7 +79,7 @@ class Session */ public function set($fld, $val) { $this->startSession(); - $_SESSION [$fld] = $val; + $_SESSION[$this->salt] [$fld] = $val; } /** @@ -99,7 +100,7 @@ class Session } else { $classArray[$k] = $v; } - $_SESSION [ $class] = $classArray; + $_SESSION[$this->salt] [ $class] = $classArray; } /** @@ -120,7 +121,7 @@ class Session } else { $classArray[$k] = $v; } - $_SESSION [ $class] = $classArray; + $_SESSION[$this->salt] [ $class] = $classArray; } /** @@ -136,7 +137,7 @@ class Session public function clearErrors($class) { $classArray = $this->get($class); unset($classArray['errors']); - $_SESSION [ $class] = $classArray; + $_SESSION[$this->salt] [ $class] = $classArray; } /** @@ -149,7 +150,7 @@ class Session */ public function un_set($fld) { $this->startSession(); - unset($_SESSION [$fld]); + unset($_SESSION[$this->salt] [$fld]); } /** @@ -162,8 +163,8 @@ class Session */ public function un_setClass($class) { $this->startSession(); - if(isset($_SESSION [$class])) - unset($_SESSION [$class]); + if(isset($_SESSION[$this->salt] [$class])) + unset($_SESSION[$this->salt] [$class]); } /** @@ -176,7 +177,7 @@ class Session */ public function destroy() { $this->startSession(); - unset($_SESSION); + unset($_SESSION[$this->salt]); session_destroy(); } @@ -190,8 +191,8 @@ class Session */ public function get($fld) { $this->startSession(); - if(isset($_SESSION [$fld])) - return $_SESSION [$fld]; + if(isset($_SESSION[$this->salt] [$fld])) + return $_SESSION[$this->salt] [$fld]; return false; } @@ -205,7 +206,7 @@ class Session */ public function is_set($fld) { $this->startSession(); - return isset($_SESSION [$fld]); + return isset($_SESSION[$this->salt] [$fld]); } /** @@ -217,7 +218,21 @@ class Session * @return string */ public function getClass($class) { - return $_SESSION[$class]; + return $_SESSION[$this->salt][$class]; + } + + public function destroyInstall() { + $_SESSION[$this->salt] = ''; + $this->destroy(); + } +} + +if(isset($_GET['action'])) { + $func = $_GET['action']; + if($func != '') { + $ses = new Session(); + $method = "$func"; + $ses->$method(); } } ?> \ No newline at end of file diff --git a/setup/wizard/step.php b/setup/wizard/step.php index 64659a5..b994e92 100644 --- a/setup/wizard/step.php +++ b/setup/wizard/step.php @@ -105,6 +105,8 @@ class Step protected $silent = false; public $displayFirst = false; + + private $salt = 'installers'; /** * Returns step state * @@ -286,10 +288,10 @@ class Step * @return boolean */ public function setDataFromSession($class) { - if(empty($_SESSION[$class])) { + if(empty($_SESSION[$this->salt][$class])) { return false; } - $_POST = $_SESSION[$class]; + $_POST = $_SESSION[$this->salt][$class]; return true; } @@ -303,11 +305,11 @@ class Step * @return boolean */ public function getDataFromSession($class) { - if(empty($_SESSION[$class])) { + if(empty($_SESSION[$this->salt][$class])) { return false; } - return $_SESSION[$class]; + return $_SESSION[$this->salt][$class]; } /** diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php index 7f11b25..b127657 100644 --- a/setup/wizard/steps/database.php +++ b/setup/wizard/steps/database.php @@ -240,6 +240,8 @@ class database extends Step */ protected $silent = true; + private $salt = 'installers'; + /** * Constructs database object * @@ -389,8 +391,8 @@ class database extends Step * @return boolean */ private function setErrorsFromSession() { - if(isset($_SESSION['database']['errors'])) { - $this->error[] = $_SESSION['database']['errors']; + if(isset($_SESSION[$this->salt]['database']['errors'])) { + $this->error[] = $_SESSION[$this->salt]['database']['errors']; return true; } diff --git a/setup/wizard/steps/registration.php b/setup/wizard/steps/registration.php index 23d8723..7a7fb16 100644 --- a/setup/wizard/steps/registration.php +++ b/setup/wizard/steps/registration.php @@ -137,7 +137,7 @@ class registration extends Step return true; } $this->setInSession(); - return true; +// return true; //$this->postForm($_POST); //$this->sendToHost($_POST); diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php index c17adee..9812859 100644 --- a/setup/wizard/steps/services.php +++ b/setup/wizard/steps/services.php @@ -1,1184 +1,1190 @@ -. -* -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, -* California 94120-7775, or email info@knowledgetree.com. -* -* The interactive user interfaces in modified source and object code versions -* of this program must display Appropriate Legal Notices, as required under -* Section 5 of the GNU General Public License version 3. -* -* In accordance with Section 7(b) of the GNU General Public License version 3, -* these Appropriate Legal Notices must retain the display of the "Powered by -* KnowledgeTree" logo and retain the original copyright notice. If the display of the -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices -* must display the words "Powered by KnowledgeTree" and retain the original -* copyright notice. -* -* @copyright 2008-2009, KnowledgeTree Inc. -* @license GNU General Public License version 3 -* @author KnowledgeTree Team -* @package Installer -* @version Version 0.1 -*/ - -if(isset($_GET['action'])) { - $func = $_GET['action']; - if($func != '') { - require_once("../step.php"); - require_once("../installUtil.php"); - require_once("../path.php"); - } -} - -class services extends Step -{ - /** - * List of errors encountered - * - * @author KnowledgeTree Team - * @access protected - * @var array - */ - protected $error = array(); - - /** - * Flag if step needs to be installed - * - * @author KnowledgeTree Team - * @access protected - * @var array - */ - protected $runInstall = true; - - /** - * List of services to be installed - * - * @author KnowledgeTree Team - * @access private - * @var array - */ - private $services = array('Lucene', 'Scheduler', 'OpenOffice'); - - /** - * Path to php executable - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - protected $php; - - /** - * Flag if php already provided - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - public $providedPhp = false; - - /** - * PHP Installed - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - private $phpCheck = 'cross_orange'; - - /** - * Flag, if php is specified and an error has been encountered - * - * @author KnowledgeTree Team - * @access public - * @var boolean - */ - private $phpExeError = false; - - /** - * Holds path error, if php is specified - * - * @author KnowledgeTree Team - * @access public - * @var string - */ - private $phpExeMessage = ''; - - /** - * Path to open office executable - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - protected $soffice; - - /** - * Flag if open office already provided - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - public $providedOpenOffice = false; - - /** - * Flag, if open office is specified and an error has been encountered - * - * @author KnowledgeTree Team - * @access public - * @var boolean - */ - private $openOfficeExeError = false; - - /** - * Holds path error, if open office is specified - * - * @author KnowledgeTree Team - * @access public - * @var string - */ - private $openOfficeExeMessage = ''; - - /** - * Path to java executable - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - protected $java = ""; - - /** - * Minumum Java Version - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $javaVersion = '1.5'; - - /** - * Java Installed - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - private $javaCheck = 'cross'; - - /** - * Open Office Installed - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - private $openOfficeCheck = 'cross'; - - /** - * Flag if java already provided - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - public $providedJava = false; - - /** - * Java Bridge Installed - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - private $javaExtCheck = 'cross_orange'; - - /** - * Flag if bridge extension needs to be disabled - * - * @author KnowledgeTree Team - * @access public - * @var boolean - */ - private $disableExtension = false; - - /** - * Flag, if java is specified and an error has been encountered - * - * @author KnowledgeTree Team - * @access public - * @var booelean - */ - private $javaExeError = false; - - /** - * Holds path error, if java is specified - * - * @author KnowledgeTree Team - * @access public - * @var string - */ - private $javaExeMessage = ''; - - /** - * Flag if services are already Installed - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - private $alreadyInstalled = false; - - /** - * Flag if services are already Installed - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - private $luceneInstalled = false; - - /** - * Flag if services are already Installed - * - * @author KnowledgeTree Team - * @access private - * @var mixed - */ - private $schedulerInstalled = false; - - /** - * Path to php executable - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - private $openOfficeInstalled; - - /** - * Service Installed - * - * @author KnowledgeTree Team - * @access private - * @var array - */ - private $serviceCheck = 'tick'; - - /** - * Flag to store class information in session - * - * @author KnowledgeTree Team - * @access public - * @var boolean - */ - protected $storeInSession = true; - - /** - * List of variables to be loaded to template - * - * @author KnowledgeTree Team - * @access public - * @var array - */ - protected $temp_variables; - - /** - * Flag if step needs to run silently - * - * @author KnowledgeTree Team - * @access public - * @var array - */ - protected $silent = true; - - /** - * Reference to utility object - * - * @author KnowledgeTree Team - * @access protected - * @var string - */ - protected $util; - - /** - * Constructs services object - * - * @author KnowledgeTree Team - * @access public - * @param none - */ - public function __construct() { - $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent); - $this->util = new InstallUtil(); - } - - /** - * Main control of services setup - * - * @author KnowledgeTree Team - * @param none - * @access public - * @return string - */ - public function doStep() - { - if(!$this->inStep("services")) { - $this->doRun(); - return 'landing'; - } - if($this->next()) { - // Check dependencies - $passed = $this->doRun(); - $serv = $this->getDataFromSession("services"); - if($passed || $serv['providedJava']) - return 'next'; - else - return 'error'; - } else if($this->previous()) { - return 'previous'; - } - $passed = $this->doRun(); - return 'landing'; - } - - /** - * Get service names - * - * @author KnowledgeTree Team - * @param none - * @access public - * @return array - */ - public function getServices() { - return $this->services; - } - - /** - * Check if java executable was found - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return array - */ - private function setJava() { - if($this->java != '') { // Java JRE Found - $this->javaCheck = 'tick'; - $this->javaInstalled(); - $this->temp_variables['java']['location'] = $this->java; - } - } - - /** - * Run step - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function doRun() { - if($this->alreadyInstalled()) { - $this->alreadyInstalled = true; - $this->serviceCheck = 'tick'; - } else { - $this->presetJava(); - $this->presetOpenOffice(); - if(!$this->schedulerInstalled) { - $this->php = $this->util->getPhp(); // Get java, if it exists - $passedPhp = $this->phpChecks(); // Run Java Pre Checks - if ($passedPhp) { // Install Scheduler - $this->installService('Scheduler'); - } - } else { - $this->schedulerInstalled(); - } - if(!$this->luceneInstalled) { - $this->java = $this->util->getJava(); // Get java, if it exists - $passedJava = $this->javaChecks(); // Run Java Pre Checks - if ($passedJava) { // Install Lucene - $this->installService('Lucene'); - } - } else { - $this->luceneInstalled(); - } - if(!$this->openOfficeInstalled) { - $this->soffice = $this->util->getOpenOffice(); // Get java, if it exists - $passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks - if ($passedOpenOffice) { //Install OpenOffice -// $this->temp_variables['openOfficeExe'] = $this->soffice; - // TODO : Why, O, why? - $this->openOfficeExeError = false; - $_SESSION['services']['openOfficeExe'] = $this->soffice; - $this->installService('OpenOffice'); - } - } else { - $this->openOfficeInstalled(); - } - } - $this->checkServiceStatus(); - $this->storeSilent(); // Store info needed for silent mode - if(!empty($errors)) - return false; - return true; - } - - private function openOfficeInstalled() { - - } - - private function schedulerInstalled() { - - } - - private function luceneInstalled() { - $this->disableExtension = true; // Disable the use of the php bridge extension - $this->javaVersionCorrect(); - $this->javaInstalled(); - $this->javaCheck = 'tick'; - } - - /** - * A final check to see if services are still running, - * incase they switched on and turned off. - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function checkServiceStatus() { - $serverDetails = $this->getServices(); - foreach ($serverDetails as $serviceName) { - $className = OS.$serviceName; - $service = new $className(); - $service->load(); - $status = $this->serviceInstalled($service); - if($status != 'STARTED') { - $msg = $service->getName()." Could not be added as a Service"; - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg); - $this->serviceCheck = 'cross_orange'; - $this->warnings[] = $msg; - } else { - if(WINDOWS_OS) { - $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); } - else { - $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service"); - } - } - } - } - - /** - * Checks if all services have been started already, - * incase the user lands on service page multiple times - * - * @author KnowledgeTree Team - * @param none - * @access public - * @return boolean - */ - public function alreadyInstalled() { - $allInstalled = true; - $serverDetails = $this->getServices(); - foreach ($serverDetails as $serviceName) { - $className = OS.$serviceName; - $service = new $className(); - $status = $this->serviceInstalled($service); - $flag = strtolower(substr($serviceName,0,1)).substr($serviceName,1)."Installed"; - if(!$status) { - $allInstalled = false; - $this->$flag = false; - } else { - $this->$flag = true; - } - } - - return $allInstalled; - } - - private function presetJava() { - $this->zendBridgeNotInstalled(); // Set bridge not installed - $this->javaVersionInCorrect(); // Set version to incorrect - $this->javaNotInstalled(); // Set java to not installed - $this->setJava(); // Check if java has been auto detected - } - - private function presetOpenOffice() { - $this->specifyOpenOffice(); - } - - private function setOpenOffice() { - - } - /** - * Do some basic checks to help the user overcome java problems - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function javaChecks() { - 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->useDetected(); // 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; - } - } - - private function openOfficeChecks() { - if($this->util->openOfficeSpecified()) { - $this->soffice = $this->util->openOfficeSpecified(); - - return true; - } else { - return false; - } - } - - /** - * Attempt detection without logging errors - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function useDetected() { - return $this->detSettings(); - } - - /** - * Set template view to specify java - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function specifyJava() { - $this->javaExeError = true; - } - - /** - * Set template view to specify php - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function specifyPhp() { - $this->phpExeError = true; - } - - /** - * Set template view to specify open office - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function specifyOpenOffice() { - $this->openOfficeExeError = true; - } - - private function phpChecks() { - // TODO: Better detection - return true; - $this->setPhp(); - if($this->util->phpSpecified()) { - return $this->detPhpSettings(); - } else { - $this->specifyPhp();// Ask for settings - return false; - } - } - - - - /** - * Attempts to use user input and configure java settings - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function detSettings($attempt = false) { - $javaExecutable = $this->util->javaSpecified();// Retrieve java bin - if($javaExecutable == '') { - if($this->java == '') { - return false; - } - $javaExecutable = $this->java; - } - $cmd = "\"$javaExecutable\" -version > output/outJV 2>&1 echo $!"; - $response = $this->util->pexec($cmd); - if(file_exists(OUTPUT_DIR.'outJV')) { - $tmp = file_get_contents(OUTPUT_DIR.'outJV'); - preg_match('/"(.*)"/',$tmp, $matches); - if($matches) { - if($matches[1] < $this->javaVersion) { // Check Version of java - $this->javaVersionInCorrect(); - $this->javaCheck = 'cross'; - $this->error[] = "Requires Java 1.5+ to be installed"; - - return false; - } else { - $this->javaVersionCorrect(); - $this->javaInstalled(); - $this->javaCheck = 'tick'; - $this->providedJava = true; - - return true; - } - } else { - $this->javaVersionWarning(); - $this->javaCheck = 'cross_orange'; - if($attempt) { - $this->javaExeMessage = "Incorrect java path specified"; - $this->javaExeError = true; - $this->error[] = "Requires Java 1.5+ to be installed"; - } - - - return false; - } - } - - $this->javaVersionInCorrect(); - $this->javaCheck = 'cross'; - $this->error[] = "Requires Java 1.5+ to be installed"; - return false; - } - - function detPhpSettings() { - // TODO: Better php handling - return true; - $phpExecutable = $this->util->phpSpecified();// Retrieve java bin - $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!"; - $response = $this->util->pexec($cmd); - if(file_exists(OUTPUT_DIR.'outPHP')) { - $tmp = file_get_contents(OUTPUT_DIR.'outPHP'); - preg_match('/PHP/',$tmp, $matches); - if($matches) { - $this->phpCheck = 'tick'; - - return true; - } else { - $this->phpCheck = 'cross_orange'; - $this->phpExeError = "PHP : Incorrect path specified"; - $this->error[] = "PHP executable required"; - - return false; - } - } - } - /** - * Attempts to use bridge and configure java settings - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function useBridge() { - $zendBridge = $this->util->zendBridge(); // Find Zend Bridge - if($zendBridge) { // Bridge installed implies java exists - $this->zendBridgeInstalled(); - if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional - $this->javaExtCheck = 'tick'; // Set bridge to functional - $this->javaInstalled(); // Set java to installed - $javaSystem = new Java('java.lang.System'); - $version = $javaSystem->getProperty('java.version'); - $ver = substr($version, 0, 3); - if($ver < $this->javaVersion) { - $this->javaVersionInCorrect(); - $this->error[] = "Requires Java 1.5+ to be installed"; - return false; - } else { - $this->javaVersionCorrect(); // Set version to correct - $this->javaCheck = 'tick'; - return true; - } - } else { - $this->javaCheck = 'cross_orange'; - $this->javaVersionWarning(); - $this->zendBridgeWarning(); - $this->warnings[] = "Zend Java Bridge Not Functional"; - $this->javaExtCheck = 'cross_orange'; - return false; - } - } else { - $this->warnings[] = "Zend Java Bridge Not Found"; - 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 - * @param none - * @access private - * @return boolean - */ - private function installServices() { - foreach ($this->getServices() as $serviceName) { - $this->installService($serviceName); - } - - return true; - } - - /** - * Installs services helper - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function installService($serviceName) { - $className = OS.$serviceName; - $service = new $className(); - $status = $this->serviceHelper($service); - if (!$status) { - $this->serviceCheck = 'cross_orange'; - } - } - - /** - * Installs services - * - * @author KnowledgeTree Team - * @param object - * @access private - * @return string - */ - private function serviceHelper($service) { - $service->load(); // Load Defaults - $response = $service->install(); // Install service - $statusCheck = OS."ServiceInstalled"; - return $this->$statusCheck($service); - } - - /** - * Helper to check if service is installed - * - * @author KnowledgeTree Team - * @param object - * @access public - * @return string - */ - public function serviceInstalled($service) { - $statusCheck = OS."ServiceInstalled"; - return $this->$statusCheck($service); - } - - /** - * Helper to check if service is started - * - * @author KnowledgeTree Team - * @param object - * @access public - * @return string - */ - public function serviceStarted($service) { - $statusCheck = OS."ServiceStarted"; - return $this->$statusCheck($service); - } - - /** - * Check if windows service installed - * - * @author KnowledgeTree Team - * @param object - * @access public - * @return boolean - */ - public function windowsServiceStarted($service) { - $status = $service->status(); // Check if service has been installed - if($status != 'RUNNING') { // Check service status - return false; - } - return true; - } - - /** - * Check if unix service installed - * - * @author KnowledgeTree Team - * @param object - * @access public - * @return boolean - */ - public function unixServiceStarted($service) { - $status = $service->status(); // Check if service has been installed - if($status != 'STARTED') { // Check service status - return false; - } - return true; - } - - /** - * Check if windows service installed - * - * @author KnowledgeTree Team - * @param object - * @access public - * @return boolean - */ - public function windowsServiceInstalled($service) { - $status = $service->status(); // Check if service has been installed - if($status == '') { // Check service status - return false; - } - return true; - } - - /** - * Check if unix service installed - * - * @author KnowledgeTree Team - * @param object - * @access public - * @return boolean - */ - public function unixServiceInstalled($service) { - $status = $service->status(); // Check if service has been installed - if($status != 'STARTED') { // Check service status - return false; - } - return true; - } - - /** - * Starts all services - * - * @author KnowledgeTree Team - * @param object - * @access public - * @return mixed - */ - public function installStep() { - foreach ($this->getServices() as $serviceName) { - $className = OS.$serviceName; - $service = new $className(); - $status = $this->serviceStart($service); - } - return true; - } - - /** - * Starts service - * - * @author KnowledgeTree Team - * @param object - * @access private - * @return string - */ - private function serviceStart($service) { - if(OS == 'windows') { - $service->load(); // Load Defaults - $service->start(); // Start Service - return $service->status(); // Get service status - } - } - - /** - * Returns services errors - * - * @author KnowledgeTree Team - * @access public - * @params none - * @return array - */ - public function getErrors() { - 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 - * - * @author KnowledgeTree Team - * @access public - * @return array - */ - public function getStepVars() - { - return $this->temp_variables; - } - - /** - * Store Java state as installed - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function javaInstalled() { - $this->temp_variables['java']['class'] = 'tick'; - $this->temp_variables['java']['found'] = "Java Runtime Installed"; - } - - /** - * Store Java state as not installed - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function javaNotInstalled() { - $this->temp_variables['java']['class'] = 'cross'; - $this->temp_variables['java']['found'] = "Java runtime environment required"; - } - - /** - * Store Java version state as correct - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function javaVersionCorrect() { - $this->temp_variables['version']['class'] = 'tick'; - $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; - } - - /** - * Store Java version state as warning - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function javaVersionWarning() { - $this->temp_variables['version']['class'] = 'cross_orange'; - $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected"; - } - - /** - * Store Java version as state incorrect - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function javaVersionInCorrect() { - $this->temp_variables['version']['class'] = 'cross'; - $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; - } - - /** - * Store Zend Bridge state as installed - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function zendBridgeInstalled() { - $this->temp_variables['extensions']['class'] = 'tick'; - $this->temp_variables['extensions']['found'] = "Java Bridge Installed"; - } - - /** - * Store Zend Bridge state as not installed - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function zendBridgeNotInstalled() { - $this->temp_variables['extensions']['class'] = 'cross_orange'; - $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed"; - } - - /** - * Store Zend Bridge state as warning - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function zendBridgeWarning() { - $this->temp_variables['extensions']['class'] = 'cross_orange'; - $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional"; - } - - /** - * Set all silent mode varibles - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return void - */ - private function storeSilent() { - // Servics - $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled; - $this->temp_variables['luceneInstalled'] = $this->luceneInstalled; - $this->temp_variables['schedulerInstalled'] = $this->schedulerInstalled; - $this->temp_variables['openOfficeInstalled'] = $this->openOfficeInstalled; - // Java - $this->temp_variables['javaExeError'] = $this->javaExeError; - $this->temp_variables['javaExeMessage'] = $this->javaExeMessage; - $this->temp_variables['javaCheck'] = $this->javaCheck; - $this->temp_variables['javaExtCheck'] = $this->javaExtCheck; - // Open Office - $this->temp_variables['openOfficeExeError'] = $this->openOfficeExeError; - $this->temp_variables['openOfficeExeMessage'] = $this->openOfficeExeMessage; - // TODO : PHP detection - $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck; - $this->temp_variables['phpExeError'] = '';//$this->phpExeError; - $this->temp_variables['serviceCheck'] = $this->serviceCheck; - $this->temp_variables['disableExtension'] = $this->disableExtension; - // TODO: Java checks are gettign intense - $this->temp_variables['providedJava'] = $this->providedJava; - } - - private function setPhp() { - if($this->php != '') { // PHP Found - $this->phpCheck = 'tick'; - } elseif (PHP_DIR != '') { // Use System Defined Settings - $this->php = PHP_DIR; - } else { - - } - $this->temp_variables['php']['location'] = $this->php; - } - - public function getPhpDir() { - return $this->php; - } - - public function doDeleteAll() { - $serverDetails = $this->getServices(); - foreach ($serverDetails as $serviceName) { - $className = OS.$serviceName; - require_once("../lib/services/service.php"); - require_once("../lib/services/".OS."Service.php"); - require_once("../lib/services/$className.php"); - $service = new $className(); - $service->uninstall(); - echo "Delete Service {$service->getName()}
"; - echo "Status of service ".$service->status()."
"; - } - } - - public function doInstallAll() { - $serverDetails = $this->getServices(); - foreach ($serverDetails as $serviceName) { - $className = OS.$serviceName; - require_once("../lib/services/service.php"); - require_once("../lib/services/".OS."Service.php"); - require_once("../lib/services/$className.php"); - $service = new $className(); - $service->load(); - $service->install(); - echo "Install Service {$service->getName()}
"; - echo "Status of service ".$service->status()."
"; - } - } - - public function doStatusAll() { - $serverDetails = $this->getServices(); - foreach ($serverDetails as $serviceName) { - $className = OS.$serviceName; - require_once("../lib/services/service.php"); - require_once("../lib/services/".OS."Service.php"); - require_once("../lib/services/$className.php"); - $service = new $className(); - $service->load(); - echo "{$service->getName()} : Status of service = ".$service->status()."
"; - } - } -} - -if(isset($_GET['action'])) { - $func = $_GET['action']; - if($func != '') { - $serv = new services(); - $func_call = strtoupper(substr($func,0,1)).substr($func,1); - $method = "do$func"; - $serv->$method(); - } -} -?> \ No newline at end of file +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package Installer +* @version Version 0.1 +*/ + +if(isset($_GET['action'])) { + $func = $_GET['action']; + if($func != '') { + require_once("../step.php"); + require_once("../installUtil.php"); + require_once("../path.php"); + } +} + +class services extends Step +{ + /** + * List of errors encountered + * + * @author KnowledgeTree Team + * @access protected + * @var array + */ + protected $error = array(); + + /** + * Flag if step needs to be installed + * + * @author KnowledgeTree Team + * @access protected + * @var array + */ + protected $runInstall = true; + + /** + * List of services to be installed + * + * @author KnowledgeTree Team + * @access private + * @var array + */ + private $services = array('Lucene', 'Scheduler', 'OpenOffice'); + + /** + * Path to php executable + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + protected $php; + + /** + * Flag if php already provided + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + public $providedPhp = false; + + /** + * PHP Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $phpCheck = 'cross_orange'; + + /** + * Flag, if php is specified and an error has been encountered + * + * @author KnowledgeTree Team + * @access public + * @var boolean + */ + private $phpExeError = false; + + /** + * Holds path error, if php is specified + * + * @author KnowledgeTree Team + * @access public + * @var string + */ + private $phpExeMessage = ''; + + /** + * Path to open office executable + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + protected $soffice; + + /** + * Flag if open office already provided + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + public $providedOpenOffice = false; + + /** + * Flag, if open office is specified and an error has been encountered + * + * @author KnowledgeTree Team + * @access public + * @var boolean + */ + private $openOfficeExeError = false; + + /** + * Holds path error, if open office is specified + * + * @author KnowledgeTree Team + * @access public + * @var string + */ + private $openOfficeExeMessage = ''; + + /** + * Path to java executable + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + protected $java = ""; + + /** + * Minumum Java Version + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $javaVersion = '1.5'; + + /** + * Java Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $javaCheck = 'cross'; + + /** + * Open Office Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $openOfficeCheck = 'cross'; + + /** + * Flag if java already provided + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + public $providedJava = false; + + /** + * Java Bridge Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $javaExtCheck = 'cross_orange'; + + /** + * Flag if bridge extension needs to be disabled + * + * @author KnowledgeTree Team + * @access public + * @var boolean + */ + private $disableExtension = false; + + /** + * Flag, if java is specified and an error has been encountered + * + * @author KnowledgeTree Team + * @access public + * @var booelean + */ + private $javaExeError = false; + + /** + * Holds path error, if java is specified + * + * @author KnowledgeTree Team + * @access public + * @var string + */ + private $javaExeMessage = ''; + + /** + * Flag if services are already Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $alreadyInstalled = false; + + /** + * Flag if services are already Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $luceneInstalled = false; + + /** + * Flag if services are already Installed + * + * @author KnowledgeTree Team + * @access private + * @var mixed + */ + private $schedulerInstalled = false; + + /** + * Path to php executable + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + private $openOfficeInstalled; + + /** + * Service Installed + * + * @author KnowledgeTree Team + * @access private + * @var array + */ + private $serviceCheck = 'tick'; + + /** + * Flag to store class information in session + * + * @author KnowledgeTree Team + * @access public + * @var boolean + */ + protected $storeInSession = true; + + /** + * List of variables to be loaded to template + * + * @author KnowledgeTree Team + * @access public + * @var array + */ + protected $temp_variables; + + /** + * Flag if step needs to run silently + * + * @author KnowledgeTree Team + * @access public + * @var array + */ + protected $silent = true; + + /** + * Reference to utility object + * + * @author KnowledgeTree Team + * @access protected + * @var string + */ + protected $util; + private $salt = 'installers'; + + /** + * Constructs services object + * + * @author KnowledgeTree Team + * @access public + * @param none + */ + public function __construct() { + $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent); + $this->util = new InstallUtil(); + } + + /** + * Main control of services setup + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return string + */ + public function doStep() + { + if(!$this->inStep("services")) { + $this->doRun(); + return 'landing'; + } + if($this->next()) { + // Check dependencies + $passed = $this->doRun(); + $serv = $this->getDataFromSession("services"); + if($passed || $serv['providedJava']) + return 'next'; + else + return 'error'; + } else if($this->previous()) { + return 'previous'; + } + $passed = $this->doRun(); + return 'landing'; + } + + /** + * Get service names + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return array + */ + public function getServices() { + return $this->services; + } + + /** + * Check if java executable was found + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return array + */ + private function setJava() { + if($this->java != '') { // Java JRE Found + $this->javaCheck = 'tick'; + $this->javaInstalled(); + $this->temp_variables['java']['location'] = $this->java; + return ; + } + + $this->temp_variables['java']['location'] = $this->java; + } + + /** + * Run step + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function doRun() { + if($this->alreadyInstalled()) { + $this->alreadyInstalled = true; + $this->serviceCheck = 'tick'; + } else { + $this->presetJava(); + $this->presetOpenOffice(); + if(!$this->schedulerInstalled) { + if(!WINDOWS_OS) $this->php = $this->util->getPhp(); // Get java, if it exists + $passedPhp = $this->phpChecks(); // Run Java Pre Checks + if ($passedPhp) { // Install Scheduler + $this->installService('Scheduler'); + } + } else { + $this->schedulerInstalled(); + } + if(!$this->luceneInstalled) { + if(!WINDOWS_OS) $this->java = $this->util->getJava(); // Get java, if it exists + $passedJava = $this->javaChecks(); // Run Java Pre Checks + if ($passedJava) { // Install Lucene + $this->installService('Lucene'); + } + } else { + $this->luceneInstalled(); + } + if(!$this->openOfficeInstalled) { + if(!WINDOWS_OS) $this->soffice = $this->util->getOpenOffice(); // Get java, if it exists + $passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks + if ($passedOpenOffice) { //Install OpenOffice +// $this->temp_variables['openOfficeExe'] = $this->soffice; + // TODO : Why, O, why? + $this->openOfficeExeError = false; + $_SESSION[$this->salt]['services']['openOfficeExe'] = $this->soffice; + $this->installService('OpenOffice'); + } + } else { + $this->openOfficeInstalled(); + } + } + $this->checkServiceStatus(); + $this->storeSilent(); // Store info needed for silent mode + if(!empty($errors)) + return false; + return true; + } + + private function openOfficeInstalled() { + $this->openOfficeExeError = false; + } + + private function schedulerInstalled() { + + } + + private function luceneInstalled() { + $this->disableExtension = true; // Disable the use of the php bridge extension + $this->javaVersionCorrect(); + $this->javaInstalled(); + $this->javaCheck = 'tick'; + } + + /** + * A final check to see if services are still running, + * incase they switched on and turned off. + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function checkServiceStatus() { + $serverDetails = $this->getServices(); + foreach ($serverDetails as $serviceName) { + $className = OS.$serviceName; + $service = new $className(); + $service->load(); + $status = $this->serviceInstalled($service); + if($status != 'STARTED') { + $msg = $service->getName()." Could not be added as a Service"; + $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg); + $this->serviceCheck = 'cross_orange'; + $this->warnings[] = $msg; + } else { + if(WINDOWS_OS) { + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); } + else { + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service"); + } + } + } + } + + /** + * Checks if all services have been started already, + * incase the user lands on service page multiple times + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return boolean + */ + public function alreadyInstalled() { + $allInstalled = true; + $serverDetails = $this->getServices(); + foreach ($serverDetails as $serviceName) { + $className = OS.$serviceName; + $service = new $className(); + $status = $this->serviceInstalled($service); + $flag = strtolower(substr($serviceName,0,1)).substr($serviceName,1)."Installed"; + if(!$status) { + $allInstalled = false; + $this->$flag = false; + } else { + $this->$flag = true; + } + } + + return $allInstalled; + } + + private function presetJava() { + $this->zendBridgeNotInstalled(); // Set bridge not installed + $this->javaVersionInCorrect(); // Set version to incorrect + $this->javaNotInstalled(); // Set java to not installed + $this->setJava(); // Check if java has been auto detected + } + + private function presetOpenOffice() { + $this->specifyOpenOffice(); + } + + private function setOpenOffice() { + + } + /** + * Do some basic checks to help the user overcome java problems + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function javaChecks() { + 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->useDetected(); // 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; + } + } + + private function openOfficeChecks() { + if($this->util->openOfficeSpecified()) { + $this->soffice = $this->util->openOfficeSpecified(); + if(file_exists($this->soffice)) + return true; + else + return false; + } else { + return false; + } + } + + /** + * Attempt detection without logging errors + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function useDetected() { + return $this->detSettings(); + } + + /** + * Set template view to specify java + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function specifyJava() { + $this->javaExeError = true; + } + + /** + * Set template view to specify php + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function specifyPhp() { + $this->phpExeError = true; + } + + /** + * Set template view to specify open office + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function specifyOpenOffice() { + $this->openOfficeExeError = true; + } + + private function phpChecks() { + // TODO: Better detection + return true; + $this->setPhp(); + if($this->util->phpSpecified()) { + return $this->detPhpSettings(); + } else { + $this->specifyPhp();// Ask for settings + return false; + } + } + + + + /** + * Attempts to use user input and configure java settings + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function detSettings($attempt = false) { + $javaExecutable = $this->util->javaSpecified();// Retrieve java bin + if($javaExecutable == '') { + if($this->java == '') { + return false; + } + $javaExecutable = $this->java; + } + $cmd = "\"$javaExecutable\" -version > output/outJV 2>&1 echo $!"; + $response = $this->util->pexec($cmd); + if(file_exists(OUTPUT_DIR.'outJV')) { + $tmp = file_get_contents(OUTPUT_DIR.'outJV'); + preg_match('/"(.*)"/',$tmp, $matches); + if($matches) { + if($matches[1] < $this->javaVersion) { // Check Version of java + $this->javaVersionInCorrect(); + $this->javaCheck = 'cross'; + $this->error[] = "Requires Java 1.5+ to be installed"; + + return false; + } else { + $this->javaVersionCorrect(); + $this->javaInstalled(); + $this->javaCheck = 'tick'; + $this->providedJava = true; + + return true; + } + } else { + $this->javaVersionWarning(); + $this->javaCheck = 'cross_orange'; + if($attempt) { + $this->javaExeMessage = "Incorrect java path specified"; + $this->javaExeError = true; + $this->error[] = "Requires Java 1.5+ to be installed"; + } + + + return false; + } + } + + $this->javaVersionInCorrect(); + $this->javaCheck = 'cross'; + $this->error[] = "Requires Java 1.5+ to be installed"; + return false; + } + + function detPhpSettings() { + // TODO: Better php handling + return true; + $phpExecutable = $this->util->phpSpecified();// Retrieve java bin + $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!"; + $response = $this->util->pexec($cmd); + if(file_exists(OUTPUT_DIR.'outPHP')) { + $tmp = file_get_contents(OUTPUT_DIR.'outPHP'); + preg_match('/PHP/',$tmp, $matches); + if($matches) { + $this->phpCheck = 'tick'; + + return true; + } else { + $this->phpCheck = 'cross_orange'; + $this->phpExeError = "PHP : Incorrect path specified"; + $this->error[] = "PHP executable required"; + + return false; + } + } + } + /** + * Attempts to use bridge and configure java settings + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function useBridge() { + $zendBridge = $this->util->zendBridge(); // Find Zend Bridge + if($zendBridge) { // Bridge installed implies java exists + $this->zendBridgeInstalled(); + if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional + $this->javaExtCheck = 'tick'; // Set bridge to functional + $this->javaInstalled(); // Set java to installed + $javaSystem = new Java('java.lang.System'); + $version = $javaSystem->getProperty('java.version'); + $ver = substr($version, 0, 3); + if($ver < $this->javaVersion) { + $this->javaVersionInCorrect(); + $this->error[] = "Requires Java 1.5+ to be installed"; + return false; + } else { + $this->javaVersionCorrect(); // Set version to correct + $this->javaCheck = 'tick'; + return true; + } + } else { + $this->javaCheck = 'cross_orange'; + $this->javaVersionWarning(); + $this->zendBridgeWarning(); + $this->warnings[] = "Zend Java Bridge Not Functional"; + $this->javaExtCheck = 'cross_orange'; + return false; + } + } else { + $this->warnings[] = "Zend Java Bridge Not Found"; + 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 + * @param none + * @access private + * @return boolean + */ + private function installServices() { + foreach ($this->getServices() as $serviceName) { + $this->installService($serviceName); + } + + return true; + } + + /** + * Installs services helper + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function installService($serviceName) { + $className = OS.$serviceName; + $service = new $className(); + $status = $this->serviceHelper($service); + if (!$status) { + $this->serviceCheck = 'cross_orange'; + } + } + + /** + * Installs services + * + * @author KnowledgeTree Team + * @param object + * @access private + * @return string + */ + private function serviceHelper($service) { + $service->load(); // Load Defaults + $response = $service->install(); // Install service + $statusCheck = OS."ServiceInstalled"; + return $this->$statusCheck($service); + } + + /** + * Helper to check if service is installed + * + * @author KnowledgeTree Team + * @param object + * @access public + * @return string + */ + public function serviceInstalled($service) { + $statusCheck = OS."ServiceInstalled"; + return $this->$statusCheck($service); + } + + /** + * Helper to check if service is started + * + * @author KnowledgeTree Team + * @param object + * @access public + * @return string + */ + public function serviceStarted($service) { + $statusCheck = OS."ServiceStarted"; + return $this->$statusCheck($service); + } + + /** + * Check if windows service installed + * + * @author KnowledgeTree Team + * @param object + * @access public + * @return boolean + */ + public function windowsServiceStarted($service) { + $status = $service->status(); // Check if service has been installed + if($status != 'RUNNING') { // Check service status + return false; + } + return true; + } + + /** + * Check if unix service installed + * + * @author KnowledgeTree Team + * @param object + * @access public + * @return boolean + */ + public function unixServiceStarted($service) { + $status = $service->status(); // Check if service has been installed + if($status != 'STARTED') { // Check service status + return false; + } + return true; + } + + /** + * Check if windows service installed + * + * @author KnowledgeTree Team + * @param object + * @access public + * @return boolean + */ + public function windowsServiceInstalled($service) { + $status = $service->status(); // Check if service has been installed + if($status == '') { // Check service status + return false; + } + return true; + } + + /** + * Check if unix service installed + * + * @author KnowledgeTree Team + * @param object + * @access public + * @return boolean + */ + public function unixServiceInstalled($service) { + $status = $service->status(); // Check if service has been installed + if($status != 'STARTED') { // Check service status + return false; + } + return true; + } + + /** + * Starts all services + * + * @author KnowledgeTree Team + * @param object + * @access public + * @return mixed + */ + public function installStep() { + foreach ($this->getServices() as $serviceName) { + $className = OS.$serviceName; + $service = new $className(); + $status = $this->serviceStart($service); + } + return true; + } + + /** + * Starts service + * + * @author KnowledgeTree Team + * @param object + * @access private + * @return string + */ + private function serviceStart($service) { + if(OS == 'windows') { + $service->load(); // Load Defaults + $service->start(); // Start Service + return $service->status(); // Get service status + } + } + + /** + * Returns services errors + * + * @author KnowledgeTree Team + * @access public + * @params none + * @return array + */ + public function getErrors() { + 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 + * + * @author KnowledgeTree Team + * @access public + * @return array + */ + public function getStepVars() + { + return $this->temp_variables; + } + + /** + * Store Java state as installed + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function javaInstalled() { + $this->temp_variables['java']['class'] = 'tick'; + $this->temp_variables['java']['found'] = "Java Runtime Installed"; + } + + /** + * Store Java state as not installed + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function javaNotInstalled() { + $this->temp_variables['java']['class'] = 'cross'; + $this->temp_variables['java']['found'] = "Java runtime environment required"; + } + + /** + * Store Java version state as correct + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function javaVersionCorrect() { + $this->temp_variables['version']['class'] = 'tick'; + $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed"; + } + + /** + * Store Java version state as warning + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function javaVersionWarning() { + $this->temp_variables['version']['class'] = 'cross_orange'; + $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected"; + } + + /** + * Store Java version as state incorrect + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function javaVersionInCorrect() { + $this->temp_variables['version']['class'] = 'cross'; + $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed"; + } + + /** + * Store Zend Bridge state as installed + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function zendBridgeInstalled() { + $this->temp_variables['extensions']['class'] = 'tick'; + $this->temp_variables['extensions']['found'] = "Java Bridge Installed"; + } + + /** + * Store Zend Bridge state as not installed + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function zendBridgeNotInstalled() { + $this->temp_variables['extensions']['class'] = 'cross_orange'; + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed"; + } + + /** + * Store Zend Bridge state as warning + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function zendBridgeWarning() { + $this->temp_variables['extensions']['class'] = 'cross_orange'; + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional"; + } + + /** + * Set all silent mode varibles + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return void + */ + private function storeSilent() { + // Servics + $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled; + $this->temp_variables['luceneInstalled'] = $this->luceneInstalled; + $this->temp_variables['schedulerInstalled'] = $this->schedulerInstalled; + $this->temp_variables['openOfficeInstalled'] = $this->openOfficeInstalled; + // Java + $this->temp_variables['javaExeError'] = $this->javaExeError; + $this->temp_variables['javaExeMessage'] = $this->javaExeMessage; + $this->temp_variables['javaCheck'] = $this->javaCheck; + $this->temp_variables['javaExtCheck'] = $this->javaExtCheck; + // Open Office + $this->temp_variables['openOfficeExeError'] = $this->openOfficeExeError; + $this->temp_variables['openOfficeExeMessage'] = $this->openOfficeExeMessage; + // TODO : PHP detection + $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck; + $this->temp_variables['phpExeError'] = '';//$this->phpExeError; + $this->temp_variables['serviceCheck'] = $this->serviceCheck; + $this->temp_variables['disableExtension'] = $this->disableExtension; + // TODO: Java checks are gettign intense + $this->temp_variables['providedJava'] = $this->providedJava; + } + + private function setPhp() { + if($this->php != '') { // PHP Found + $this->phpCheck = 'tick'; + } elseif (PHP_DIR != '') { // Use System Defined Settings + $this->php = PHP_DIR; + } else { + + } + $this->temp_variables['php']['location'] = $this->php; + } + + public function getPhpDir() { + return $this->php; + } + + public function doDeleteAll() { + $serverDetails = $this->getServices(); + foreach ($serverDetails as $serviceName) { + $className = OS.$serviceName; + require_once("../lib/services/service.php"); + require_once("../lib/services/".OS."Service.php"); + require_once("../lib/services/$className.php"); + $service = new $className(); + $service->uninstall(); + echo "Delete Service {$service->getName()}
"; + echo "Status of service ".$service->status()."
"; + } + } + + public function doInstallAll() { + $serverDetails = $this->getServices(); + foreach ($serverDetails as $serviceName) { + $className = OS.$serviceName; + require_once("../lib/services/service.php"); + require_once("../lib/services/".OS."Service.php"); + require_once("../lib/services/$className.php"); + $service = new $className(); + $service->load(); + $service->install(); + echo "Install Service {$service->getName()}
"; + echo "Status of service ".$service->status()."
"; + } + } + + public function doStatusAll() { + $serverDetails = $this->getServices(); + foreach ($serverDetails as $serviceName) { + $className = OS.$serviceName; + require_once("../lib/services/service.php"); + require_once("../lib/services/".OS."Service.php"); + require_once("../lib/services/$className.php"); + $service = new $className(); + $service->load(); + echo "{$service->getName()} : Status of service = ".$service->status()."
"; + } + } +} + +if(isset($_GET['action'])) { + $func = $_GET['action']; + if($func != '') { + $serv = new services(); + $func_call = strtoupper(substr($func,0,1)).substr($func,1); + $method = "do$func"; + $serv->$method(); + } +} +?> diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl index cf1a452..ddc30ae 100644 --- a/setup/wizard/templates/complete.tpl +++ b/setup/wizard/templates/complete.tpl @@ -13,115 +13,115 @@ } ?>
- -
-

     "; ?>Paths and Permissions

- -
Show Details
-
     "; ?> Lucene Service Could not be started Started Lucene Service Could not be stopped Stopped Refresh
     "; ?> Scheduler Service Could not be started Started Scheduler Service Could not be stopped Stopped Refresh
     "; ?> OpenOffice Service Could not be started Started OpenOffice Service Could not be stopped Stopped Refresh
- - - - - - - -
- + +
+

     "; ?>Paths and Permissions

+ +
Show Details
+ +
- - -

-
- -

     "; ?>Database connectivity

- -
Show Details
- - -

- -

     "; ?>Privileges

- -
Show Details
- - Goto Login + Goto Login - " class="back" target="_blank">Zend Server Configuration + " class="back" target="_blank" onclick="javascript:{w.clearSessions();}">Zend Server Configuration diff --git a/setup/wizard/templates/configuration.tpl b/setup/wizard/templates/configuration.tpl index dfd61dc..233879f 100644 --- a/setup/wizard/templates/configuration.tpl +++ b/setup/wizard/templates/configuration.tpl @@ -118,4 +118,4 @@ - \ No newline at end of file + diff --git a/setup/wizard/templates/configuration_confirm.tpl b/setup/wizard/templates/configuration_confirm.tpl index 5de48f2..ac24285 100644 --- a/setup/wizard/templates/configuration_confirm.tpl +++ b/setup/wizard/templates/configuration_confirm.tpl @@ -94,4 +94,4 @@ - \ No newline at end of file + diff --git a/setup/wizard/templates/registration.tpl b/setup/wizard/templates/registration.tpl index 0288c30..f79185c 100644 --- a/setup/wizard/templates/registration.tpl +++ b/setup/wizard/templates/registration.tpl @@ -3,6 +3,7 @@
+

Registering KnowledgeTree