Commit fdfe840c95bc856932cca4f9f85a211cf0a98375

Authored by Brad Shuttleworth
1 parent 0accce78

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
config/config-path
1   -config/config.ini
  1 +config/config-brad.ini
... ...
config/config.ini
... ... @@ -149,6 +149,7 @@ varDirectory = ${fileSystemRoot}/var
149 149 logDirectory = ${varDirectory}/log
150 150 documentRoot = ${varDirectory}/Documents
151 151 uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree
  152 +tmpDirectory = ${varDirectory}/tmp
152 153  
153 154 ; urls
154 155 graphicsUrl = ${rootUrl}/graphics
... ...
config/dmsDefaults.php
... ... @@ -403,6 +403,8 @@ class KTInit {
403 403 $oKTConfig->setdefaultns("KnowledgeTree", "pathInfoSupport", false);
404 404 $oKTConfig->setdefaultns("storage", "manager", 'KTOnDiskHashedStorageManager');
405 405 $oKTConfig->setdefaultns("config", "useDatabaseConfiguration", false);
  406 +
  407 + $oKTConfig->setdefaultns("urls", "tmpDirectory", '${varDirectory}/tmp');
406 408  
407 409 $oKTConfig->setdefaultns("tweaks", "browseToUnitFolder", false);
408 410 $oKTConfig->setdefaultns("tweaks", "genericMetaDataRequired", true);
... ... @@ -426,7 +428,8 @@ class KTInit {
426 428 $oKTConfig->setdefaultns("cache", "proxyCacheDirectory", '${varDirectory}/proxies');
427 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 434 $oKTConfig =& KTConfig::getSingleton();
432 435 @touch($cache_file);
... ... @@ -445,10 +448,17 @@ class KTInit {
445 448 $oKTConfig =& KTConfig::getSingleton();
446 449 $sConfigFile = trim(file_get_contents(KT_DIR . "/config/config-path"));
447 450 if (KTUtil::isAbsolutePath($sConfigFile)) {
448   - $oKTConfig->loadFile($sConfigFile);
  451 + $res = $oKTConfig->loadFile($sConfigFile);
449 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 462 foreach (array_keys($oKTConfig->flat) as $k) {
453 463 $v = $oKTConfig->get($k);
454 464 if ($v === "default") {
... ... @@ -480,7 +490,10 @@ class KTInit {
480 490 $this->handleInitError(PEAR::raiseError('Test infrastructure not configured'));
481 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 516  
504 517 require_once(KT_LIB_DIR . "/config/config.inc.php");
505 518  
506   -$KTInit->initConfig();
507   -
508 519 $KTInit->setupI18n();
509 520  
  521 +$KTInit->initConfig();
  522 +
510 523 if ($GLOBALS['kt_test']) {
511 524 $KTInit->initTesting();
512 525 }
... ...
lib/config/config.inc.php
... ... @@ -72,6 +72,11 @@ class KTConfig {
72 72 function loadFile($filename, $bDefault = false) {
73 73 $c = new Config;
74 74 $root =& $c->parseConfig($filename, "IniCommented");
  75 +
  76 + if (PEAR::isError($root)) {
  77 + return $root;
  78 + }
  79 +
75 80 $this->aFileRoot[$filename] =& $root;
76 81  
77 82 $conf =& $root->toArray();
... ...
lib/documentmanagement/documentutil.inc.php
... ... @@ -544,7 +544,11 @@ class KTDocumentUtil {
544 544 }
545 545 $bCanMove = KTUtil::arrayGet($aOptions, 'move');
546 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 552 $oOutputFile = new KTFSFileLike($sFilename);
549 553 $res = KTFileLikeUtil::copy_contents($oContents, $oOutputFile);
550 554 $sType = KTMime::getMimeTypeFromFile($sFilename);
... ...
lib/import/zipimportstorage.inc.php
... ... @@ -33,7 +33,10 @@ class KTZipImportStorage extends KTFSImportStorage {
33 33 }
34 34  
35 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 40 if ($sTmpPath === false) {
38 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 66 $this->startTransaction();
67 67  
68 68 $oKTConfig =& KTConfig::getSingleton();
  69 + $sBasedir = $oKTConfig->get("urls/tmpDirectory");
69 70 $bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations");
70 71  
71 72 if (empty($aDocumentIds)) {
... ... @@ -79,7 +80,7 @@ class KTBulkExportAction extends KTFolderAction {
79 80 $this->oPage->template = "kt3/minimal_page";
80 81 $this->handleOutput("");
81 82  
82   - $sTmpPath = tempnam('/tmp', 'kt_export');
  83 + $sTmpPath = tempnam($sBasedir, 'kt_export');
83 84 unlink($sTmpPath);
84 85 mkdir($sTmpPath, 0700);
85 86 $this->sTmpPath = $sTmpPath;
... ...
plugins/ktstandard/contents/BaseIndexer.php
... ... @@ -87,9 +87,13 @@ class KTBaseIndexerTrigger {
87 87 if ($this->command != null) {
88 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 95 if (OS_WINDOWS) {
92   - $intermediate = tempnam("/tmp", 'kt.' . $tempstub);
  96 + $intermediate = tempnam($sBasedir, 'kt.' . $tempstub);
93 97 if (!@copy($sFile, $intermediate)) {
94 98 return ;
95 99 }
... ...