Commit 1c86d114bb3a63a1cad68d23e0e4984a353fa06c

Authored by conradverm
1 parent dc143488

KTS-3187

"Problem with opendir() in windows under indexerCore"
Fixed. 

Committed By: Conrad Vermeulen
Reviewed By: Martin Kirsten

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8292 c91229c3-7414-0410-bfa2-8a42b809f60b
search2/indexing/indexerCore.inc.php
... ... @@ -612,8 +612,8 @@ abstract class Indexer
612 612 $this->generalHookCache = array();
613 613 $this->mimeHookCache = array();
614 614  
615   - $this->hookPath = str_replace('\\','/', $this->hookPath);
616   - $dir = opendir($this->hookPath);
  615 +
  616 + $dir = opendir(SearchHelper::correctPath($this->hookPath));
617 617 while (($file = readdir($dir)) !== false)
618 618 {
619 619 if (substr($file,-12) == 'Hook.inc.php')
... ... @@ -1374,8 +1374,7 @@ abstract class Indexer
1374 1374  
1375 1375 $diagnoses = array();
1376 1376  
1377   - $path = str_replace('\\','/', $path);
1378   - $dir = opendir($path);
  1377 + $dir = opendir(SearchHelper::correctPath($path));
1379 1378 $extlen = - strlen($extension);
1380 1379  
1381 1380 while (($file = readdir($dir)) !== false)
... ... @@ -1447,8 +1446,7 @@ abstract class Indexer
1447 1446 {
1448 1447 $this->clearExtractors();
1449 1448 }
1450   - $this->extractorPath = str_replace('\\','/', $this->extractorPath);
1451   - $dir = opendir($this->extractorPath);
  1449 + $dir = opendir(SearchHelper::correctPath($this->extractorPath));
1452 1450 while (($file = readdir($dir)) !== false)
1453 1451 {
1454 1452 if (substr($file,-17) == 'Extractor.inc.php')
... ...
search2/search/fieldRegistry.inc.php
... ... @@ -223,8 +223,7 @@ class ExprFieldRegistry
223 223 {
224 224 $this->fields = array();
225 225  
226   - $this->path = str_replace('\\','/', $this->path);
227   - $dir = opendir($this->path);
  226 + $dir = opendir(SearchHelper::correctPath($this->path));
228 227 while (($file = readdir($dir)) !== false)
229 228 {
230 229 if (substr($file,-13) == 'Field.inc.php')
... ...
search2/search/search.inc.php
... ... @@ -62,6 +62,18 @@ function search_alias_compare($a, $b)
62 62  
63 63 class SearchHelper
64 64 {
  65 + public static function correctPath($path)
  66 + {
  67 + if (OS_WINDOWS)
  68 + {
  69 + return str_replace('/','\\', $path);
  70 + }
  71 + else
  72 + {
  73 + return str_replace('\\','/', $path);
  74 + }
  75 + }
  76 +
65 77 public static function checkOpenOfficeAvailablity()
66 78 {
67 79 $config =& KTConfig::getSingleton();
... ...