allow to include user sync hook from include_path
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 22 Nov 2016 13:57:20 +0000 (14:57 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 23 Nov 2016 13:26:38 +0000 (14:26 +0100)
Change-Id: Ida01eb0b2c2f50c495828b596bb7357ca46d86d6
Reviewed-on: http://gerrit.tine20.com/customers/3856
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/User.php

index 7f5a290..c295027 100644 (file)
@@ -665,17 +665,23 @@ class Tinebase_User
     {
         $result = true;
         $hookClass = Tinebase_Config::getInstance()->get(Tinebase_Config::SYNC_USER_HOOK_CLASS);
-        if ($hookClass && class_exists($hookClass)) {
-            $hook = new $hookClass();
-            if (method_exists($hook, 'syncUser')) {
-                if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
-                    . ' Calling ' . $hookClass . '::syncUser() ...');
-                
-                try {
-                    $result = call_user_func_array(array($hook, 'syncUser'), array($user, $userProperties));
-                } catch (Tinebase_Exception $te) {
-                    Tinebase_Exception::log($te);
-                    return false;
+        if ($hookClass) {
+            if (! class_exists($hookClass)) {
+                @include($hookClass . '.php');
+            }
+
+            if (class_exists($hookClass)) {
+                $hook = new $hookClass();
+                if (method_exists($hook, 'syncUser')) {
+                    if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
+                        . ' Calling ' . $hookClass . '::syncUser() ...');
+
+                    try {
+                        $result = call_user_func_array(array($hook, 'syncUser'), array($user, $userProperties));
+                    } catch (Tinebase_Exception $te) {
+                        Tinebase_Exception::log($te);
+                        return false;
+                    }
                 }
             }
         }