From 1c86d114bb3a63a1cad68d23e0e4984a353fa06c Mon Sep 17 00:00:00 2001 From: conradverm Date: Thu, 20 Mar 2008 12:17:38 +0000 Subject: [PATCH] KTS-3187 "Problem with opendir() in windows under indexerCore" Fixed. --- search2/indexing/indexerCore.inc.php | 10 ++++------ search2/search/fieldRegistry.inc.php | 3 +-- search2/search/search.inc.php | 12 ++++++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/search2/indexing/indexerCore.inc.php b/search2/indexing/indexerCore.inc.php index a3297b9..0d99ab1 100755 --- a/search2/indexing/indexerCore.inc.php +++ b/search2/indexing/indexerCore.inc.php @@ -612,8 +612,8 @@ abstract class Indexer $this->generalHookCache = array(); $this->mimeHookCache = array(); - $this->hookPath = str_replace('\\','/', $this->hookPath); - $dir = opendir($this->hookPath); + + $dir = opendir(SearchHelper::correctPath($this->hookPath)); while (($file = readdir($dir)) !== false) { if (substr($file,-12) == 'Hook.inc.php') @@ -1374,8 +1374,7 @@ abstract class Indexer $diagnoses = array(); - $path = str_replace('\\','/', $path); - $dir = opendir($path); + $dir = opendir(SearchHelper::correctPath($path)); $extlen = - strlen($extension); while (($file = readdir($dir)) !== false) @@ -1447,8 +1446,7 @@ abstract class Indexer { $this->clearExtractors(); } - $this->extractorPath = str_replace('\\','/', $this->extractorPath); - $dir = opendir($this->extractorPath); + $dir = opendir(SearchHelper::correctPath($this->extractorPath)); while (($file = readdir($dir)) !== false) { if (substr($file,-17) == 'Extractor.inc.php') diff --git a/search2/search/fieldRegistry.inc.php b/search2/search/fieldRegistry.inc.php index 0d6d9e6..1ef4d44 100755 --- a/search2/search/fieldRegistry.inc.php +++ b/search2/search/fieldRegistry.inc.php @@ -223,8 +223,7 @@ class ExprFieldRegistry { $this->fields = array(); - $this->path = str_replace('\\','/', $this->path); - $dir = opendir($this->path); + $dir = opendir(SearchHelper::correctPath($this->path)); while (($file = readdir($dir)) !== false) { if (substr($file,-13) == 'Field.inc.php') diff --git a/search2/search/search.inc.php b/search2/search/search.inc.php index 65c79f5..84e7f5d 100755 --- a/search2/search/search.inc.php +++ b/search2/search/search.inc.php @@ -62,6 +62,18 @@ function search_alias_compare($a, $b) class SearchHelper { + public static function correctPath($path) + { + if (OS_WINDOWS) + { + return str_replace('/','\\', $path); + } + else + { + return str_replace('\\','/', $path); + } + } + public static function checkOpenOfficeAvailablity() { $config =& KTConfig::getSingleton(); -- libgit2 0.21.4