Commit 16e505b531801fce74a6178e3163f64faf3425c3

Authored by Brad Shuttleworth
1 parent 5ecba8d5

fix for windows file-location problems.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5356 c91229c3-7414-0410-bfa2-8a42b809f60b
config/dmsDefaults.php
@@ -42,7 +42,11 @@ unset($microtime_simple); @@ -42,7 +42,11 @@ unset($microtime_simple);
42 42
43 // If not defined, set KT_DIR based on my usual location in the tree 43 // If not defined, set KT_DIR based on my usual location in the tree
44 if (!defined('KT_DIR')) { 44 if (!defined('KT_DIR')) {
45 - define('KT_DIR', realpath(dirname(__FILE__) . '/..')); 45 + $rootLoc = realpath(dirname(__FILE__) . '/..');
  46 + if (OS_WINDOWS) {
  47 + $rootLoc = str_replace('\\','/',$rootLoc);
  48 + }
  49 + define('KT_DIR', $rootLoc);
46 } 50 }
47 51
48 if (!defined('KT_LIB_DIR')) { 52 if (!defined('KT_LIB_DIR')) {
@@ -380,7 +384,7 @@ class KTInit { @@ -380,7 +384,7 @@ class KTInit {
380 } 384 }
381 } else { 385 } else {
382 $oKTConfig =& KTConfig::getSingleton(); 386 $oKTConfig =& KTConfig::getSingleton();
383 - 387 +
384 $oKTConfig->setdefaultns("KnowledgeTree", "fileSystemRoot", KT_DIR); 388 $oKTConfig->setdefaultns("KnowledgeTree", "fileSystemRoot", KT_DIR);
385 $oKTConfig->setdefaultns("KnowledgeTree", "serverName", KTUtil::arrayGet($_SERVER, 'HTTP_HOST', 'localhost')); 389 $oKTConfig->setdefaultns("KnowledgeTree", "serverName", KTUtil::arrayGet($_SERVER, 'HTTP_HOST', 'localhost'));
386 $oKTConfig->setdefaultns("KnowledgeTree", "sslEnabled", false); 390 $oKTConfig->setdefaultns("KnowledgeTree", "sslEnabled", false);
lib/storage/ondiskhashedstoragemanager.inc.php
@@ -45,6 +45,9 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { @@ -45,6 +45,9 @@ class KTOnDiskHashedStorageManager extends KTStorageManager {
45 //copy the file accross 45 //copy the file accross
46 $start_time = KTUtil::getBenchmarkTime(); 46 $start_time = KTUtil::getBenchmarkTime();
47 $file_size = $oDocument->getFileSize(); 47 $file_size = $oDocument->getFileSize();
  48 + if (OS_WINDOWS) {
  49 + $sDocumentFileSystemPath = str_replace('\\','/',$sDocumentFileSystemPath);
  50 + }
48 if ($this->writeToFile($sTmpFilePath, $sDocumentFileSystemPath)) { 51 if ($this->writeToFile($sTmpFilePath, $sDocumentFileSystemPath)) {
49 $end_time = KTUtil::getBenchmarkTime(); 52 $end_time = KTUtil::getBenchmarkTime();
50 global $default; 53 global $default;
@@ -64,6 +67,7 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { @@ -64,6 +67,7 @@ class KTOnDiskHashedStorageManager extends KTStorageManager {
64 67
65 function writeToFile($sTmpFilePath, $sDocumentFileSystemPath) { 68 function writeToFile($sTmpFilePath, $sDocumentFileSystemPath) {
66 // Make it easy to write compressed/encrypted storage 69 // Make it easy to write compressed/encrypted storage
  70 +
67 return copy($sTmpFilePath, $sDocumentFileSystemPath); 71 return copy($sTmpFilePath, $sDocumentFileSystemPath);
68 } 72 }
69 73