Commit 8a1231027075fad92b2e92f323b57446f2f3458a

Authored by Jarrett Jordaan
1 parent e5942d35

KTS-4438: Updated Services

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
setup/migrate/config/config.xml
... ... @@ -7,7 +7,7 @@
7 7 Description: Migrateer steps
8 8 -->
9 9  
10   -<migrate version="3.7" type="Commercial Edition">
  10 +<migrate version="3.7" type="Community Edition">
11 11 <steps>
12 12 <step name="Current Installation">installation</step>
13 13 <step name="Deactivate Services">services</step>
... ...
setup/upgrade/config/config.xml
... ... @@ -7,7 +7,7 @@
7 7 Description: Upgrader steps
8 8 -->
9 9  
10   -<upgrade version="3.7" type="Commercial Edition">
  10 +<upgrade version="3.7" type="Community Edition">
11 11 <steps>
12 12 <step name="Welcome">welcome</step>
13 13 <step name="Current Installation">installation</step>
... ...
setup/wizard/lib/system/config-path-mock
1 1 /var/lib/knowledgetree-ce
2 2 /var/lib/knowledgetree-ce/Documents
3 3 /var/lib/knowledgetree-ce/indexes
4   -/etc/knowledgetree/config.ini
  4 +/etc/knowledgetree-ce/config.ini
