From 506cca0dddd4626e50db098f4376ed2d2d2cc03c Mon Sep 17 00:00:00 2001 From: Conrad Vermeulen Date: Mon, 22 Oct 2007 13:47:48 +0000 Subject: [PATCH] KTS-2529 "Test open office document extractor" Updated. Extended KTUtil::findCommand to resolve python, php, and java in the stack --- lib/util/ktutil.inc | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+), 0 deletions(-) diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index dcdd44e..99e9fbe 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -557,6 +557,12 @@ class KTUtil { return $sCommand . ".exe"; } + $result = KTUtil::checkForStackCommand($sConfigVar); + if (!empty($result)) + { + return $result; + } + $sExecSearchPath = $oKTConfig->get("KnowledgeTree/execSearchPath"); $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../common/"; $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/xpdf/"; @@ -578,6 +584,47 @@ class KTUtil { } // }}} + function checkForStackCommand($configCommand) + { + $config = KTConfig::getSingleton(); + $stackPath = realpath(KT_DIR . '/..'); + + switch ($configCommand) + { + case 'externalBinary/php': + if (OS_WINDOWS) + { + $script = $stackPath . '/php/php.exe'; + } + else + { + $script = $stackPath . '/php/bin/php'; + } + break; + case 'externalBinary/python': + if (OS_WINDOWS) + { + $script = $stackPath . '/openoffice/openoffice/program/python.bat'; + } + else + { + $script = $stackPath . '/openoffice/program/python'; + } + break; + case 'externalBinary/java': + $script = $stackPath . '/j2re/bin/java'; + break; + default: + return null; + } + if (is_file($script)) + { + return $script; + } + return false; + } + + // now accepts strings OR arrays! // {{{ addQueryString static function addQueryString($url, $qs) { -- libgit2 0.21.4