Commit 86106a79acfcc2ad73d2ac63dc12fb42beaf02c5
1 parent
dd4ece67
remove folder subscriptions on deletion
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1278 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
18 additions
and
3 deletions
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php
| @@ -14,6 +14,7 @@ require_once("../../../../config/dmsDefaults.php"); | @@ -14,6 +14,7 @@ require_once("../../../../config/dmsDefaults.php"); | ||
| 14 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | 14 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); |
| 15 | require_once("$default->fileSystemRoot/lib/foldermanagement/PhysicalFolderManagement.inc"); | 15 | require_once("$default->fileSystemRoot/lib/foldermanagement/PhysicalFolderManagement.inc"); |
| 16 | require_once("$default->fileSystemRoot/lib/users/User.inc"); | 16 | require_once("$default->fileSystemRoot/lib/users/User.inc"); |
| 17 | +require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); | ||
| 17 | require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc"); | 18 | require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc"); |
| 18 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | 19 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 19 | require_once("$default->fileSystemRoot/presentation/Html.inc"); | 20 | require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| @@ -38,12 +39,26 @@ if (checkSession()) { | @@ -38,12 +39,26 @@ if (checkSession()) { | ||
| 38 | if (PhysicalFolderManagement::deleteFolder($sFolderPath)) { | 39 | if (PhysicalFolderManagement::deleteFolder($sFolderPath)) { |
| 39 | // successfully deleted the folder from the file system | 40 | // successfully deleted the folder from the file system |
| 40 | 41 | ||
| 42 | + // fire subscription alerts for parent folder subscriptions to the deleted folder | ||
| 43 | + $count = SubscriptionEngine::fireSubscription($oFolder->getParentID(), SubscriptionConstants::subscriptionAlertType("RemoveChildFolder"), | ||
| 44 | + SubscriptionConstants::subscriptionType("FolderSubscription"), | ||
| 45 | + array( "removedFolderName" => $oFolder->getName(), | ||
| 46 | + "parentFolderName" => Folder::getFolderDisplayPath($oFolder->getParentID()))); | ||
| 47 | + $default->log->info("deleteFolderBL.php fired $count parent folder subscription alerts for removed folder " . $oFolder->getName()); | ||
| 48 | + | ||
| 41 | // fire subscription alerts for the deleted folder | 49 | // fire subscription alerts for the deleted folder |
| 42 | - $count = SubscriptionEngine::fireSubscription($fFolderID, SubscriptionConstants::subscriptionAlertType("RemoveFolder"), | 50 | + $count = SubscriptionEngine::fireSubscription($fFolderID, SubscriptionConstants::subscriptionAlertType("RemoveSubscribedFolder"), |
| 43 | SubscriptionConstants::subscriptionType("FolderSubscription"), | 51 | SubscriptionConstants::subscriptionType("FolderSubscription"), |
| 44 | array( "removedFolderName" => $oFolder->getName(), | 52 | array( "removedFolderName" => $oFolder->getName(), |
| 45 | - "parentFolderName" => Folder::getFolderName($oFolder->getParentID()))); | ||
| 46 | - $default->log->info("deleteFolderBL.php fired $count subscription alerts for removed folder " . $oFolder->getName()); | 53 | + "parentFolderName" => Folder::getFolderDisplayPath($oFolder->getParentID()))); |
| 54 | + $default->log->info("deleteFolderBL.php fired $count parent folder subscription alerts for removed folder " . $oFolder->getName()); | ||
| 55 | + | ||
| 56 | + // remove folder subscriptions for this folder | ||
| 57 | + if (SubscriptionManager::removeSubscriptions($fFolderID, SubscriptionConstants::subscriptionType("FolderSubscription"))) { | ||
| 58 | + $default->log->info("deleteFolderBL.php removed all subscriptions for this folder"); | ||
| 59 | + } else { | ||
| 60 | + $default->log->error("deleteFolderBL.php couldn't remove folder subscriptions"); | ||
| 61 | + } | ||
| 47 | 62 | ||
| 48 | // redirect to the browse folder page with the parent folder id | 63 | // redirect to the browse folder page with the parent folder id |
| 49 | redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oFolder->getParentID()); | 64 | redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oFolder->getParentID()); |