Commit 25382c90ee795d6ba6e41bb82e4abf8a3c5f6f71
1 parent
5a8d269c
use ${install}/var/tmp by default.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5726 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
8 changed files
with
43 additions
and
12 deletions
config/config-path
config/config.ini
| @@ -149,6 +149,7 @@ varDirectory = ${fileSystemRoot}/var | @@ -149,6 +149,7 @@ varDirectory = ${fileSystemRoot}/var | ||
| 149 | logDirectory = ${varDirectory}/log | 149 | logDirectory = ${varDirectory}/log |
| 150 | documentRoot = ${varDirectory}/Documents | 150 | documentRoot = ${varDirectory}/Documents |
| 151 | uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree | 151 | uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree |
| 152 | +tmpDirectory = ${varDirectory}/tmp | ||
| 152 | 153 | ||
| 153 | ; urls | 154 | ; urls |
| 154 | graphicsUrl = ${rootUrl}/graphics | 155 | graphicsUrl = ${rootUrl}/graphics |
config/dmsDefaults.php
| @@ -403,6 +403,8 @@ class KTInit { | @@ -403,6 +403,8 @@ class KTInit { | ||
| 403 | $oKTConfig->setdefaultns("KnowledgeTree", "pathInfoSupport", false); | 403 | $oKTConfig->setdefaultns("KnowledgeTree", "pathInfoSupport", false); |
| 404 | $oKTConfig->setdefaultns("storage", "manager", 'KTOnDiskHashedStorageManager'); | 404 | $oKTConfig->setdefaultns("storage", "manager", 'KTOnDiskHashedStorageManager'); |
| 405 | $oKTConfig->setdefaultns("config", "useDatabaseConfiguration", false); | 405 | $oKTConfig->setdefaultns("config", "useDatabaseConfiguration", false); |
| 406 | + | ||
| 407 | + $oKTConfig->setdefaultns("urls", "tmpDirectory", '${varDirectory}/tmp'); | ||
| 406 | 408 | ||
| 407 | $oKTConfig->setdefaultns("tweaks", "browseToUnitFolder", false); | 409 | $oKTConfig->setdefaultns("tweaks", "browseToUnitFolder", false); |
| 408 | $oKTConfig->setdefaultns("tweaks", "genericMetaDataRequired", true); | 410 | $oKTConfig->setdefaultns("tweaks", "genericMetaDataRequired", true); |
| @@ -426,7 +428,8 @@ class KTInit { | @@ -426,7 +428,8 @@ class KTInit { | ||
| 426 | $oKTConfig->setdefaultns("cache", "proxyCacheDirectory", '${varDirectory}/proxies'); | 428 | $oKTConfig->setdefaultns("cache", "proxyCacheDirectory", '${varDirectory}/proxies'); |
| 427 | $oKTConfig->setdefaultns("cache", "proxyCacheEnabled", 'true'); | 429 | $oKTConfig->setdefaultns("cache", "proxyCacheEnabled", 'true'); |
| 428 | 430 | ||
| 429 | - $this->readConfig(); | 431 | + $res = $this->readConfig(); |
| 432 | + if (PEAR::isError($res)) { return $res; } | ||
| 430 | 433 | ||
| 431 | $oKTConfig =& KTConfig::getSingleton(); | 434 | $oKTConfig =& KTConfig::getSingleton(); |
| 432 | @touch($cache_file); | 435 | @touch($cache_file); |
| @@ -445,10 +448,17 @@ class KTInit { | @@ -445,10 +448,17 @@ class KTInit { | ||
| 445 | $oKTConfig =& KTConfig::getSingleton(); | 448 | $oKTConfig =& KTConfig::getSingleton(); |
| 446 | $sConfigFile = trim(file_get_contents(KT_DIR . "/config/config-path")); | 449 | $sConfigFile = trim(file_get_contents(KT_DIR . "/config/config-path")); |
| 447 | if (KTUtil::isAbsolutePath($sConfigFile)) { | 450 | if (KTUtil::isAbsolutePath($sConfigFile)) { |
| 448 | - $oKTConfig->loadFile($sConfigFile); | 451 | + $res = $oKTConfig->loadFile($sConfigFile); |
| 449 | } else { | 452 | } else { |
| 450 | - $oKTConfig->loadFile(sprintf("%s/%s", KT_DIR, $sConfigFile)); | 453 | + $res = $oKTConfig->loadFile(sprintf("%s/%s", KT_DIR, $sConfigFile)); |
| 451 | } | 454 | } |
| 455 | + | ||
| 456 | + if (PEAR::isError($res)) { | ||
| 457 | + $this->handleInitError($res); | ||
| 458 | + // returns only in checkup | ||
| 459 | + return $res; | ||
| 460 | + } | ||
| 461 | + | ||
| 452 | foreach (array_keys($oKTConfig->flat) as $k) { | 462 | foreach (array_keys($oKTConfig->flat) as $k) { |
| 453 | $v = $oKTConfig->get($k); | 463 | $v = $oKTConfig->get($k); |
| 454 | if ($v === "default") { | 464 | if ($v === "default") { |
| @@ -480,7 +490,10 @@ class KTInit { | @@ -480,7 +490,10 @@ class KTInit { | ||
| 480 | $this->handleInitError(PEAR::raiseError('Test infrastructure not configured')); | 490 | $this->handleInitError(PEAR::raiseError('Test infrastructure not configured')); |
| 481 | exit(0); | 491 | exit(0); |
| 482 | } | 492 | } |
| 483 | - $oKTConfig->loadFile($sConfigFile); | 493 | + $res = $oKTConfig->loadFile($sConfigFile); |
| 494 | + if (PEAR::isError($res)) { | ||
| 495 | + return $res; | ||
| 496 | + } | ||
| 484 | } | 497 | } |
| 485 | // }}} | 498 | // }}} |
| 486 | } | 499 | } |
| @@ -503,10 +516,10 @@ require_once(KT_LIB_DIR . '/ktentity.inc'); | @@ -503,10 +516,10 @@ require_once(KT_LIB_DIR . '/ktentity.inc'); | ||
| 503 | 516 | ||
| 504 | require_once(KT_LIB_DIR . "/config/config.inc.php"); | 517 | require_once(KT_LIB_DIR . "/config/config.inc.php"); |
| 505 | 518 | ||
| 506 | -$KTInit->initConfig(); | ||
| 507 | - | ||
| 508 | $KTInit->setupI18n(); | 519 | $KTInit->setupI18n(); |
| 509 | 520 | ||
| 521 | +$KTInit->initConfig(); | ||
| 522 | + | ||
| 510 | if ($GLOBALS['kt_test']) { | 523 | if ($GLOBALS['kt_test']) { |
| 511 | $KTInit->initTesting(); | 524 | $KTInit->initTesting(); |
| 512 | } | 525 | } |
lib/config/config.inc.php
| @@ -72,6 +72,11 @@ class KTConfig { | @@ -72,6 +72,11 @@ class KTConfig { | ||
| 72 | function loadFile($filename, $bDefault = false) { | 72 | function loadFile($filename, $bDefault = false) { |
| 73 | $c = new Config; | 73 | $c = new Config; |
| 74 | $root =& $c->parseConfig($filename, "IniCommented"); | 74 | $root =& $c->parseConfig($filename, "IniCommented"); |
| 75 | + | ||
| 76 | + if (PEAR::isError($root)) { | ||
| 77 | + return $root; | ||
| 78 | + } | ||
| 79 | + | ||
| 75 | $this->aFileRoot[$filename] =& $root; | 80 | $this->aFileRoot[$filename] =& $root; |
| 76 | 81 | ||
| 77 | $conf =& $root->toArray(); | 82 | $conf =& $root->toArray(); |
lib/documentmanagement/documentutil.inc.php
| @@ -544,7 +544,11 @@ class KTDocumentUtil { | @@ -544,7 +544,11 @@ class KTDocumentUtil { | ||
| 544 | } | 544 | } |
| 545 | $bCanMove = KTUtil::arrayGet($aOptions, 'move'); | 545 | $bCanMove = KTUtil::arrayGet($aOptions, 'move'); |
| 546 | $oStorage =& KTStorageManagerUtil::getSingleton(); | 546 | $oStorage =& KTStorageManagerUtil::getSingleton(); |
| 547 | - $sFilename = tempnam('/tmp', 'kt_storecontents'); | 547 | + |
| 548 | + $oKTConfig =& KTConfig::getSingleton(); | ||
| 549 | + $sBasedir = $oKTConfig->get("urls/tmpDirectory"); | ||
| 550 | + | ||
| 551 | + $sFilename = tempnam($sBasedir, 'kt_storecontents'); | ||
| 548 | $oOutputFile = new KTFSFileLike($sFilename); | 552 | $oOutputFile = new KTFSFileLike($sFilename); |
| 549 | $res = KTFileLikeUtil::copy_contents($oContents, $oOutputFile); | 553 | $res = KTFileLikeUtil::copy_contents($oContents, $oOutputFile); |
| 550 | $sType = KTMime::getMimeTypeFromFile($sFilename); | 554 | $sType = KTMime::getMimeTypeFromFile($sFilename); |
lib/import/zipimportstorage.inc.php
| @@ -33,7 +33,10 @@ class KTZipImportStorage extends KTFSImportStorage { | @@ -33,7 +33,10 @@ class KTZipImportStorage extends KTFSImportStorage { | ||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | function init() { | 35 | function init() { |
| 36 | - $sTmpPath = tempnam('/tmp', 'zipimportstorage'); | 36 | + $oKTConfig =& KTConfig::getSingleton(); |
| 37 | + $sBasedir = $oKTConfig->get("urls/tmpDirectory"); | ||
| 38 | + | ||
| 39 | + $sTmpPath = tempnam($sBasedir, 'zipimportstorage'); | ||
| 37 | if ($sTmpPath === false) { | 40 | if ($sTmpPath === false) { |
| 38 | return PEAR::raiseError("Could not create temporary directory for zip storage"); | 41 | return PEAR::raiseError("Could not create temporary directory for zip storage"); |
| 39 | } | 42 | } |
plugins/ktstandard/KTBulkExportPlugin.php
| @@ -66,6 +66,7 @@ class KTBulkExportAction extends KTFolderAction { | @@ -66,6 +66,7 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 66 | $this->startTransaction(); | 66 | $this->startTransaction(); |
| 67 | 67 | ||
| 68 | $oKTConfig =& KTConfig::getSingleton(); | 68 | $oKTConfig =& KTConfig::getSingleton(); |
| 69 | + $sBasedir = $oKTConfig->get("urls/tmpDirectory"); | ||
| 69 | $bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); | 70 | $bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations"); |
| 70 | 71 | ||
| 71 | if (empty($aDocumentIds)) { | 72 | if (empty($aDocumentIds)) { |
| @@ -79,7 +80,7 @@ class KTBulkExportAction extends KTFolderAction { | @@ -79,7 +80,7 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 79 | $this->oPage->template = "kt3/minimal_page"; | 80 | $this->oPage->template = "kt3/minimal_page"; |
| 80 | $this->handleOutput(""); | 81 | $this->handleOutput(""); |
| 81 | 82 | ||
| 82 | - $sTmpPath = tempnam('/tmp', 'kt_export'); | 83 | + $sTmpPath = tempnam($sBasedir, 'kt_export'); |
| 83 | unlink($sTmpPath); | 84 | unlink($sTmpPath); |
| 84 | mkdir($sTmpPath, 0700); | 85 | mkdir($sTmpPath, 0700); |
| 85 | $this->sTmpPath = $sTmpPath; | 86 | $this->sTmpPath = $sTmpPath; |
plugins/ktstandard/contents/BaseIndexer.php
| @@ -87,9 +87,13 @@ class KTBaseIndexerTrigger { | @@ -87,9 +87,13 @@ class KTBaseIndexerTrigger { | ||
| 87 | if ($this->command != null) { | 87 | if ($this->command != null) { |
| 88 | $tempstub = $this->command; | 88 | $tempstub = $this->command; |
| 89 | } | 89 | } |
| 90 | - $myfilename = tempnam("/tmp", 'kt.' . $tempstub); | 90 | + |
| 91 | + $oKTConfig =& KTConfig::getSingleton(); | ||
| 92 | + $sBasedir = $oKTConfig->get("urls/tmpDirectory"); | ||
| 93 | + | ||
| 94 | + $myfilename = tempnam($sBasedir, 'kt.' . $tempstub); | ||
| 91 | if (OS_WINDOWS) { | 95 | if (OS_WINDOWS) { |
| 92 | - $intermediate = tempnam("/tmp", 'kt.' . $tempstub); | 96 | + $intermediate = tempnam($sBasedir, 'kt.' . $tempstub); |
| 93 | if (!@copy($sFile, $intermediate)) { | 97 | if (!@copy($sFile, $intermediate)) { |
| 94 | return ; | 98 | return ; |
| 95 | } | 99 | } |