From b19603ade46bb28f4fcdc73883c4030502ce1523 Mon Sep 17 00:00:00 2001 From: conradverm Date: Mon, 12 Nov 2007 07:27:36 +0000 Subject: [PATCH] KTS-2647 "Folder utilisation dashlet should get the indexer location from the indexer and not from the config.ini" Fixed. --- plugins/housekeeper/HouseKeeperPlugin.php | 11 ++++++++++- search2/indexing/indexerCore.inc.php | 12 ++++++++++++ search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php | 15 +++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/plugins/housekeeper/HouseKeeperPlugin.php b/plugins/housekeeper/HouseKeeperPlugin.php index 57468b9..1baae44 100755 --- a/plugins/housekeeper/HouseKeeperPlugin.php +++ b/plugins/housekeeper/HouseKeeperPlugin.php @@ -53,7 +53,9 @@ class HouseKeeperPlugin extends KTPlugin $cacheDir = $config->get('cache/cacheDirectory'); $logDir = $config->get('urls/logDirectory'); $docsDir = $config->get('urls/documentRoot'); - $luceneDir = $config->get('indexer/luceneDirectory'); + + $indexer = Indexer::get(); + $luceneDir = $indexer->getIndexDirectory(); $systemDir = OS_UNIX?'/tmp':'c:/windows/temp'; @@ -85,6 +87,8 @@ class HouseKeeperPlugin extends KTPlugin 'canClean'=>true ); + if (is_dir($docsDir)) + { $this->folders[] = array( 'name'=>_kt('KnowledgeTree Documents'), @@ -92,6 +96,10 @@ class HouseKeeperPlugin extends KTPlugin 'pattern'=>'', 'canClean'=>false ); + } + + if (is_dir($luceneDir)) + { $this->folders[] = array( 'name'=>_kt('KnowledgeTree Document Index'), @@ -99,6 +107,7 @@ class HouseKeeperPlugin extends KTPlugin 'pattern'=>'', 'canClean'=>false ); + } } diff --git a/search2/indexing/indexerCore.inc.php b/search2/indexing/indexerCore.inc.php index f82443d..183d90b 100755 --- a/search2/indexing/indexerCore.inc.php +++ b/search2/indexing/indexerCore.inc.php @@ -1343,6 +1343,18 @@ abstract class Indexer * @return int */ public abstract function getDocumentsInIndex(); + + /** + * Returns the path to the index directory + * + * @return string + */ + public function getIndexDirectory() + { + $config = KTConfig::getSingleton(); + $directory = $config->get('indexer/luceneDirectory'); + return $directory; + } } ?> \ No newline at end of file diff --git a/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php b/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php index b354531..b1136a7 100755 --- a/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php +++ b/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php @@ -250,5 +250,20 @@ class JavaXMLRPCLuceneIndexer extends Indexer return $stats->countDocuments; } + /** + * Returns the path to the index directory + * + * @return string + */ + public function getIndexDirectory() + { + $stats = $this->lucene->getStatistics(); + if ($stats === false || !is_object($stats)) + { + return false; + } + return $stats->indexDirectory; + } + } ?> \ No newline at end of file -- libgit2 0.21.4