Commit 506cca0dddd4626e50db098f4376ed2d2d2cc03c

Authored by Conrad Vermeulen
1 parent d5aeb776

KTS-2529

"Test open office document extractor"
Updated. Extended KTUtil::findCommand to resolve python, php, and java in the stack

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7448 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 47 additions and 0 deletions
lib/util/ktutil.inc
... ... @@ -557,6 +557,12 @@ class KTUtil {
557 557 return $sCommand . ".exe";
558 558 }
559 559  
  560 + $result = KTUtil::checkForStackCommand($sConfigVar);
  561 + if (!empty($result))
  562 + {
  563 + return $result;
  564 + }
  565 +
560 566 $sExecSearchPath = $oKTConfig->get("KnowledgeTree/execSearchPath");
561 567 $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../common/";
562 568 $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/xpdf/";
... ... @@ -578,6 +584,47 @@ class KTUtil {
578 584 }
579 585 // }}}
580 586  
  587 + function checkForStackCommand($configCommand)
  588 + {
  589 + $config = KTConfig::getSingleton();
  590 + $stackPath = realpath(KT_DIR . '/..');
  591 +
  592 + switch ($configCommand)
  593 + {
  594 + case 'externalBinary/php':
  595 + if (OS_WINDOWS)
  596 + {
  597 + $script = $stackPath . '/php/php.exe';
  598 + }
  599 + else
  600 + {
  601 + $script = $stackPath . '/php/bin/php';
  602 + }
  603 + break;
  604 + case 'externalBinary/python':
  605 + if (OS_WINDOWS)
  606 + {
  607 + $script = $stackPath . '/openoffice/openoffice/program/python.bat';
  608 + }
  609 + else
  610 + {
  611 + $script = $stackPath . '/openoffice/program/python';
  612 + }
  613 + break;
  614 + case 'externalBinary/java':
  615 + $script = $stackPath . '/j2re/bin/java';
  616 + break;
  617 + default:
  618 + return null;
  619 + }
  620 + if (is_file($script))
  621 + {
  622 + return $script;
  623 + }
  624 + return false;
  625 + }
  626 +
  627 +
581 628 // now accepts strings OR arrays!
582 629 // {{{ addQueryString
583 630 static function addQueryString($url, $qs) {
... ...