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,31 +16,31 @@ | ||
| 16 | * Document Management Made Simple | 16 | * Document Management Made Simple |
| 17 | * Copyright (C) 2008 KnowledgeTree Inc. | 17 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 18 | * Portions copyright The Jam Warehouse Software (Pty) Limited | 18 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 19 | - * | 19 | + * |
| 20 | * This program is free software; you can redistribute it and/or modify it under | 20 | * This program is free software; you can redistribute it and/or modify it under |
| 21 | * the terms of the GNU General Public License version 3 as published by the | 21 | * the terms of the GNU General Public License version 3 as published by the |
| 22 | * Free Software Foundation. | 22 | * Free Software Foundation. |
| 23 | - * | 23 | + * |
| 24 | * This program is distributed in the hope that it will be useful, but WITHOUT | 24 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 25 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 25 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 26 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 26 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 27 | * details. | 27 | * details. |
| 28 | - * | 28 | + * |
| 29 | * You should have received a copy of the GNU General Public License | 29 | * You should have received a copy of the GNU General Public License |
| 30 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 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 | * California 94120-7775, or email info@knowledgetree.com. | 33 | * California 94120-7775, or email info@knowledgetree.com. |
| 34 | - * | 34 | + * |
| 35 | * The interactive user interfaces in modified source and object code versions | 35 | * The interactive user interfaces in modified source and object code versions |
| 36 | * of this program must display Appropriate Legal Notices, as required under | 36 | * of this program must display Appropriate Legal Notices, as required under |
| 37 | * Section 5 of the GNU General Public License version 3. | 37 | * Section 5 of the GNU General Public License version 3. |
| 38 | - * | 38 | + * |
| 39 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 39 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 40 | * these Appropriate Legal Notices must retain the display of the "Powered by | 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 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 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 | * copyright notice. | 44 | * copyright notice. |
| 45 | * Contributor( s): ______________________________________ | 45 | * Contributor( s): ______________________________________ |
| 46 | */ | 46 | */ |
| @@ -83,6 +83,29 @@ class KTOnDiskPathStorageManager extends KTStorageManager { | @@ -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 | function getPath(&$oDocument) { | 109 | function getPath(&$oDocument) { |
| 87 | return $oDocument->getStoragePath(); | 110 | return $oDocument->getStoragePath(); |
| 88 | } | 111 | } |
| @@ -406,7 +429,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { | @@ -406,7 +429,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { | ||
| 406 | } | 429 | } |
| 407 | return true; | 430 | return true; |
| 408 | } | 431 | } |
| 409 | - | 432 | + |
| 410 | /** | 433 | /** |
| 411 | * Completely remove a document version | 434 | * Completely remove a document version |
| 412 | * | 435 | * |
| @@ -417,7 +440,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { | @@ -417,7 +440,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { | ||
| 417 | $sDocumentRoot = $oConfig->get('urls/documentRoot'); | 440 | $sDocumentRoot = $oConfig->get('urls/documentRoot'); |
| 418 | $iContentId = $oVersion->getContentVersionId(); | 441 | $iContentId = $oVersion->getContentVersionId(); |
| 419 | $oContentVersion = KTDocumentContentVersion::get($iContentId); | 442 | $oContentVersion = KTDocumentContentVersion::get($iContentId); |
| 420 | - | 443 | + |
| 421 | $sPath = $oContentVersion->getStoragePath(); | 444 | $sPath = $oContentVersion->getStoragePath(); |
| 422 | $sFullPath = sprintf("%s/%s", $sDocumentRoot, $sPath); | 445 | $sFullPath = sprintf("%s/%s", $sDocumentRoot, $sPath); |
| 423 | if (file_exists($sFullPath)) { | 446 | if (file_exists($sFullPath)) { |
lib/storage/storagemanager.inc.php
| @@ -6,31 +6,31 @@ | @@ -6,31 +6,31 @@ | ||
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2008 KnowledgeTree Inc. | 7 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited | 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 9 | - * | 9 | + * |
| 10 | * This program is free software; you can redistribute it and/or modify it under | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | * the terms of the GNU General Public License version 3 as published by the | 11 | * the terms of the GNU General Public License version 3 as published by the |
| 12 | * Free Software Foundation. | 12 | * Free Software Foundation. |
| 13 | - * | 13 | + * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT | 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 17 | * details. | 17 | * details. |
| 18 | - * | 18 | + * |
| 19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 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 | * California 94120-7775, or email info@knowledgetree.com. | 23 | * California 94120-7775, or email info@knowledgetree.com. |
| 24 | - * | 24 | + * |
| 25 | * The interactive user interfaces in modified source and object code versions | 25 | * The interactive user interfaces in modified source and object code versions |
| 26 | * of this program must display Appropriate Legal Notices, as required under | 26 | * of this program must display Appropriate Legal Notices, as required under |
| 27 | * Section 5 of the GNU General Public License version 3. | 27 | * Section 5 of the GNU General Public License version 3. |
| 28 | - * | 28 | + * |
| 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 30 | * these Appropriate Legal Notices must retain the display of the "Powered by | 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 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 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 | * copyright notice. | 34 | * copyright notice. |
| 35 | * Contributor( s): ______________________________________ | 35 | * Contributor( s): ______________________________________ |
| 36 | * | 36 | * |
| @@ -53,6 +53,17 @@ class KTStorageManager { | @@ -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 | * Gets the latest verison of a document's contents from storage and | 67 | * Gets the latest verison of a document's contents from storage and |
| 57 | * writes it to the standard content with HTTP headers as an | 68 | * writes it to the standard content with HTTP headers as an |
| 58 | * attachment. | 69 | * attachment. |
| @@ -135,7 +146,7 @@ class KTStorageManager { | @@ -135,7 +146,7 @@ class KTStorageManager { | ||
| 135 | function deleteVersion(&$oVersion) { | 146 | function deleteVersion(&$oVersion) { |
| 136 | return PEAR::raiseError(_kt("Not implemented")); | 147 | return PEAR::raiseError(_kt("Not implemented")); |
| 137 | } | 148 | } |
| 138 | - | 149 | + |
| 139 | /** | 150 | /** |
| 140 | * Performs any storage changes necessary to account for the | 151 | * Performs any storage changes necessary to account for the |
| 141 | * document (previously marked as deleted) being restored. | 152 | * document (previously marked as deleted) being restored. |