5 5 /var/log/knowledgetree-ce
6 6 /var/tmp/knowledgetree-ce
7 7 /var/tmp/knowledgetree-ce/proxies
... ...
setup/wizard/lib/validation/luceneValidation.php
... ... @@ -274,7 +274,7 @@ class luceneValidation extends serviceValidation {
274 274 if($auto) {
275 275 return $auto;
276 276 } else {
277   - $auto = $this->useDetected(); // Check if auto detected java works
  277 + $auto = $this->detSettings(); // Check if auto detected java works
278 278 if($auto) {
279 279 $this->disableExtension = true; // Disable the use of the php bridge extension
280 280 return $auto;
... ... @@ -454,18 +454,6 @@ class luceneValidation extends serviceValidation {
454 454 }
455 455 }
456 456  
457   - /**
458   - * Attempt detection without logging errors
459   - *
460   - * @author KnowledgeTree Team
461   - * @param none
462   - * @access private
463   - * @return boolean
464   - */
465   - private function useDetected() {
466   - return $this->detSettings();
467   - }
468   -
469 457 /**
470 458 * Set all silent mode varibles
471 459 *
... ...
setup/wizard/steps/configuration.php
... ... @@ -53,6 +53,7 @@ if(isset($_GET[&#39;action&#39;])) {
53 53  
54 54 class configuration extends Step
55 55 {
  56 + private $allConfs;
56 57 /**
57 58 * Database host
58 59 *
... ... @@ -282,16 +283,19 @@ class configuration extends Step
282 283 }
283 284  
284 285 private function registerDirs() { // Adjust directories variables
285   - $this->readConfigPath();
286   - $dirs = $this->getFromConfigPath();
287   - $directories['varDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['varDirectory']['path']), 'setting'=>'varDirectory');
288   - $directories['logDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['logDirectory']['path']), 'setting'=>'logDirectory');
289   - $directories['documentRoot'] = array('section'=>'urls', 'value'=>addslashes($dirs['documentRoot']['path']), 'setting'=>'documentRoot');
  286 +// $this->readConfigPath();
  287 +// $dirs = $this->getFromConfigPath();
  288 +// print_r($dirs);
  289 + $directories['varDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['varDirectory']['path']), 'setting'=>'varDirectory');
  290 + $directories['logDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['logDirectory']['path']), 'setting'=>'logDirectory');
  291 + $directories['documentRoot'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['documentRoot']['path']), 'setting'=>'documentRoot');
290 292 $directories['uiDirectory'] = array('section'=>'urls', 'value'=>'${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree', 'setting'=>'uiDirectory');
291   - $directories['tmpDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['tmpDirectory']['path']), 'setting'=>'tmpDirectory');
  293 + $directories['tmpDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['tmpDirectory']['path']), 'setting'=>'tmpDirectory');
  294 + $directories['cacheDirectory'] = array('section'=>'cache', 'value'=>addslashes($this->allConfs['cacheDirectory']['path']), 'setting'=>'cacheDirectory');
292 295  
293 296 return $directories;
294 297 }
  298 +
295 299 /**
296 300 * Perform the installation associated with the step.
297 301 * Variables required by the installation are stored within the session.
... ... @@ -306,22 +310,24 @@ class configuration extends Step
306 310 $this->dbhandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']);
307 311 $server = $conf['server'];
308 312 $paths = $conf['paths'];
309   - // TODO
310 313 if ($this->util->isMigration()) { // Check if its an upgrade
  314 + $this->confpaths['configIni'] = $this->readConfigPathIni();
311 315 $this->readInstallation();
  316 + $configPath = $this->confpaths['configIni'];
312 317 } else {
313 318 $this->readConfigPath(); // initialise writing to config.ini
  319 + if(isset($this->confpaths['configIni'])) { // Check if theres a config path
  320 + $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File
  321 + if($configPath == '') { // Absolute path probably entered
  322 + $configPath = realpath("{$this->confpaths['configIni']}"); // Get relative path
  323 + }
  324 + } else {
  325 + $configPath = realpath('../../config/config.ini'); // Normal
  326 + }
314 327 }
315   - $dirs = $this->getFromConfigPath();
316   - if(isset($this->confpaths['configIni'])) { // Check if theres a config path
317   - $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File
318   - if($configPath == '') { // Absolute path probably entered
319   - $configPath = realpath("{$this->confpaths['configIni']}"); // Get relative path
320   - }
321   - } else {
322   - $configPath = realpath('../../config/config.ini');
323   - }
  328 + $this->getFromConfigPath();
324 329 $ini = false;
  330 +// print_r($configPath);
325 331 if(file_exists($configPath)) {
326 332 $ini = new iniUtilities($configPath);
327 333 }
... ... @@ -333,7 +339,7 @@ class configuration extends Step
333 339 }
334 340 $this->dbhandler->close(); // close the database connection
335 341 $this->writeCachePath(); // Write cache path file
336   - $this->writeConfigPath(); // Write config file
  342 + $this->writeConfigPath($configPath); // Write config file
337 343 }
338 344  
339 345 private function writeUrlSection($ini) {
... ... @@ -446,6 +452,7 @@ class configuration extends Step
446 452 {
447 453 if(isset($this->temp_variables['paths'])) {
448 454 if ($this->util->isMigration()) { // Check if its an upgrade
  455 + $this->confpaths['configIni'] = $this->readConfigPathIni();
449 456 $this->readInstallation(); // Read values from config.ini of other installation
450 457 $dirs = $this->getFromConfigPath(); // Store contents
451 458 } else {
... ... @@ -453,6 +460,7 @@ class configuration extends Step
453 460 }
454 461 } else {
455 462 if ($this->util->isMigration()) { // Check if its an upgrade
  463 + $this->confpaths['configIni'] = $this->readConfigPathIni();
456 464 $this->readInstallation(); // Read values from config.ini of other installation
457 465 } else {
458 466 $this->readConfigPath(); // Read contents of config-path file
... ... @@ -583,6 +591,7 @@ class configuration extends Step
583 591 }
584 592 $configs['varDirectory'] = array('name' => 'Var Directory', 'setting' => 'varDirectory', 'path' => $varPath, 'create' => false);
585 593  
  594 + $this->allConfs = $configs;
586 595 return $configs;
587 596 }
588 597  
... ... @@ -632,6 +641,21 @@ class configuration extends Step
632 641 return true;
633 642 }
634 643  
  644 + private function readConfigPathIni() {
  645 + $configPath = $this->getContentPath();
  646 + if(!$configPath) return false;
  647 + $ini = new iniUtilities($configPath);
  648 + $data = $ini->getFileByLine();
  649 + $firstline = true;
  650 + foreach ($data as $k=>$v) {
  651 + if(preg_match('/config.ini/', $k)) { // Find config.ini
  652 + return $k;
  653 + }
  654 + }
  655 +
  656 + return false;
  657 + }
  658 +
635 659 /**
636 660 * Read contents of config path file
637 661 *
... ... @@ -676,14 +700,14 @@ class configuration extends Step
676 700 }
677 701  
678 702 /**
679   - * Read contents of config path file
  703 + * Write location of config path file
680 704 *
681 705 * @author KnowledgeTree Team
682 706 * @access private
683 707 * @param none
684 708 * @return boolean
685 709 */
686   - private function writeConfigPath() {
  710 + private function writeConfigPath($configPath = '') {
687 711 $configPath = $this->getContentPath();
688 712 if(!$configPath) return false;
689 713 $ini = new iniUtilities($configPath);
... ... @@ -746,10 +770,6 @@ class configuration extends Step
746 770 if(!$cachePath) return false;
747 771 return $cachePath;
748 772 }
749   -
750   - public function doReadConfig() {
751   -
752   - }
753 773 }
754 774  
755 775 if(isset($_GET['action'])) {
... ...