Commit 96c50621e8b90aeb30b41f5776b7ebb71ac505e5
1 parent
6899f2f0
KTS-2811
"KnowledgeTree Indexer plugin not indexing in 3.4.5 on a windows machine" Updated. Reverted and applied only the winexec function. Committed by: Kevin Fourie Reviewed by: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.4.6-Release-Branch@7930 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
16 additions
and
50 deletions
lib/util/ktutil.inc
| @@ -206,14 +206,27 @@ class KTUtil { | @@ -206,14 +206,27 @@ class KTUtil { | ||
| 206 | $aOutput = array(); | 206 | $aOutput = array(); |
| 207 | $iRet = ''; | 207 | $iRet = ''; |
| 208 | 208 | ||
| 209 | - exec($sCmd, $aOutput, $iRet); | 209 | + if (OS_WINDOWS){ |
| 210 | + $wait = false; | ||
| 211 | + if(isset($aOptions['exec_wait']) && ($aOptions['exec_wait'] == 'true')){ | ||
| 212 | + $wait = true; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + $WshShell = new COM("WScript.Shell"); | ||
| 216 | + $res = $WshShell->Run($sCmd, 0, $wait); | ||
| 217 | + | ||
| 218 | + $iRet = 0; | ||
| 219 | + $aOutput = array($res); | ||
| 220 | + }else{ | ||
| 221 | + exec($sCmd, $aOutput, $iRet); | ||
| 222 | + } | ||
| 223 | + | ||
| 210 | $aRet['ret'] = $iRet; | 224 | $aRet['ret'] = $iRet; |
| 211 | $aRet['out'] = $aOutput; | 225 | $aRet['out'] = $aOutput; |
| 212 | return $aRet; | 226 | return $aRet; |
| 213 | } | 227 | } |
| 214 | // }}} | 228 | // }}} |
| 215 | - | ||
| 216 | - | 229 | + |
| 217 | // {{{ winexec | 230 | // {{{ winexec |
| 218 | /** | 231 | /** |
| 219 | * Execute a command on a windows platform. | 232 | * Execute a command on a windows platform. |
| @@ -529,12 +542,6 @@ class KTUtil { | @@ -529,12 +542,6 @@ class KTUtil { | ||
| 529 | return $sCommand . ".exe"; | 542 | return $sCommand . ".exe"; |
| 530 | } | 543 | } |
| 531 | 544 | ||
| 532 | - $result = KTUtil::checkForStackCommand($sConfigVar); | ||
| 533 | - if (!empty($result)) | ||
| 534 | - { | ||
| 535 | - return $result; | ||
| 536 | - } | ||
| 537 | - | ||
| 538 | $sExecSearchPath = $oKTConfig->get("KnowledgeTree/execSearchPath"); | 545 | $sExecSearchPath = $oKTConfig->get("KnowledgeTree/execSearchPath"); |
| 539 | $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../common/"; | 546 | $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../common/"; |
| 540 | $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/xpdf/"; | 547 | $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/xpdf/"; |
| @@ -556,47 +563,6 @@ class KTUtil { | @@ -556,47 +563,6 @@ class KTUtil { | ||
| 556 | } | 563 | } |
| 557 | // }}} | 564 | // }}} |
| 558 | 565 | ||
| 559 | - function checkForStackCommand($configCommand) | ||
| 560 | - { | ||
| 561 | - $config = KTConfig::getSingleton(); | ||
| 562 | - $stackPath = realpath(KT_DIR . '/..'); | ||
| 563 | - | ||
| 564 | - switch ($configCommand) | ||
| 565 | - { | ||
| 566 | - case 'externalBinary/php': | ||
| 567 | - if (OS_WINDOWS) | ||
| 568 | - { | ||
| 569 | - $script = $stackPath . '/php/php.exe'; | ||
| 570 | - } | ||
| 571 | - else | ||
| 572 | - { | ||
| 573 | - $script = $stackPath . '/php/bin/php'; | ||
| 574 | - } | ||
| 575 | - break; | ||
| 576 | - case 'externalBinary/python': | ||
| 577 | - if (OS_WINDOWS) | ||
| 578 | - { | ||
| 579 | - $script = $stackPath . '/openoffice/openoffice/program/python.bat'; | ||
| 580 | - } | ||
| 581 | - else | ||
| 582 | - { | ||
| 583 | - $script = $stackPath . '/openoffice/program/python'; | ||
| 584 | - } | ||
| 585 | - break; | ||
| 586 | - case 'externalBinary/java': | ||
| 587 | - $script = $stackPath . '/j2re/bin/java'; | ||
| 588 | - break; | ||
| 589 | - default: | ||
| 590 | - return null; | ||
| 591 | - } | ||
| 592 | - if (is_file($script)) | ||
| 593 | - { | ||
| 594 | - return $script; | ||
| 595 | - } | ||
| 596 | - return false; | ||
| 597 | - } | ||
| 598 | - | ||
| 599 | - | ||
| 600 | // now accepts strings OR arrays! | 566 | // now accepts strings OR arrays! |
| 601 | // {{{ addQueryString | 567 | // {{{ addQueryString |
| 602 | function addQueryString($url, $qs) { | 568 | function addQueryString($url, $qs) { |