summaryrefslogtreecommitdiffstats
path: root/lib/private/share/helper.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-06-24 17:04:27 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-06-25 12:11:56 +0200
commita0b85fc5e4a56ff553f224083cbdf87cd05ec55a (patch)
treeb44fc4364013d26f2f477ab822ebfb5fd6c7891f /lib/private/share/helper.php
parent89f26915152e5aaf357b2aa633d5bea954e4bcc2 (diff)
downloadnextcloud-server-a0b85fc5e4a56ff553f224083cbdf87cd05ec55a.tar.gz
nextcloud-server-a0b85fc5e4a56ff553f224083cbdf87cd05ec55a.zip
make sure that during share and unshare the etags get propagated correctly
Diffstat (limited to 'lib/private/share/helper.php')
-rw-r--r--lib/private/share/helper.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index 71c6d8517a9..46e3c280488 100644
--- a/lib/private/share/helper.php
+++ b/lib/private/share/helper.php
@@ -149,17 +149,18 @@ class Helper extends \OC\Share\Constants {
*/
public static function delete($parent, $excludeParent = false, $uidOwner = null) {
$ids = array($parent);
+ $deletedItems = array();
$parents = array($parent);
while (!empty($parents)) {
$parents = "'".implode("','", $parents)."'";
// Check the owner on the first search of reshares, useful for
// finding and deleting the reshares by a single user of a group share
if (count($ids) == 1 && isset($uidOwner)) {
- $query = \OC_DB::prepare('SELECT `id`, `uid_owner`, `item_type`, `item_target`, `parent`'
+ $query = \OC_DB::prepare('SELECT `id`, `share_with`, `item_type`, `share_type`, `item_target`, `file_target`, `parent`'
.' FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') AND `uid_owner` = ?');
$result = $query->execute(array($uidOwner));
} else {
- $query = \OC_DB::prepare('SELECT `id`, `item_type`, `item_target`, `parent`, `uid_owner`'
+ $query = \OC_DB::prepare('SELECT `id`, `share_with`, `item_type`, `share_type`, `item_target`, `file_target`, `parent`, `uid_owner`'
.' FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.')');
$result = $query->execute();
}
@@ -168,16 +169,29 @@ class Helper extends \OC\Share\Constants {
while ($item = $result->fetchRow()) {
$ids[] = $item['id'];
$parents[] = $item['id'];
+ $tmpItem = array(
+ 'id' => $item['id'],
+ 'shareWith' => $item['share_with'],
+ 'itemTarget' => $item['item_target'],
+ 'itemType' => $item['item_type'],
+ 'shareType' => (int)$item['share_type'],
+ );
+ if (isset($item['file_target'])) {
+ $tmpItem['fileTarget'] = $item['file_target'];
+ }
+ $deletedItems[] = $tmpItem;
}
}
if ($excludeParent) {
unset($ids[0]);
}
if (!empty($ids)) {
- $ids = "'".implode("','", $ids)."'";
- $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `id` IN ('.$ids.')');
+ $idList = "'".implode("','", $ids)."'";
+ $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `id` IN ('.$idList.')');
$query->execute();
}
+
+ return $deletedItems;
}
/**