Commit 1b225911b1a9fcb673efca1af07cd8a7744a4641

Authored by kevin_fourie
1 parent 59523eab

KTS-2074

"Indexer Status dashlet is saying it can't find any of the indexer commands on a default install."
Fixed.

Committed By: Kevin
Reviewed By: Conrad

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@6714 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 30 additions and 16 deletions
lib/util/ktutil.inc
@@ -467,22 +467,36 @@ class KTUtil { @@ -467,22 +467,36 @@ class KTUtil {
467 467
468 // {{{ findCommand 468 // {{{ findCommand
469 function findCommand($sConfigVar, $sDefault = null) { 469 function findCommand($sConfigVar, $sDefault = null) {
470 - $oKTConfig =& KTConfig::getSingleton();  
471 - $sCommand = $oKTConfig->get($sConfigVar, $sDefault);  
472 - if (empty($sCommand)) {  
473 - return false;  
474 - }  
475 - if (file_exists($sCommand)) {  
476 - return $sCommand;  
477 - }  
478 - $sExecSearchPath = $oKTConfig->get("KnowledgeTree/execSearchPath");  
479 - $paths = split(PATH_SEPARATOR, $sExecSearchPath);  
480 - foreach ($paths as $path) {  
481 - if (file_exists($path . '/' . $sCommand)) {  
482 - return $path . '/' . $sCommand;  
483 - }  
484 - }  
485 - return false; 470 + $oKTConfig =& KTConfig::getSingleton();
  471 + $sCommand = $oKTConfig->get($sConfigVar, $sDefault);
  472 + if (empty($sCommand)) {
  473 + return false;
  474 + }
  475 + if (file_exists($sCommand)) {
  476 + return $sCommand;
  477 + }
  478 + if (file_exists($sCommand . ".exe")) {
  479 + return $sCommand . ".exe";
  480 + }
  481 +
  482 + $sExecSearchPath = $oKTConfig->get("KnowledgeTree/execSearchPath");
  483 + $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../common/";
  484 + $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/xpdf/";
  485 + $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/antiword/";
  486 + $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/zip/";
  487 + $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/unzip/";
  488 +
  489 + $paths = split(PATH_SEPARATOR, $sExecSearchPath);
  490 + foreach ($paths as $path) {
  491 +
  492 + if (file_exists($path . '/' . $sCommand)) {
  493 + return $path . '/' . $sCommand;
  494 + }
  495 + if (file_exists($path . '/' . $sCommand . ".exe")) {
  496 + return $path . '/' . $sCommand . ".exe";
  497 + }
  498 + }
  499 + return false;
486 } 500 }
487 // }}} 501 // }}}
488 502