aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CardDAV/CardDavBackend.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/CardDAV/CardDavBackend.php')
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index f6d80dfe701..48e3b04b38b 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -99,6 +99,22 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}
/**
+ * Return the number of address books for a principal
+ *
+ * @param $principalUri
+ * @return int
+ */
+ public function getAddressBooksForUserCount($principalUri) {
+ $principalUri = $this->convertPrincipal($principalUri, true);
+ $query = $this->db->getQueryBuilder();
+ $query->select($query->createFunction('COUNT(*)'))
+ ->from('addressbooks')
+ ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
+
+ return $query->execute()->fetchColumn();
+ }
+
+ /**
* Returns the list of address books for a specific user.
*
* Every addressbook should have the following properties: