Commit 12398b72bfa5e6809e054944396294f88c50eeba

Authored by Jonathan Byrne
1 parent 215cb994

KTS-2745

"More detailed errors need to be returned when a failure occurs when adding a document."

Fixed. Added more detailed error messages.

Committed By: Jonathan Byrne
Reviewed By: Jalaloedien Abrahams

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7771 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/storage/ondiskhashedstoragemanager.inc.php
... ... @@ -45,6 +45,13 @@ require_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php');
45 45  
46 46 class KTOnDiskHashedStorageManager extends KTStorageManager {
47 47 function upload(&$oDocument, $sTmpFilePath, $aOptions = null) {
  48 +
  49 + if (!file_exists($sTmpFilePath)) {
  50 +
  51 + return new PEAR_Error("$sTmpFilePath does not exist so we can't copy it into the repository! Options: " . print_r($aOptions,true) );
  52 + }
  53 +
  54 +
48 55 $oConfig =& KTConfig::getSingleton();
49 56 $sStoragePath = $this->generateStoragePath($oDocument);
50 57 if (PEAR::isError($sStoragePath)) {
... ... @@ -70,10 +77,10 @@ class KTOnDiskHashedStorageManager extends KTStorageManager {
70 77 if (file_exists($sDocumentFileSystemPath)) {
71 78 return true;
72 79 } else {
73   - return false;
  80 + return new PEAR_Error("$sDocumentFileSystemPath does not exist after write to storage path. Options: " . print_r($aOptions,true));
74 81 }
75 82 } else {
76   - return false;
  83 + return new PEAR_Error("Could not write $sTmpFilePath to $sDocumentFileSystemPath with options: " . print_r($aOptions,true));
77 84 }
78 85 }
79 86  
... ...