Commit 994270c27f511b9d610589dfd49644a89fb48c51
1 parent
0ac83164
KTC-275
"Files that are uploaded with the 'Import from Server Location' is MOVED instead of COPIED to the DMS." Fixed. Added a flag to aOptions to copy a file when uploading to the DMS instead of moving it. Committed By: Megan Watson Reviewed By: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7756 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
19 additions
and
14 deletions
lib/documentmanagement/documentutil.inc.php
| ... | ... | @@ -718,7 +718,7 @@ class KTDocumentUtil { |
| 718 | 718 | $iMimeTypeId = KTMime::getMimeTypeID($sType, $oDocument->getFileName()); |
| 719 | 719 | $oDocument->setMimeTypeId($iMimeTypeId); |
| 720 | 720 | |
| 721 | - $res = $oStorage->upload($oDocument, $sFilename); | |
| 721 | + $res = $oStorage->upload($oDocument, $sFilename, $aOptions); | |
| 722 | 722 | if ($res === false) { |
| 723 | 723 | return PEAR::raiseError(sprintf(_kt("Couldn't store contents: %s"), _kt('No reason given'))); |
| 724 | 724 | } | ... | ... |
lib/import/bulkimport.inc.php
| ... | ... | @@ -150,6 +150,7 @@ class KTBulkImportManager { |
| 150 | 150 | 'metadata' => $this->aMetadata, |
| 151 | 151 | 'documenttype' => $this->oDocumentType, |
| 152 | 152 | ); |
| 153 | + $aOptions = array_merge($aOptions, $this->aOptions); | |
| 153 | 154 | $oDocument =& KTDocumentUtil::add($oFolder, utf8_encode(basename($sPath)), $this->oUser, $aOptions); |
| 154 | 155 | return $oDocument; |
| 155 | 156 | } | ... | ... |
lib/storage/ondiskhashedstoragemanager.inc.php
| ... | ... | @@ -44,7 +44,7 @@ require_once(KT_LIB_DIR . '/documentmanagement/documentcontentversion.inc.php'); |
| 44 | 44 | require_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php'); |
| 45 | 45 | |
| 46 | 46 | class KTOnDiskHashedStorageManager extends KTStorageManager { |
| 47 | - function upload(&$oDocument, $sTmpFilePath) { | |
| 47 | + function upload(&$oDocument, $sTmpFilePath, $aOptions = null) { | |
| 48 | 48 | $oConfig =& KTConfig::getSingleton(); |
| 49 | 49 | $sStoragePath = $this->generateStoragePath($oDocument); |
| 50 | 50 | if (PEAR::isError($sStoragePath)) { |
| ... | ... | @@ -60,7 +60,7 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { |
| 60 | 60 | if (OS_WINDOWS) { |
| 61 | 61 | $sDocumentFileSystemPath = str_replace('\\','/',$sDocumentFileSystemPath); |
| 62 | 62 | } |
| 63 | - if ($this->writeToFile($sTmpFilePath, $sDocumentFileSystemPath)) { | |
| 63 | + if ($this->writeToFile($sTmpFilePath, $sDocumentFileSystemPath, $aOptions)) { | |
| 64 | 64 | $end_time = KTUtil::getBenchmarkTime(); |
| 65 | 65 | global $default; |
| 66 | 66 | $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 { |
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - function writeToFile($sTmpFilePath, $sDocumentFileSystemPath) { | |
| 103 | + function writeToFile($sTmpFilePath, $sDocumentFileSystemPath, $aOptions = null) { | |
| 104 | 104 | // Make it easy to write compressed/encrypted storage |
| 105 | + if(isset($aOptions['copy_upload']) && ($aOptions['copy_upload'] == 'true')) { | |
| 106 | + return copy($sTmpFilePath, $sDocumentFileSystemPath); | |
| 107 | + } | |
| 105 | 108 | |
| 106 | 109 | if (is_uploaded_file($sTmpFilePath)) |
| 107 | 110 | return move_uploaded_file($sTmpFilePath, $sDocumentFileSystemPath); | ... | ... |
plugins/ktcore/folder/BulkImport.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | - * copyright notice. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | * |
| 36 | 36 | */ |
| ... | ... | @@ -60,7 +60,7 @@ class KTBulkImportFolderAction extends KTFolderAction { |
| 60 | 60 | function getInfo() { |
| 61 | 61 | if (!Permission::userIsSystemAdministrator($this->oUser->getId())) { |
| 62 | 62 | return null; |
| 63 | - | |
| 63 | + | |
| 64 | 64 | } |
| 65 | 65 | return parent::getInfo(); |
| 66 | 66 | } |
| ... | ... | @@ -122,6 +122,7 @@ class KTBulkImportFolderAction extends KTFolderAction { |
| 122 | 122 | $aOptions = array( |
| 123 | 123 | 'documenttype' => $oDocumentType, |
| 124 | 124 | 'metadata' => $aFields, |
| 125 | + 'copy_upload' => 'true', | |
| 125 | 126 | ); |
| 126 | 127 | |
| 127 | 128 | $po =& new JavascriptObserver($this); | ... | ... |