Commit 45b7d19a48c0f0da17648a94a717c71b56166d7a

Authored by Megan Watson
2 parents cbc8b2c7 6172b6bb

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

setup/wizard/steps/configuration.php
... ... @@ -321,8 +321,16 @@ class configuration extends Step
321 321 $paths = $conf['paths'];
322 322  
323 323 // initialise writing to config.ini
324   - $configPath = realpath('../../config/config.ini');
325   -
  324 + $this->readConfigPath();
  325 + $dirs = $this->getFromConfigPath();
  326 + if(isset($this->confpaths['configIni'])) { // Check if theres a config path
  327 + $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File
  328 + if($configPath == '') { // Absolute path probably entered
  329 + $configPath = realpath("{$this->confpaths['configIni']}"); // Get relative path
  330 + }
  331 + } else {
  332 + $configPath = realpath('../../config/config.ini');
  333 + }
326 334 $ini = false;
327 335 if(file_exists($configPath)) {
328 336 $ini = new Ini($configPath);
... ... @@ -449,10 +457,12 @@ class configuration extends Step
449 457 private function getPathInfo($fileSystemRoot)
450 458 {
451 459 if(isset($this->temp_variables['paths'])) {
  460 +
452 461 $dirs = $this->temp_variables['paths']; // Pull from temp
453 462 } else {
454 463 $this->readConfigPath();
455 464 $dirs = $this->getFromConfigPath();
  465 +
456 466 }
457 467 $varDirectory = $fileSystemRoot . DS . 'var';
458 468 foreach ($dirs as $key => $dir){
... ... @@ -491,6 +501,11 @@ class configuration extends Step
491 501 */
492 502 private function getDirectories()
493 503 {
  504 + if(isset($this->confpaths['configIni'])) {
  505 + $configPath = $this->confpaths['configIni'];
  506 + } else {
  507 + $configPath = '${fileSystemRoot}/config/config.ini';
  508 + }
494 509 return array(
495 510 array('name' => 'Var Directory', 'setting' => 'varDirectory', 'path' => '${fileSystemRoot}/var', 'create' => false),
496 511 array('name' => 'Document Directory', 'setting' => 'documentRoot', 'path' => '${varDirectory}/Documents', 'create' => true),
... ... @@ -498,7 +513,7 @@ class configuration extends Step
498 513 array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => '${varDirectory}/tmp', 'create' => true),
499 514 array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => '${varDirectory}/uploads', 'create' => true),
500 515 array('name' => 'Executables Directory', 'setting' => 'binDirectory', 'path' => '${varDirectory}/bin', 'create' => false),
501   - array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => '${fileSystemRoot}/config/config.ini', 'create' => false),
  516 + array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $configPath, 'create' => false),
502 517 );
503 518 }
504 519  
... ...