fixes rare case that user contact metadata is missing in LDAP
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Sep 2015 10:11:19 +0000 (12:11 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Sep 2015 15:40:36 +0000 (17:40 +0200)
and adds some more logging

Change-Id: Ia565dd8d4fe3f16b80408a7fa6960c743e3dea30
Reviewed-on: http://gerrit.tine20.com/customers/2169
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/User.php
tine20/Tinebase/User/Ldap.php

index 77fd4f2..cc597b2 100644 (file)
@@ -537,13 +537,15 @@ class Tinebase_User
             $contact = $addressbook->getByUserId($syncedUser->getId());
             $originalContact = clone $contact;
 
+            if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
+                . ' user: ' .print_r($syncedUser->toArray(), true));
+
             Tinebase_User::getInstance()->updateContactFromSyncBackend($syncedUser, $contact);
             $contact = self::_user2Contact($syncedUser, $contact);
 
             if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
-                . print_r($syncedUser->toArray(), true)
-                . ' new: ' . print_r($contact->toArray(), true)
-                . ' orig:' . print_r($originalContact->toArray(), true));
+                . ' new contact: ' . print_r($contact->toArray(), true)
+                . ' orig contact:' . print_r($originalContact->toArray(), true));
 
             // TODO allow to diff jpegphoto, too / maybe this should only be done when called via CLI/cronjob
             $diff = $contact->diff($originalContact, array('jpegphoto'));
@@ -565,6 +567,10 @@ class Tinebase_User
         } catch (Addressbook_Exception_NotFound $aenf) {
             self::createContactForSyncedUser($syncedUser);
             $syncedUser = Tinebase_User::getInstance()->updateUserInSqlBackend($syncedUser);
+        } catch (Tinebase_Exception_NotFound $tenf) {
+            if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+                . ' Contact information seems to be missing in sync backend');
+            Tinebase_Exception::log($tenf);
         }
     }
     
index 2406f47..560d75d 100644 (file)
@@ -662,6 +662,10 @@ class Tinebase_User_Ldap extends Tinebase_User_Sql implements Tinebase_User_Inte
             $this->_rowNameMapping['accountId'], $userId
         );
 
+        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE))
+            Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
+                . ' fetch meta data - filter: ' . $filter);
+
         $result = $this->_ldap->search(
             $filter,
             $this->_baseDn,