Commit 9b72a6cf92d3b35d376ddc66cfd6bbb1b5ed2bd6
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
12 changed files
with
115 additions
and
49 deletions
setup/wizard/ini.php
setup/wizard/lib/helpers/config-path-mock
0 → 100644
| 1 | +/var/www/installers/knowledgetree/config/config.ini | |
| 2 | +/var/www/installers/knowledgetree/var_test/cache | |
| 3 | +/var/www/installers/knowledgetree/var_test/Documents | |
| 4 | +/var/www/installers/knowledgetree/var_test/indexes | |
| 5 | +/var/www/installers/knowledgetree/var_test/log | |
| 6 | +/var/www/installers/knowledgetree/var_test/Pdf | |
| 7 | +/var/www/installers/knowledgetree/var_test/proxies | |
| 8 | +/var/www/installers/knowledgetree/var_test/tmp | |
| 9 | +/var/www/installers/knowledgetree/var_test/uploads | |
| 0 | 10 | \ No newline at end of file | ... | ... |
setup/wizard/lib/helpers/demo.sh
| ... | ... | @@ -5,3 +5,7 @@ rm ../../../../var/log/scheduler.log; |
| 5 | 5 | rm ../../../../var/log/openoffice.log; |
| 6 | 6 | rm ../../../../bin/luceneserver/KnowledgeTreeIndexer.properties; |
| 7 | 7 | rm ../../../../setup/wizard/output/outJV; |
| 8 | +pkill -f lucene; | |
| 9 | +pkill -f scheduler; | |
| 10 | +pkill -f openoffice; | |
| 11 | + | ... | ... |
setup/wizard/lib/services/unixLucene.php
| ... | ... | @@ -181,9 +181,13 @@ class unixLucene extends unixService { |
| 181 | 181 | public function start() { |
| 182 | 182 | $state = $this->status(); |
| 183 | 183 | if($state != 'STARTED') { |
| 184 | - $this->writeLuceneProperties(); | |
| 184 | + //$this->writeLuceneProperties(); | |
| 185 | 185 | $cmd = "cd ".$this->getLuceneDir()."; "; |
| 186 | 186 | $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!"; |
| 187 | + if(DEBUG) { | |
| 188 | + echo "$cmd<br/>"; | |
| 189 | + return ; | |
| 190 | + } | |
| 187 | 191 | $response = $this->util->pexec($cmd); |
| 188 | 192 | |
| 189 | 193 | return $response; | ... | ... |
setup/wizard/lib/services/unixOpenOffice.php
| ... | ... | @@ -156,6 +156,10 @@ class unixOpenOffice extends unixService { |
| 156 | 156 | $state = $this->status(); |
| 157 | 157 | if($state != 'STARTED') { |
| 158 | 158 | $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".SYS_LOG_DIR."{$this->getLog()} 2>&1 & echo $!"; |
| 159 | + if(DEBUG) { | |
| 160 | + echo "$cmd<br/>"; | |
| 161 | + return ; | |
| 162 | + } | |
| 159 | 163 | $response = $this->util->pexec($cmd); |
| 160 | 164 | |
| 161 | 165 | return $response; | ... | ... |
setup/wizard/lib/services/unixScheduler.php
| ... | ... | @@ -56,7 +56,7 @@ class unixScheduler extends unixService { |
| 56 | 56 | |
| 57 | 57 | public function load() { |
| 58 | 58 | $this->setSystemDir(SYSTEM_ROOT."bin".DS); |
| 59 | - $this->setSchedulerDir(SYSTEM_DIR."bin".DS); | |
| 59 | + $this->setSchedulerDir(VAR_BIN_DIR); | |
| 60 | 60 | $this->setSchedulerSourceLoc('schedulerTask.sh'); |
| 61 | 61 | } |
| 62 | 62 | |
| ... | ... | @@ -156,16 +156,17 @@ class unixScheduler extends unixService { |
| 156 | 156 | $this->writeSchedulerTask(); |
| 157 | 157 | if($source) { // Source |
| 158 | 158 | $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; |
| 159 | - $response = $this->util->pexec($cmd); | |
| 160 | - return $response; | |
| 161 | 159 | } else { // Could be Stack |
| 162 | 160 | $source = SYS_BIN_DIR.$this->schedulerSource; |
| 163 | 161 | $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; |
| 164 | - $response = $this->util->pexec($cmd); | |
| 165 | - return $response; | |
| 166 | 162 | } |
| 167 | - | |
| 168 | - return false; | |
| 163 | + if(DEBUG) { | |
| 164 | + echo "$cmd<br/>"; | |
| 165 | + return ; | |
| 166 | + } | |
| 167 | + $response = $this->util->pexec($cmd); | |
| 168 | + | |
| 169 | + return $response; | |
| 169 | 170 | } |
| 170 | 171 | |
| 171 | 172 | ... | ... |
setup/wizard/lib/services/windowsLucene.php
| ... | ... | @@ -434,7 +434,8 @@ class windowsLucene extends windowsService { |
| 434 | 434 | $content .= "server.paranoid=false\n"; |
| 435 | 435 | $content .= "server.accept=127.0.0.1\n"; |
| 436 | 436 | $content .= "server.deny=\n"; |
| 437 | - $content .= "indexer.directory=../../var/indexes\n"; | |
| 437 | + $content .= "indexer.directory=".SYS_VAR_DIR."indexes\n"; | |
| 438 | + //$content .= "indexer.directory=../../var/indexes\n"; | |
| 438 | 439 | $content .= "indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer\n"; |
| 439 | 440 | fwrite($fp, $content); |
| 440 | 441 | fclose($fp); | ... | ... |
setup/wizard/output/dummy.txt deleted
setup/wizard/path.php
| ... | ... | @@ -74,11 +74,13 @@ |
| 74 | 74 | define('STEP_DIR', WIZARD_DIR."steps".DS); |
| 75 | 75 | define('TEMP_DIR', WIZARD_DIR."templates".DS); |
| 76 | 76 | define('SHELL_DIR', WIZARD_DIR."shells".DS); |
| 77 | - define('OUTPUT_DIR', WIZARD_DIR."output".DS); | |
| 78 | 77 | // Define paths to system webroot |
| 79 | 78 | define('SYSTEM_DIR', $sys); |
| 79 | + define('SYS_VAR_DIR', SYSTEM_DIR."var".DS); | |
| 80 | 80 | define('SYS_BIN_DIR', SYSTEM_DIR."bin".DS); |
| 81 | - define('SYS_LOG_DIR', SYSTEM_DIR."var".DS."log".DS); | |
| 81 | + define('SYS_LOG_DIR', SYS_VAR_DIR."log".DS); | |
| 82 | + define('SYS_OUT_DIR', SYS_VAR_DIR); | |
| 83 | + define('VAR_BIN_DIR', SYS_VAR_DIR."bin".DS); | |
| 82 | 84 | // Define paths to system |
| 83 | 85 | array_pop($xdir); |
| 84 | 86 | $asys = ''; | ... | ... |
setup/wizard/steps/configuration.php
| ... | ... | @@ -450,8 +450,9 @@ class configuration extends Step |
| 450 | 450 | if(isset($this->temp_variables['paths'])) { |
| 451 | 451 | $dirs = $this->temp_variables['paths']; // Pull from temp |
| 452 | 452 | } else { |
| 453 | -// $dirs = $this->getDirectories(); | |
| 454 | - $this->readConfigPath(); | |
| 453 | + if(!$this->readConfigPath()) { // Read the configuration | |
| 454 | + | |
| 455 | + } | |
| 455 | 456 | $dirs = $this->getFromConfigPath(); |
| 456 | 457 | } |
| 457 | 458 | $varDirectory = $fileSystemRoot . DS . 'var'; |
| ... | ... | @@ -497,7 +498,7 @@ class configuration extends Step |
| 497 | 498 | array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => '${varDirectory}/log', 'create' => true), |
| 498 | 499 | array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => '${varDirectory}/tmp', 'create' => true), |
| 499 | 500 | array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => '${varDirectory}/uploads', 'create' => true), |
| 500 | - array('name' => 'Executables Directory', 'setting' => 'binDirectory', 'path' => '${fileSystemRoot}/bin', 'create' => false), | |
| 501 | + array('name' => 'Executables Directory', 'setting' => 'binDirectory', 'path' => '${varDirectory}/bin', 'create' => false), | |
| 501 | 502 | array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => '${fileSystemRoot}/config/config.ini', 'create' => false), |
| 502 | 503 | ); |
| 503 | 504 | } |
| ... | ... | @@ -505,6 +506,10 @@ class configuration extends Step |
| 505 | 506 | /** |
| 506 | 507 | * Store contents of edited settings |
| 507 | 508 | * |
| 509 | + * @author KnowledgeTree Team | |
| 510 | + * @access private | |
| 511 | + * @param none | |
| 512 | + * @return array The path information | |
| 508 | 513 | */ |
| 509 | 514 | private function setFromPost() { |
| 510 | 515 | $this->paths = array( |
| ... | ... | @@ -513,7 +518,7 @@ class configuration extends Step |
| 513 | 518 | array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => $_POST['logDirectory'], 'create' => true), |
| 514 | 519 | array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => $_POST['tmpDirectory'], 'create' => true), |
| 515 | 520 | array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => $_POST['uploadDirectory'], 'create' => true), |
| 516 | - array('name' => 'Executables Directory', 'setting' => 'binDirectory', 'path' => $_POST['binDirectory'], 'create' => false), | |
| 521 | + array('name' => 'Executables Directory', 'setting' => 'binDirectory', 'path' => $_POST['uploadDirectory'], 'create' => true), | |
| 517 | 522 | array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $_POST['configFile'], 'create' => false), |
| 518 | 523 | ); |
| 519 | 524 | } |
| ... | ... | @@ -521,20 +526,36 @@ class configuration extends Step |
| 521 | 526 | /** |
| 522 | 527 | * Store contents of edited settings |
| 523 | 528 | * |
| 529 | + * @author KnowledgeTree Team | |
| 530 | + * @access private | |
| 531 | + * @param none | |
| 532 | + * @return array The path information | |
| 524 | 533 | */ |
| 525 | 534 | private function getFromConfigPath() { |
| 526 | - return array( | |
| 527 | - array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $this->confpaths['configIni'], 'create' => false), | |
| 528 | - array('name' => 'Document Directory', 'setting' => 'documentRoot', 'path' => $this->confpaths['Documents'], 'create' => true), | |
| 529 | - array('name' => 'Cache Directory', 'setting' => 'cacheDirectory', 'path' => $this->confpaths['cache'], 'create' => true), | |
| 530 | - array('name' => 'Index Directory', 'setting' => 'indexDirectory', 'path' => $this->confpaths['indexes'], 'create' => true), | |
| 531 | - array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => $this->confpaths['log'], 'create' => true), | |
| 532 | - array('name' => 'Proxy Directory', 'setting' => 'proxiesDirectory', 'path' => $this->confpaths['proxies'], 'create' => true), | |
| 533 | - array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => $this->confpaths['tmp'], 'create' => true), | |
| 534 | - array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => $this->confpaths['uploads'], 'create' => true), | |
| 535 | - ); | |
| 535 | + if(isset($this->confpaths['Documents'])) { // Simple check to see if any paths were written | |
| 536 | + return array ( | |
| 537 | + array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $this->confpaths['configIni'], 'create' => false), | |
| 538 | + array('name' => 'Document Directory', 'setting' => 'documentRoot', 'path' => $this->confpaths['Documents'], 'create' => true), | |
| 539 | + array('name' => 'Cache Directory', 'setting' => 'cacheDirectory', 'path' => $this->confpaths['cache'], 'create' => true), | |
| 540 | + array('name' => 'Index Directory', 'setting' => 'indexDirectory', 'path' => $this->confpaths['indexes'], 'create' => true), | |
| 541 | + array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => $this->confpaths['log'], 'create' => true), | |
| 542 | + array('name' => 'Proxy Directory', 'setting' => 'proxiesDirectory', 'path' => $this->confpaths['proxies'], 'create' => true), | |
| 543 | + array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => $this->confpaths['tmp'], 'create' => true), | |
| 544 | + array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => $this->confpaths['uploads'], 'create' => true), | |
| 545 | + ); | |
| 546 | + } else { | |
| 547 | + return $this->getDirectories(); | |
| 548 | + } | |
| 536 | 549 | } |
| 537 | 550 | |
| 551 | + /** | |
| 552 | + * Path information | |
| 553 | + * | |
| 554 | + * @author KnowledgeTree Team | |
| 555 | + * @access public | |
| 556 | + * @param string $fileSystemRoot The file system root of the installation | |
| 557 | + * @return array The path information | |
| 558 | + */ | |
| 538 | 559 | public function getFromPost() { |
| 539 | 560 | return $this->paths; |
| 540 | 561 | } |
| ... | ... | @@ -542,14 +563,16 @@ class configuration extends Step |
| 542 | 563 | /** |
| 543 | 564 | * Read contents of config path file |
| 544 | 565 | * |
| 566 | + * @author KnowledgeTree Team | |
| 567 | + * @access private | |
| 568 | + * @param none | |
| 569 | + * @return array The path information | |
| 545 | 570 | */ |
| 546 | 571 | private function readConfigPath() { |
| 547 | - $configPath = realpath('../../../config/config-path'); | |
| 548 | - if($configPath == '') | |
| 549 | - $configPath = realpath('../../config/config-path'); | |
| 572 | + $configPath = $this->getContentPath(); | |
| 573 | + if(!$configPath) return false; | |
| 550 | 574 | $ini = new Ini($configPath); |
| 551 | - $data = $ini->read($configPath); | |
| 552 | - $data = $data['']; | |
| 575 | + $data = $ini->getFileByLine(); | |
| 553 | 576 | foreach ($data as $k=>$v) { |
| 554 | 577 | if(preg_match('/config.ini/', $k)) { |
| 555 | 578 | $this->confpaths['configIni'] = $k; |
| ... | ... | @@ -570,20 +593,22 @@ class configuration extends Step |
| 570 | 593 | } |
| 571 | 594 | } |
| 572 | 595 | |
| 573 | - return false; | |
| 596 | + return true; | |
| 574 | 597 | } |
| 575 | 598 | |
| 576 | 599 | /** |
| 577 | 600 | * Read contents of config path file |
| 578 | 601 | * |
| 602 | + * @author KnowledgeTree Team | |
| 603 | + * @access private | |
| 604 | + * @param none | |
| 605 | + * @return boolean | |
| 579 | 606 | */ |
| 580 | 607 | private function writeConfigPath() { |
| 581 | - $configPath = realpath('../../../config/config-path'); | |
| 582 | - if($configPath == '') | |
| 583 | - $configPath = realpath('../../config/config-path'); | |
| 608 | + $configPath = $this->getContentPath(); | |
| 609 | + if(!$configPath) return false; | |
| 584 | 610 | $ini = new Ini($configPath); |
| 585 | - $data = $ini->read($configPath); | |
| 586 | - $data = $data['']; | |
| 611 | + $data = $ini->getFileByLine(); | |
| 587 | 612 | $configContent = ''; |
| 588 | 613 | foreach ($data as $k=>$v) { |
| 589 | 614 | if(preg_match('/config.ini/', $k)) { |
| ... | ... | @@ -597,13 +622,24 @@ class configuration extends Step |
| 597 | 622 | return true; |
| 598 | 623 | } |
| 599 | 624 | |
| 625 | + /** | |
| 626 | + * Attempt to locate config-path file in system | |
| 627 | + * | |
| 628 | + * @author KnowledgeTree Team | |
| 629 | + * @access private | |
| 630 | + * @param none | |
| 631 | + * @return mixed | |
| 632 | + */ | |
| 633 | + public function getContentPath() { | |
| 634 | + $configPath = realpath('../../../config/config-path'); | |
| 635 | + if($configPath == '') | |
| 636 | + $configPath = realpath('../../config/config-path'); | |
| 637 | + if(!$configPath) return false; | |
| 638 | + return $configPath; | |
| 639 | + } | |
| 640 | + | |
| 600 | 641 | public function doReadConfig() { |
| 601 | - $this->readConfigPath(); | |
| 602 | -// $this->writeConfigPath(); | |
| 603 | - $configPaths = $this->getFromConfigPath(); | |
| 604 | -// echo '<pre>'; | |
| 605 | -// print_r($configPaths); | |
| 606 | -// echo '</pre>'; | |
| 642 | + | |
| 607 | 643 | } |
| 608 | 644 | } |
| 609 | 645 | ... | ... |
setup/wizard/steps/services.php
| ... | ... | @@ -660,10 +660,10 @@ class services extends Step |
| 660 | 660 | } |
| 661 | 661 | $javaExecutable = $this->java; |
| 662 | 662 | } |
| 663 | - $cmd = "\"$javaExecutable\" -version > output/outJV 2>&1 echo $!"; | |
| 663 | + $cmd = "\"$javaExecutable\" -version > ".SYS_OUT_DIR."/outJV 2>&1 echo $!"; | |
| 664 | 664 | $response = $this->util->pexec($cmd); |
| 665 | - if(file_exists(OUTPUT_DIR.'outJV')) { | |
| 666 | - $tmp = file_get_contents(OUTPUT_DIR.'outJV'); | |
| 665 | + if(file_exists(SYS_OUT_DIR.'outJV')) { | |
| 666 | + $tmp = file_get_contents(SYS_OUT_DIR.'outJV'); | |
| 667 | 667 | preg_match('/"(.*)"/',$tmp, $matches); |
| 668 | 668 | if($matches) { |
| 669 | 669 | if($matches[1] < $this->javaVersion) { // Check Version of java |
| ... | ... | @@ -704,10 +704,10 @@ class services extends Step |
| 704 | 704 | // TODO: Better php handling |
| 705 | 705 | return true; |
| 706 | 706 | $phpExecutable = $this->util->phpSpecified();// Retrieve java bin |
| 707 | - $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!"; | |
| 707 | + $cmd = "$phpExecutable -version > ".SYS_OUT_DIR."/outPHP 2>&1 echo $!"; | |
| 708 | 708 | $response = $this->util->pexec($cmd); |
| 709 | - if(file_exists(OUTPUT_DIR.'outPHP')) { | |
| 710 | - $tmp = file_get_contents(OUTPUT_DIR.'outPHP'); | |
| 709 | + if(file_exists(SYS_OUT_DIR.'outPHP')) { | |
| 710 | + $tmp = file_get_contents(SYS_OUT_DIR.'outPHP'); | |
| 711 | 711 | preg_match('/PHP/',$tmp, $matches); |
| 712 | 712 | if($matches) { |
| 713 | 713 | $this->phpCheck = 'tick'; | ... | ... |
var/bin/schedulerTask.sh
0 → 100644
| 1 | +// DO NOT DELETE | ... | ... |