0012486: re-use of WebDAV and ActiveSync access logs not working
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 4 Jan 2017 14:11:10 +0000 (15:11 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 4 Jan 2017 16:58:21 +0000 (17:58 +0100)
... we did not have the id before and created new access logs

https://forge.tine20.org/view.php?id=12486

Change-Id: Ic577732fb9e86e22618b9f9d8a9d09db0c0a430a
Reviewed-on: http://gerrit.tine20.com/customers/4041
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/AccessLog.php

index e536895..84cc52f 100644 (file)
@@ -194,7 +194,11 @@ class Tinebase_AccessLog extends Tinebase_Controller_Record_Abstract
         $sessionId = Tinebase_Core::getSessionId();
 
         try {
         $sessionId = Tinebase_Core::getSessionId();
 
         try {
-            $loginRecord = $this->_backend->getByProperty($sessionId, 'sessionid');
+            if (Tinebase_Core::isRegistered(Tinebase_Core::USERACCESSLOG)) {
+                $loginRecord = Tinebase_Core::get(Tinebase_Core::USERACCESSLOG);
+            } else {
+                $loginRecord = $this->_backend->getByProperty($sessionId, 'sessionid');
+            }
         } catch (Tinebase_Exception_NotFound $tenf) {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__
                 . ' Could not find access log login record for session id ' . $sessionId);
         } catch (Tinebase_Exception_NotFound $tenf) {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__
                 . ' Could not find access log login record for session id ' . $sessionId);
@@ -274,7 +278,7 @@ class Tinebase_AccessLog extends Tinebase_Controller_Record_Abstract
         if (in_array($accessLog->clienttype, array(Tinebase_Server_WebDAV::REQUEST_TYPE, ActiveSync_Server_Http::REQUEST_TYPE))) {
             try {
                 $previousAccessLog = Tinebase_AccessLog::getInstance()->getPreviousAccessLog($accessLog);
         if (in_array($accessLog->clienttype, array(Tinebase_Server_WebDAV::REQUEST_TYPE, ActiveSync_Server_Http::REQUEST_TYPE))) {
             try {
                 $previousAccessLog = Tinebase_AccessLog::getInstance()->getPreviousAccessLog($accessLog);
-                $accessLog->sessionid = $previousAccessLog->sessionid;
+                $accessLog->merge($previousAccessLog);
             } catch (Tinebase_Exception_NotFound $tenf) {
                 // ignore
             }
             } catch (Tinebase_Exception_NotFound $tenf) {
                 // ignore
             }