Commit e456bb951b47f34490978d99b1db4af8db3a6a9c

Authored by megan_w
1 parent f7b6f26d

Merged in from DEV trunk...

KTC-275
"Files that are uploaded with the 'Import from Server Location' is MOVED instead of COPIED to the DMS."
Fixed. Added a check to ensure the temp file is from an upload before deleting.

Committed By: Megan Watson
Reviewed By: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.4.5-Release-Branch@7755 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/documentutil.inc.php
@@ -580,8 +580,8 @@ class KTDocumentUtil { @@ -580,8 +580,8 @@ class KTDocumentUtil {
580 } 580 }
581 KTDocumentUtil::setComplete($oDocument, 'contents'); 581 KTDocumentUtil::setComplete($oDocument, 'contents');
582 582
583 - if ($aOptions['cleanup_initial_file']) {  
584 - //@unlink($sFilename); 583 + if ($aOptions['cleanup_initial_file'] && file_exists($sFilename)) {
  584 + @unlink($sFilename);
585 } 585 }
586 586
587 return true; 587 return true;
lib/storage/ondiskhashedstoragemanager.inc.php
@@ -59,8 +59,10 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { @@ -59,8 +59,10 @@ class KTOnDiskHashedStorageManager extends KTStorageManager {
59 global $default; 59 global $default;
60 $default->log->info(sprintf("Uploaded %d byte file in %.3f seconds", $file_size, $end_time - $start_time)); 60 $default->log->info(sprintf("Uploaded %d byte file in %.3f seconds", $file_size, $end_time - $start_time));
61 61
62 - //remove the temporary file  
63 - @unlink($sTmpFilePath); 62 + //remove the temporary file if it was uploaded
  63 + if (is_uploaded_file($sTmpFilePath)){
  64 + @unlink($sTmpFilePath);
  65 + }
64 if (file_exists($sDocumentFileSystemPath)) { 66 if (file_exists($sDocumentFileSystemPath)) {
65 return true; 67 return true;
66 } else { 68 } else {