summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/HookManager.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-08-30 15:11:33 +0200
committerRobin Appelman <robin@icewind.nl>2016-08-31 15:08:29 +0200
commit344945bfe9c6d446742fb1d8020862c3c474776a (patch)
tree5e5defb625b0845bea479ec79156bde7db23db90 /apps/dav/lib/HookManager.php
parenta82d4a56fb5bc484114c702bcd63e6278830bd5d (diff)
downloadnextcloud-server-344945bfe9c6d446742fb1d8020862c3c474776a.tar.gz
nextcloud-server-344945bfe9c6d446742fb1d8020862c3c474776a.zip
more efficient check if addressbook and calendar exists for user
Diffstat (limited to 'apps/dav/lib/HookManager.php')
-rw-r--r--apps/dav/lib/HookManager.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php
index d89c4b822ff..5a3e328f707 100644
--- a/apps/dav/lib/HookManager.php
+++ b/apps/dav/lib/HookManager.php
@@ -104,8 +104,7 @@ class HookManager {
$user = $this->userManager->get($params['uid']);
if (!is_null($user)) {
$principal = 'principals/users/' . $user->getUID();
- $calendars = $this->calDav->getCalendarsForUser($principal);
- if (empty($calendars) || (count($calendars) === 1 && $calendars[0]['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI)) {
+ if ($this->calDav->getCalendarsForUserCount($principal) === 0) {
try {
$this->calDav->createCalendar($principal, 'personal', [
'{DAV:}displayname' => 'Personal']);
@@ -113,8 +112,7 @@ class HookManager {
\OC::$server->getLogger()->logException($ex);
}
}
- $books = $this->cardDav->getAddressBooksForUser($principal);
- if (empty($books)) {
+ if ($this->cardDav->getAddressBooksForUserCount($principal) === 0) {
try {
$this->cardDav->createAddressBook($principal, 'contacts', [
'{DAV:}displayname' => 'Contacts']);