Commit 306d8a559c9a609751287e39ff0aae686b223594
1 parent
03722a41
Add create and move folder transactions. Clear document and folder
caches after a folder move. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5281 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
24 additions
and
0 deletions
lib/foldermanagement/folderutil.inc.php
| ... | ... | @@ -31,6 +31,8 @@ require_once(KT_LIB_DIR . '/permissions/permission.inc.php'); |
| 31 | 31 | require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php'); |
| 32 | 32 | require_once(KT_LIB_DIR . '/users/User.inc'); |
| 33 | 33 | |
| 34 | +require_once(KT_LIB_DIR . '/foldermanagement/foldertransaction.inc.php'); | |
| 35 | + | |
| 34 | 36 | require_once(KT_LIB_DIR . '/database/dbutil.inc'); |
| 35 | 37 | |
| 36 | 38 | class KTFolderUtil { |
| ... | ... | @@ -59,6 +61,14 @@ class KTFolderUtil { |
| 59 | 61 | return $oFolder; |
| 60 | 62 | } |
| 61 | 63 | |
| 64 | + $oTransaction = KTFolderTransaction::createFromArray(array( | |
| 65 | + 'folderid' => $oFolder->getId(), | |
| 66 | + 'comment' => "Folder created", | |
| 67 | + 'transactionNS' => 'ktcore.transactions.create', | |
| 68 | + 'userid' => $oUser->getId(), | |
| 69 | + 'ip' => Session::getClientIP(), | |
| 70 | + )); | |
| 71 | + | |
| 62 | 72 | // fire subscription alerts for the new folder |
| 63 | 73 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 64 | 74 | $oSubscriptionEvent->AddFolder($oFolder, $oParentFolder); |
| ... | ... | @@ -82,6 +92,8 @@ class KTFolderUtil { |
| 82 | 92 | $sNewParentFolderIds = sprintf("%s,%s", $oNewParentFolder->getParentFolderIDs(), $oNewParentFolder->getID()); |
| 83 | 93 | } |
| 84 | 94 | |
| 95 | + $sOldPath = $oFolder->getFullPath(); | |
| 96 | + | |
| 85 | 97 | if ($oNewParentFolder->getId() == 1) { |
| 86 | 98 | } else { |
| 87 | 99 | $sNewParentFolderPath = sprintf("%s/%s", $oNewParentFolder->getFullPath(), $oNewParentFolder->getName()); |
| ... | ... | @@ -135,6 +147,18 @@ class KTFolderUtil { |
| 135 | 147 | if (PEAR::isError($res)) { |
| 136 | 148 | return $res; |
| 137 | 149 | } |
| 150 | + | |
| 151 | + $oTransaction = KTFolderTransaction::createFromArray(array( | |
| 152 | + 'folderid' => $oFolder->getId(), | |
| 153 | + 'comment' => sprintf("Folder moved from %s to %s", $sOldPath, $sNewParentFolderPath), | |
| 154 | + 'transactionNS' => 'ktcore.transactions.move', | |
| 155 | + 'userid' => $oUser->getId(), | |
| 156 | + 'ip' => Session::getClientIP(), | |
| 157 | + )); | |
| 158 | + | |
| 159 | + Document::clearAllCaches(); | |
| 160 | + Folder::clearAllCaches(); | |
| 161 | + | |
| 138 | 162 | return; |
| 139 | 163 | } |
| 140 | 164 | ... | ... |