Commit a292c30fb6659078a5a48435b6e2fb509fbcb5ab

Authored by Megan Watson
1 parent 0d571b5a

On unix the destination directory should be the var directory. Added indexes to …

…the end of the path in the KnowledgeTreeIndexer.properties file
PT: 1838493
    
Committed by: Megan Watson
Reviewed by: Paul Barrett
setup/wizard/lib/services/unixLucene.php
1 <?php 1 <?php
2 /** 2 /**
3 -* Unix Lucene Service Controller. 3 +* Unix Lucene Service Controller.
4 * 4 *
5 * KnowledgeTree Community Edition 5 * KnowledgeTree Community Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
@@ -51,7 +51,7 @@ class unixLucene extends unixService { @@ -51,7 +51,7 @@ class unixLucene extends unixService {
51 private $javaXmx; 51 private $javaXmx;
52 public $name = "KTLucene"; 52 public $name = "KTLucene";
53 public $hrname = "KnowledgeTree Indexer Service"; 53 public $hrname = "KnowledgeTree Indexer Service";
54 - 54 +
55 /** 55 /**
56 * Load defaults needed by service 56 * Load defaults needed by service
57 * 57 *
@@ -70,76 +70,76 @@ class unixLucene extends unixService { @@ -70,76 +70,76 @@ class unixLucene extends unixService {
70 $this->setLuceneSourceLoc("ktlucene.jar"); 70 $this->setLuceneSourceLoc("ktlucene.jar");
71 $this->setShutdownScript("shutdown.php"); 71 $this->setShutdownScript("shutdown.php");
72 } 72 }
73 -  
74 - 73 +
  74 +
75 public function setIndexerDir($indexerDir) { 75 public function setIndexerDir($indexerDir) {
76 $this->indexerDir = $indexerDir; 76 $this->indexerDir = $indexerDir;
77 } 77 }
78 - 78 +
79 private function getIndexerDir() { 79 private function getIndexerDir() {
80 return $this->indexerDir; 80 return $this->indexerDir;
81 } 81 }
82 - 82 +
83 private function setShutdownScript($shutdownScript) { 83 private function setShutdownScript($shutdownScript) {
84 $this->shutdownScript = $shutdownScript; 84 $this->shutdownScript = $shutdownScript;
85 } 85 }
86 - 86 +
87 public function getShutdownScript() { 87 public function getShutdownScript() {
88 return $this->shutdownScript; 88 return $this->shutdownScript;
89 } 89 }
90 - 90 +
91 private function setLucenePidFile($lucenePidFile) { 91 private function setLucenePidFile($lucenePidFile) {
92 $this->lucenePidFile = $lucenePidFile; 92 $this->lucenePidFile = $lucenePidFile;
93 } 93 }
94 - 94 +
95 private function getLucenePidFile() { 95 private function getLucenePidFile() {
96 return $this->lucenePidFile; 96 return $this->lucenePidFile;
97 } 97 }
98 - 98 +
99 private function setLuceneDir($luceneDir) { 99 private function setLuceneDir($luceneDir) {
100 $this->luceneDir = $luceneDir; 100 $this->luceneDir = $luceneDir;
101 } 101 }
102 - 102 +
103 public function getLuceneDir() { 103 public function getLuceneDir() {
104 return $this->luceneDir; 104 return $this->luceneDir;
105 } 105 }
106 - 106 +
107 private function setJavaXms($javaXms) { 107 private function setJavaXms($javaXms) {
108 $this->javaXms = "-Xms$javaXms"; 108 $this->javaXms = "-Xms$javaXms";
109 } 109 }
110 - 110 +
111 public function getJavaXms() { 111 public function getJavaXms() {
112 return $this->javaXms; 112 return $this->javaXms;
113 } 113 }
114 - 114 +
115 private function setJavaXmx($javaXmx) { 115 private function setJavaXmx($javaXmx) {
116 $this->javaXmx = "-Xmx$javaXmx"; 116 $this->javaXmx = "-Xmx$javaXmx";
117 } 117 }
118 - 118 +
119 public function getJavaXmx() { 119 public function getJavaXmx() {
120 return $this->javaXmx; 120 return $this->javaXmx;
121 } 121 }
122 - 122 +
123 private function setLuceneSource($luceneSource) { 123 private function setLuceneSource($luceneSource) {
124 $this->luceneSource = $luceneSource; 124 $this->luceneSource = $luceneSource;
125 } 125 }
126 - 126 +
127 public function getLuceneSource() { 127 public function getLuceneSource() {
128 return $this->luceneSource; 128 return $this->luceneSource;
129 } 129 }
130 - 130 +
131 private function setLuceneSourceLoc($luceneSourceLoc) { 131 private function setLuceneSourceLoc($luceneSourceLoc) {
132 $this->luceneSourceLoc = $this->getLuceneDir().$luceneSourceLoc; 132 $this->luceneSourceLoc = $this->getLuceneDir().$luceneSourceLoc;
133 } 133 }
134 - 134 +
135 public function getLuceneSourceLoc() { 135 public function getLuceneSourceLoc() {
136 return $this->luceneSourceLoc; 136 return $this->luceneSourceLoc;
137 } 137 }
138 - 138 +
139 public function getJavaOptions() { 139 public function getJavaOptions() {
140 return " {$this->getJavaXmx()} {$this->getJavaXmx()} -jar "; 140 return " {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ";
141 } 141 }
142 - 142 +
143 /** 143 /**
144 * Stop Service 144 * Stop Service
145 * 145 *
@@ -157,7 +157,7 @@ class unixLucene extends unixService { @@ -157,7 +157,7 @@ class unixLucene extends unixService {
157 } 157 }
158 return $state; 158 return $state;
159 } 159 }
160 - 160 +
161 public function install() { 161 public function install() {
162 $status = $this->status(); 162 $status = $this->status();
163 if($status == '') { 163 if($status == '') {
@@ -166,7 +166,7 @@ class unixLucene extends unixService { @@ -166,7 +166,7 @@ class unixLucene extends unixService {
166 return $status; 166 return $status;
167 } 167 }
168 } 168 }
169 - 169 +
170 public function status() { 170 public function status() {
171 $cmd = "ps ax | grep ".$this->getLuceneSource(); 171 $cmd = "ps ax | grep ".$this->getLuceneSource();
172 $response = $this->util->pexec($cmd); 172 $response = $this->util->pexec($cmd);
@@ -183,14 +183,14 @@ class unixLucene extends unixService { @@ -183,14 +183,14 @@ class unixLucene extends unixService {
183 return ''; 183 return '';
184 } 184 }
185 } 185 }
186 - 186 +
187 return ''; 187 return '';
188 } 188 }
189 - 189 +
190 public function uninstall() { 190 public function uninstall() {
191 $this->stop(); 191 $this->stop();
192 } 192 }
193 - 193 +
194 /** 194 /**
195 * Start Service 195 * Start Service
196 * 196 *
@@ -213,26 +213,26 @@ class unixLucene extends unixService { @@ -213,26 +213,26 @@ class unixLucene extends unixService {
213 // return false; 213 // return false;
214 // } 214 // }
215 //$response = $this->util->pexec($cmd); 215 //$response = $this->util->pexec($cmd);
216 - 216 +
217 // return $response; 217 // return $response;
218 return false; 218 return false;
219 } 219 }
220 - 220 +
221 return true; 221 return true;
222 } 222 }
223 - 223 +
224 public function getName() { 224 public function getName() {
225 return $this->name; 225 return $this->name;
226 } 226 }
227 - 227 +
228 public function getHRName() { 228 public function getHRName() {
229 return $this->hrname; 229 return $this->hrname;
230 } 230 }
231 - 231 +
232 public function getStopMsg($installDir) { 232 public function getStopMsg($installDir) {
233 return "";//"Execute from terminal : $installDir/dmsctl.sh stop"; 233 return "";//"Execute from terminal : $installDir/dmsctl.sh stop";
234 } 234 }
235 - 235 +
236 /** 236 /**
237 * Write Lucene Service property file 237 * Write Lucene Service property file
238 * 238 *
@@ -251,7 +251,7 @@ class unixLucene extends unixService { @@ -251,7 +251,7 @@ class unixLucene extends unixService {
251 $content .= "server.deny=\n"; 251 $content .= "server.deny=\n";
252 $conf = $this->util->getDataFromSession('configuration'); 252 $conf = $this->util->getDataFromSession('configuration');
253 $varDirectory = $conf['paths']['varDirectory']['path']; 253 $varDirectory = $conf['paths']['varDirectory']['path'];
254 - $content .= "indexer.directory=$varDirectory\n"; 254 + $content .= "indexer.directory=$varDirectory" . DIRECTORY_SEPARATOR . "indexes\n";
255 $content .= "indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer\n"; 255 $content .= "indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer\n";
256 fwrite($fp, $content); 256 fwrite($fp, $content);
257 fclose($fp); 257 fclose($fp);
setup/wizard/lib/services/windowsLucene.php
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 * KnowledgeTree Community Edition 5 * KnowledgeTree Community Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2008,2009 KnowledgeTree Inc. 7 * Copyright (C) 2008,2009 KnowledgeTree Inc.
8 -* 8 +*
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify it under 10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License version 3 as published by the 11 * the terms of the GNU General Public License version 3 as published by the
@@ -135,7 +135,7 @@ class windowsLucene extends windowsService { @@ -135,7 +135,7 @@ class windowsLucene extends windowsService {
135 public $hrname = "KnowledgeTree Indexer Service. (KTLucene)"; 135 public $hrname = "KnowledgeTree Indexer Service. (KTLucene)";
136 136
137 public $description = "KnowledgeTree Indexer Service."; 137 public $description = "KnowledgeTree Indexer Service.";
138 - 138 +
139 /** 139 /**
140 * Load defaults needed by service 140 * Load defaults needed by service
141 * 141 *
@@ -464,15 +464,15 @@ class windowsLucene extends windowsService { @@ -464,15 +464,15 @@ class windowsLucene extends windowsService {
464 464
465 return ''; 465 return '';
466 } 466 }
467 - 467 +
468 public function getHRName() { 468 public function getHRName() {
469 return $this->hrname; 469 return $this->hrname;
470 } 470 }
471 - 471 +
472 public function getStopMsg($installDir) { 472 public function getStopMsg($installDir) {
473 return "";//"Execute from command prompt : $installDir/dmsctl.bat stop"; 473 return "";//"Execute from command prompt : $installDir/dmsctl.bat stop";
474 } 474 }
475 - 475 +
476 /** 476 /**
477 * Write Lucene Service property file 477 * Write Lucene Service property file
478 * 478 *
@@ -491,7 +491,7 @@ class windowsLucene extends windowsService { @@ -491,7 +491,7 @@ class windowsLucene extends windowsService {
491 $content .= "server.deny=\n"; 491 $content .= "server.deny=\n";
492 $conf = $this->util->getDataFromSession('configuration'); 492 $conf = $this->util->getDataFromSession('configuration');
493 $varDirectory = $conf['paths']['varDirectory']['path']; 493 $varDirectory = $conf['paths']['varDirectory']['path'];
494 - $content .= "indexer.directory=$varDirectory\n"; 494 + $content .= "indexer.directory=$varDirectory" . DIRECTORY_SEPARATOR . "indexes\n";
495 $content .= "indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer\n"; 495 $content .= "indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer\n";
496 fwrite($fp, $content); 496 fwrite($fp, $content);
497 fclose($fp); 497 fclose($fp);
setup/wizard/steps/install.php
@@ -105,10 +105,15 @@ class install extends step @@ -105,10 +105,15 @@ class install extends step
105 { 105 {
106 $this->callHome(); 106 $this->callHome();
107 if ($this->util->isMigration()) { // copy indexing directory if this is a migration 107 if ($this->util->isMigration()) { // copy indexing directory if this is a migration
108 - $migrateSessionData = $this->getDataFromPackage('migrate', 'installation');  
109 - $configSessionData = $this->getDataFromSession('configuration'); 108 + $migrateSessionData = $this->getDataFromPackage('migrate', 'installation');
  109 + $configSessionData = $this->getDataFromSession('configuration');
110 $src = $migrateSessionData['location'] . DS . 'var' . DS . 'indexes'; 110 $src = $migrateSessionData['location'] . DS . 'var' . DS . 'indexes';
111 - $dst = $configSessionData['paths']['varDirectory']['path'] . DS . 'indexes'; 111 +
  112 + if(WINDOWS_OS){
  113 + $dst = $configSessionData['paths']['varDirectory']['path'] . DS . 'indexes';
  114 + }else{
  115 + $dst = $configSessionData['paths']['varDirectory']['path'];
  116 + }
112 $this->util->copyDirectory($src, $dst); 117 $this->util->copyDirectory($src, $dst);
113 } 118 }
114 } 119 }
@@ -126,11 +131,11 @@ class install extends step @@ -126,11 +131,11 @@ class install extends step
126 } 131 }
127 $this->temp_variables['ce_check'] = $this->ce_check; 132 $this->temp_variables['ce_check'] = $this->ce_check;
128 } 133 }
129 - 134 +
130 function registerPlugins() { 135 function registerPlugins() {
131 - 136 +
132 } 137 }
133 - 138 +
134 public function callHome() { 139 public function callHome() {
135 $conf = $this->getDataFromSession("install"); // retrieve database information from session 140 $conf = $this->getDataFromSession("install"); // retrieve database information from session
136 $dbconf = $this->getDataFromSession("database"); 141 $dbconf = $this->getDataFromSession("database");
@@ -143,7 +148,7 @@ class install extends step @@ -143,7 +148,7 @@ class install extends step
143 $this->util->dbUtilities->query($query); 148 $this->util->dbUtilities->query($query);
144 $this->util->dbUtilities->close(); // close the database connection 149 $this->util->dbUtilities->close(); // close the database connection
145 } 150 }
146 -  
147 - 151 +
  152 +
148 } 153 }
149 ?> 154 ?>
150 \ No newline at end of file 155 \ No newline at end of file