diff options
author | Robin Appelman <robin@icewind.nl> | 2016-08-30 15:11:33 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2016-08-31 15:08:29 +0200 |
commit | 344945bfe9c6d446742fb1d8020862c3c474776a (patch) | |
tree | 5e5defb625b0845bea479ec79156bde7db23db90 /apps/dav/lib/HookManager.php | |
parent | a82d4a56fb5bc484114c702bcd63e6278830bd5d (diff) | |
download | nextcloud-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.php | 6 |
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']); |