Commit 30353d8425fedce68c7a48578016527e3437691a

Authored by Neil Blakey-Milner
1 parent e26262a5

Use the abstract storage manager and KTMime rather than

PhysicalDocumentManager


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3592 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/bulkUploadBL.php
@@ -52,6 +52,11 @@ require_once("$default->fileSystemRoot/presentation/Html.inc"); @@ -52,6 +52,11 @@ require_once("$default->fileSystemRoot/presentation/Html.inc");
52 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); 52 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
53 require_once("bulkUploadUI.inc"); 53 require_once("bulkUploadUI.inc");
54 54
  55 +require_once(KT_LIB_DIR . '/storage/storagemanager.inc.php');
  56 +require_once(KT_LIB_DIR . '/mime.inc.php');
  57 +
  58 +$oStorage =& KTStorageManagerUtil::getSingleton();
  59 +
55 $oPatternCustom = & new PatternCustom(); 60 $oPatternCustom = & new PatternCustom();
56 61
57 /* CHECK: system has required features to handle bulk upload */ 62 /* CHECK: system has required features to handle bulk upload */
@@ -192,7 +197,7 @@ while ($aIndividualFiles) { @@ -192,7 +197,7 @@ while ($aIndividualFiles) {
192 $sBasename = basename($oFile->sFilename); 197 $sBasename = basename($oFile->sFilename);
193 $aFileFake = array( 198 $aFileFake = array(
194 'name' => $sBasename, 199 'name' => $sBasename,
195 - 'type' => PhysicalDocumentManager::getMimeTypeFromFile($oFile->sFilename), 200 + 'type' => KTMime::getMimeTypeFromFile($oFile->sFilename),
196 'tmp_name' => $oFile->sFilename, 201 'tmp_name' => $oFile->sFilename,
197 'error' => 0, 202 'error' => 0,
198 'size' => $oFile->iSize, 203 'size' => $oFile->iSize,
@@ -219,12 +224,14 @@ while ($aIndividualFiles) { @@ -219,12 +224,14 @@ while ($aIndividualFiles) {
219 } 224 }
220 225
221 // if the document was successfully created in the db, store it on the file system 226 // if the document was successfully created in the db, store it on the file system
222 - if (!PhysicalDocumentManager::uploadPhysicalDocument($oDocument, $fFolderID, "None", $oFile->sFilename)) { 227 + if (!$oStorage->upload($oDocument, $oFile->sFilename)) {
223 $default->log->error("bulkUploadBL.php DB error storing document in folder $sFolderPath id=$fFolderID"); 228 $default->log->error("bulkUploadBL.php DB error storing document in folder $sFolderPath id=$fFolderID");
224 $aFileStatus[$sBasename] = _("An error occured while storing the document in the database, please try again") . "."; 229 $aFileStatus[$sBasename] = _("An error occured while storing the document in the database, please try again") . ".";
225 continue; 230 continue;
226 } 231 }
227 232
  233 + $oDocument->update();
  234 +
228 // create the web document link 235 // create the web document link
229 $oWebDocument = & new WebDocument($oDocument->getID(), -1, 1, NOT_PUBLISHED, getCurrentDateTime()); 236 $oWebDocument = & new WebDocument($oDocument->getID(), -1, 1, NOT_PUBLISHED, getCurrentDateTime());
230 if ($oWebDocument->create()) { 237 if ($oWebDocument->create()) {