increase number of tries for user principal
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 11 Aug 2014 15:23:49 +0000 (17:23 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 4 Sep 2014 09:26:40 +0000 (11:26 +0200)
... in findCalendarHomeSet()

Change-Id: I41d60b4076b9f3ea9c9329d0bcddf5aba3bed50b
Reviewed-on: http://gerrit.tine20.com/customers/966
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Import/CalDav/Client.php

index 737bd42..6e47614 100644 (file)
@@ -64,9 +64,9 @@ class Tinebase_Import_CalDav_Client extends \Sabre\DAV\Client
         $this->propertyMap['{DAV:}group-member-set'] = 'Tinebase_Import_CalDav_GroupMemberSet';
     }
     
-    public function findCurrentUserPrincipal()
+    public function findCurrentUserPrincipal($tries = 1)
     {
-        $result = $this->calDavRequest('PROPFIND', '/principals/', self::findCurrentUserPrincipalRequest, 0, /* tries = */ 1);
+        $result = $this->calDavRequest('PROPFIND', '/principals/', self::findCurrentUserPrincipalRequest, 0, $tries);
         if (isset($result['{DAV:}current-user-principal']))
         {
             try {
@@ -113,11 +113,12 @@ class Tinebase_Import_CalDav_Client extends \Sabre\DAV\Client
     
     public function findCalendarHomeSet()
     {
-        if ('' == $this->currentUserPrincipal && ! $this->findCurrentUserPrincipal())
+        if ('' == $this->currentUserPrincipal && ! $this->findCurrentUserPrincipal(/* tries = */ 3)) {
             return false;
+        }
         $result = $this->calDavRequest('PROPFIND', $this->currentUserPrincipal, self::findCalendarHomeSetRequest);
-        if (isset($result['{urn:ietf:params:xml:ns:caldav}calendar-home-set']))
-        {
+        
+        if (isset($result['{urn:ietf:params:xml:ns:caldav}calendar-home-set'])) {
             $this->calendarHomeSet = $result['{urn:ietf:params:xml:ns:caldav}calendar-home-set'];
             return true;
         }