Commit 4503024339d4e117c0b5c9077b530bf9c75b870d
1 parent
6c26629f
Merged in from DEV trunk...
KTS-3103 "addDocument error when using KTOnDiskPathStorageManager: uploadTmpFile function does not exist" Fixed. Added the uploadTmpFile function. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8892 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
55 additions
and
21 deletions
lib/storage/ondiskpathstoragemanager.inc.php
| ... | ... | @@ -16,31 +16,31 @@ |
| 16 | 16 | * Document Management Made Simple |
| 17 | 17 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 18 | 18 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 19 | - * | |
| 19 | + * | |
| 20 | 20 | * This program is free software; you can redistribute it and/or modify it under |
| 21 | 21 | * the terms of the GNU General Public License version 3 as published by the |
| 22 | 22 | * Free Software Foundation. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 25 | 25 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 26 | 26 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 27 | 27 | * details. |
| 28 | - * | |
| 28 | + * | |
| 29 | 29 | * You should have received a copy of the GNU General Public License |
| 30 | 30 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 31 | - * | |
| 32 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 31 | + * | |
| 32 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 33 | 33 | * California 94120-7775, or email info@knowledgetree.com. |
| 34 | - * | |
| 34 | + * | |
| 35 | 35 | * The interactive user interfaces in modified source and object code versions |
| 36 | 36 | * of this program must display Appropriate Legal Notices, as required under |
| 37 | 37 | * Section 5 of the GNU General Public License version 3. |
| 38 | - * | |
| 38 | + * | |
| 39 | 39 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 40 | 40 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 41 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 41 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 42 | 42 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 43 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 43 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 44 | 44 | * copyright notice. |
| 45 | 45 | * Contributor( s): ______________________________________ |
| 46 | 46 | */ |
| ... | ... | @@ -83,6 +83,29 @@ class KTOnDiskPathStorageManager extends KTStorageManager { |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | + /** | |
| 87 | + * Upload a temporary file | |
| 88 | + * | |
| 89 | + * @param unknown_type $sUploadedFile | |
| 90 | + * @param unknown_type $sTmpFilePath | |
| 91 | + * @return unknown | |
| 92 | + */ | |
| 93 | + function uploadTmpFile($sUploadedFile, $sTmpFilePath) { | |
| 94 | + | |
| 95 | + //copy the file accross | |
| 96 | + if (OS_WINDOWS) { | |
| 97 | + $sTmpFilePath = str_replace('\\','/',$sTmpFilePath); | |
| 98 | + } | |
| 99 | + if ($this->writeToFile($sUploadedFile, $sTmpFilePath)) { | |
| 100 | + if (file_exists($sTmpFilePath)) { | |
| 101 | + return true; | |
| 102 | + } else { | |
| 103 | + return false; | |
| 104 | + } | |
| 105 | + } | |
| 106 | + return false; | |
| 107 | + } | |
| 108 | + | |
| 86 | 109 | function getPath(&$oDocument) { |
| 87 | 110 | return $oDocument->getStoragePath(); |
| 88 | 111 | } |
| ... | ... | @@ -406,7 +429,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { |
| 406 | 429 | } |
| 407 | 430 | return true; |
| 408 | 431 | } |
| 409 | - | |
| 432 | + | |
| 410 | 433 | /** |
| 411 | 434 | * Completely remove a document version |
| 412 | 435 | * |
| ... | ... | @@ -417,7 +440,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { |
| 417 | 440 | $sDocumentRoot = $oConfig->get('urls/documentRoot'); |
| 418 | 441 | $iContentId = $oVersion->getContentVersionId(); |
| 419 | 442 | $oContentVersion = KTDocumentContentVersion::get($iContentId); |
| 420 | - | |
| 443 | + | |
| 421 | 444 | $sPath = $oContentVersion->getStoragePath(); |
| 422 | 445 | $sFullPath = sprintf("%s/%s", $sDocumentRoot, $sPath); |
| 423 | 446 | if (file_exists($sFullPath)) { | ... | ... |
lib/storage/storagemanager.inc.php
| ... | ... | @@ -6,31 +6,31 @@ |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 8 | 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 9 | - * | |
| 9 | + * | |
| 10 | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | 11 | * the terms of the GNU General Public License version 3 as published by the |
| 12 | 12 | * Free Software Foundation. |
| 13 | - * | |
| 13 | + * | |
| 14 | 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 17 | 17 | * details. |
| 18 | - * | |
| 18 | + * | |
| 19 | 19 | * You should have received a copy of the GNU General Public License |
| 20 | 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | - * | |
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 21 | + * | |
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | 23 | * California 94120-7775, or email info@knowledgetree.com. |
| 24 | - * | |
| 24 | + * | |
| 25 | 25 | * The interactive user interfaces in modified source and object code versions |
| 26 | 26 | * of this program must display Appropriate Legal Notices, as required under |
| 27 | 27 | * Section 5 of the GNU General Public License version 3. |
| 28 | - * | |
| 28 | + * | |
| 29 | 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 30 | 30 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 32 | 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 34 | 34 | * copyright notice. |
| 35 | 35 | * Contributor( s): ______________________________________ |
| 36 | 36 | * |
| ... | ... | @@ -53,6 +53,17 @@ class KTStorageManager { |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | + * Upload a temporary file | |
| 57 | + * | |
| 58 | + * @param unknown_type $sUploadedFile | |
| 59 | + * @param unknown_type $sTmpFilePath | |
| 60 | + * @return unknown | |
| 61 | + */ | |
| 62 | + function uploadTmpFile($sUploadedFile, $sTmpFilePath) { | |
| 63 | + return PEAR::raiseError(_kt('Not implemented')); | |
| 64 | + } | |
| 65 | + | |
| 66 | + /** | |
| 56 | 67 | * Gets the latest verison of a document's contents from storage and |
| 57 | 68 | * writes it to the standard content with HTTP headers as an |
| 58 | 69 | * attachment. |
| ... | ... | @@ -135,7 +146,7 @@ class KTStorageManager { |
| 135 | 146 | function deleteVersion(&$oVersion) { |
| 136 | 147 | return PEAR::raiseError(_kt("Not implemented")); |
| 137 | 148 | } |
| 138 | - | |
| 149 | + | |
| 139 | 150 | /** |
| 140 | 151 | * Performs any storage changes necessary to account for the |
| 141 | 152 | * document (previously marked as deleted) being restored. | ... | ... |