diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php index 9e76fc3..6b0221a 100644 --- a/lib/documentmanagement/documentutil.inc.php +++ b/lib/documentmanagement/documentutil.inc.php @@ -718,7 +718,7 @@ class KTDocumentUtil { $iMimeTypeId = KTMime::getMimeTypeID($sType, $oDocument->getFileName()); $oDocument->setMimeTypeId($iMimeTypeId); - $res = $oStorage->upload($oDocument, $sFilename); + $res = $oStorage->upload($oDocument, $sFilename, $aOptions); if ($res === false) { return PEAR::raiseError(sprintf(_kt("Couldn't store contents: %s"), _kt('No reason given'))); } diff --git a/lib/import/bulkimport.inc.php b/lib/import/bulkimport.inc.php index abe407a..d92020d 100644 --- a/lib/import/bulkimport.inc.php +++ b/lib/import/bulkimport.inc.php @@ -150,6 +150,7 @@ class KTBulkImportManager { 'metadata' => $this->aMetadata, 'documenttype' => $this->oDocumentType, ); + $aOptions = array_merge($aOptions, $this->aOptions); $oDocument =& KTDocumentUtil::add($oFolder, utf8_encode(basename($sPath)), $this->oUser, $aOptions); return $oDocument; } diff --git a/lib/storage/ondiskhashedstoragemanager.inc.php b/lib/storage/ondiskhashedstoragemanager.inc.php index 7402f28..7f0b5bc 100644 --- a/lib/storage/ondiskhashedstoragemanager.inc.php +++ b/lib/storage/ondiskhashedstoragemanager.inc.php @@ -44,7 +44,7 @@ require_once(KT_LIB_DIR . '/documentmanagement/documentcontentversion.inc.php'); require_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php'); class KTOnDiskHashedStorageManager extends KTStorageManager { - function upload(&$oDocument, $sTmpFilePath) { + function upload(&$oDocument, $sTmpFilePath, $aOptions = null) { $oConfig =& KTConfig::getSingleton(); $sStoragePath = $this->generateStoragePath($oDocument); if (PEAR::isError($sStoragePath)) { @@ -60,7 +60,7 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { if (OS_WINDOWS) { $sDocumentFileSystemPath = str_replace('\\','/',$sDocumentFileSystemPath); } - if ($this->writeToFile($sTmpFilePath, $sDocumentFileSystemPath)) { + if ($this->writeToFile($sTmpFilePath, $sDocumentFileSystemPath, $aOptions)) { $end_time = KTUtil::getBenchmarkTime(); global $default; $default->log->info(sprintf("Uploaded %d byte file in %.3f seconds", $file_size, $end_time - $start_time)); @@ -100,8 +100,11 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { return false; } - function writeToFile($sTmpFilePath, $sDocumentFileSystemPath) { + function writeToFile($sTmpFilePath, $sDocumentFileSystemPath, $aOptions = null) { // Make it easy to write compressed/encrypted storage + if(isset($aOptions['copy_upload']) && ($aOptions['copy_upload'] == 'true')) { + return copy($sTmpFilePath, $sDocumentFileSystemPath); + } if (is_uploaded_file($sTmpFilePath)) return move_uploaded_file($sTmpFilePath, $sDocumentFileSystemPath); diff --git a/plugins/ktcore/folder/BulkImport.php b/plugins/ktcore/folder/BulkImport.php index bc80c8d..74ba7fa 100644 --- a/plugins/ktcore/folder/BulkImport.php +++ b/plugins/ktcore/folder/BulkImport.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -60,7 +60,7 @@ class KTBulkImportFolderAction extends KTFolderAction { function getInfo() { if (!Permission::userIsSystemAdministrator($this->oUser->getId())) { return null; - + } return parent::getInfo(); } @@ -122,6 +122,7 @@ class KTBulkImportFolderAction extends KTFolderAction { $aOptions = array( 'documenttype' => $oDocumentType, 'metadata' => $aFields, + 'copy_upload' => 'true', ); $po =& new JavascriptObserver($this);