summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-03 20:18:56 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-03 20:18:56 +0100
commit81b97217007364231ddb796567841ebd139e06e0 (patch)
tree98f320ae849cb10bbc80ba5d7532b82f33727fd3
parenta3cc448c9dba0693feedd7f304b83ce16aee16ca (diff)
downloadnextcloud-server-81b97217007364231ddb796567841ebd139e06e0.tar.gz
nextcloud-server-81b97217007364231ddb796567841ebd139e06e0.zip
Remove entries in dav_shares on deletion of a calendar
-rw-r--r--apps/dav/lib/caldav/caldavbackend.php2
-rw-r--r--apps/dav/lib/carddav/carddavbackend.php5
-rw-r--r--apps/dav/lib/dav/sharing/backend.php11
3 files changed, 14 insertions, 4 deletions
diff --git a/apps/dav/lib/caldav/caldavbackend.php b/apps/dav/lib/caldav/caldavbackend.php
index 4820116e9a6..3aa493e5087 100644
--- a/apps/dav/lib/caldav/caldavbackend.php
+++ b/apps/dav/lib/caldav/caldavbackend.php
@@ -340,6 +340,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarchanges` WHERE `calendarid` = ?');
$stmt->execute([$calendarId]);
+
+ $this->sharingBackend->deleteAllShares($calendarId);
}
/**
diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php
index d490bdb91ec..9ca166c22a2 100644
--- a/apps/dav/lib/carddav/carddavbackend.php
+++ b/apps/dav/lib/carddav/carddavbackend.php
@@ -336,10 +336,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
->setParameter('id', $addressBookId)
->execute();
- $query->delete('dav_shares')
- ->where($query->expr()->eq('resourceid', $query->createNamedParameter($addressBookId)))
- ->andWhere($query->expr()->eq('type', $query->createNamedParameter('addressbook')))
- ->execute();
+ $this->sharingBackend->deleteAllShares($addressBookId);
$query->delete($this->dbCardsPropertiesTable)
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)))
diff --git a/apps/dav/lib/dav/sharing/backend.php b/apps/dav/lib/dav/sharing/backend.php
index a68e484902c..0b28891fbc4 100644
--- a/apps/dav/lib/dav/sharing/backend.php
+++ b/apps/dav/lib/dav/sharing/backend.php
@@ -97,6 +97,17 @@ class Backend {
}
/**
+ * @param $resourceId
+ */
+ public function deleteAllShares($resourceId) {
+ $query = $this->db->getQueryBuilder();
+ $query->delete('dav_shares')
+ ->where($query->expr()->eq('resourceid', $query->createNamedParameter($resourceId)))
+ ->andWhere($query->expr()->eq('type', $query->createNamedParameter($this->resourceType)))
+ ->execute();
+ }
+
+ /**
* @param IShareable $shareable
* @param string $element
*/