]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove entries in dav_shares on deletion of a calendar
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 3 Feb 2016 19:18:56 +0000 (20:18 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 3 Feb 2016 19:18:56 +0000 (20:18 +0100)
apps/dav/lib/caldav/caldavbackend.php
apps/dav/lib/carddav/carddavbackend.php
apps/dav/lib/dav/sharing/backend.php

index 4820116e9a6a9070f822c27d556bd7d904176023..3aa493e50872d779c876f7af99294971048148a4 100644 (file)
@@ -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);
        }
 
        /**
index d490bdb91ec8f0840f8714735a387e729d5c2d18..9ca166c22a2ded9be339acf9ba0bacaa699be1c8 100644 (file)
@@ -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)))
index a68e484902c4bdda8099a88461cfa4d15d1021c2..0b28891fbc4bbaced95ab2a81b3e1872cdba1820 100644 (file)
@@ -96,6 +96,17 @@ class Backend {
                $query->execute();
        }
 
+       /**
+        * @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