Commit 4516386b27c86dcc56e1ab527308719f756fb864

Authored by Michael Joseph
1 parent daf44c81

implemented cleanup on expunge (fixes #2680)


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2308 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/expungeDeletedDocumentsBL.php
... ... @@ -7,8 +7,8 @@ require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentMa
7 7 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc");
8 8 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
9 9 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
  10 +require_once("$default->fileSystemRoot/lib/web/WebDocument.inc");
10 11 require_once("$default->uiDirectory/documentmanagement/documentUI.inc");
11   -
12 12 require_once("expungeDeletedDocumentsUI.inc");
13 13 require_once("$default->fileSystemRoot/presentation/Html.inc");
14 14  
... ... @@ -46,13 +46,26 @@ if (checkSession()) {
46 46 if (PhysicalDocumentManager::expunge($aDocuments[$i])) {
47 47 // delete this from the db now
48 48 if ($aDocuments[$i]->delete()) {
  49 + // removed succesfully
49 50 $aSuccessDocuments[] = $aDocuments[$i]->getDisplayPath();
  51 +
  52 + // remove any document data
  53 + $aDocuments[$i]->cleanupDocumentData($fDocumentIDs[$i]);
  54 +
  55 + // delete the corresponding web document entry
  56 + $oWebDocument = WebDocument::get(lookupID($default->owl_web_documents_table, "document_id", $fDocumentIDs[$i]));
  57 + $oWebDocument->delete();
  58 +
  59 + // store an expunge transaction
  60 + $oDocumentTransaction = & new DocumentTransaction($fDocumentIDs[$i], "Document expunged", EXPUNGE);
  61 + $oDocumentTransaction->create();
  62 +
50 63 } else {
51   - $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $aDocuments[$i]->getID() . " from the db");
  64 + $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $fDocumentIDs[$i] . " from the db");
52 65 $aErrorDocuments[] = $aDocuments[$i]->getDisplayPath();
53 66 }
54 67 } else {
55   - $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $aDocuments[$i]->getID() . " from the filesystem");
  68 + $default->log->error("expungeDeletedDocumentsBL.php couldn't rm docID=" . $fDocumentIDs[$i] . " from the filesystem");
56 69 $aErrorDocuments[] = $aDocuments[$i]->getDisplayPath();
57 70 }
58 71 }
... ...