diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-07-12 03:37:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-12 03:37:58 +0300 |
commit | 2eaa4034a79ae0b08f8444c0d867e9ba17b93517 (patch) | |
tree | cad66abc5820ae3a298668f0525a82abc1b43406 /core/Tracker/VisitorRecognizer.php | |
parent | ce9b7cb69e349489e74527749c47e080fed27128 (diff) |
If new visit is forced, known visitors should still be recognized (#14491)
* Enforcing a new visit should not result in the visitor becoming unrecognized.
* Adding test for bug.
* update expected test files
* Fix integration test.
* Update submodule
* Update test files.
Diffstat (limited to 'core/Tracker/VisitorRecognizer.php')
-rw-r--r-- | core/Tracker/VisitorRecognizer.php | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/core/Tracker/VisitorRecognizer.php b/core/Tracker/VisitorRecognizer.php index 646c8e98d0..64854ace16 100644 --- a/core/Tracker/VisitorRecognizer.php +++ b/core/Tracker/VisitorRecognizer.php @@ -49,13 +49,6 @@ class VisitorRecognizer private $lookBackNSecondsCustom; /** - * Forces all requests to result in new visits. For debugging only. - * - * @var int - */ - private $trackerAlwaysNewVisitor; - - /** * @var Model */ private $model; @@ -70,13 +63,12 @@ class VisitorRecognizer */ private $visitRow; - public function __construct($trustCookiesOnly, $visitStandardLength, $lookbackNSecondsCustom, $trackerAlwaysNewVisitor, + public function __construct($trustCookiesOnly, $visitStandardLength, $lookbackNSecondsCustom, Model $model, EventDispatcher $eventDispatcher) { $this->trustCookiesOnly = $trustCookiesOnly; $this->visitStandardLength = $visitStandardLength; $this->lookBackNSecondsCustom = $lookbackNSecondsCustom; - $this->trackerAlwaysNewVisitor = $trackerAlwaysNewVisitor; $this->model = $model; $this->eventDispatcher = $eventDispatcher; @@ -109,22 +101,9 @@ class VisitorRecognizer $visitRow = $this->model->findVisitor($idSite, $configId, $idVisitor, $persistedVisitAttributes, $shouldMatchOneFieldOnly, $isVisitorIdToLookup, $timeLookBack, $timeLookAhead); $this->visitRow = $visitRow; - $isNewVisitForced = $request->getParam('new_visit'); - $isNewVisitForced = !empty($isNewVisitForced); - $enforceNewVisit = $isNewVisitForced || $this->trackerAlwaysNewVisitor; - if($isNewVisitForced) { - Common::printDebug("-> New visit forced: &new_visit=1 in request"); - } - if($this->trackerAlwaysNewVisitor) { - Common::printDebug("-> New visit forced: Debug.tracker_always_new_visitor = 1 in config.ini.php"); - } - - if (!$enforceNewVisit - && $visitRow + if ($visitRow && count($visitRow) > 0 ) { - $visitProperties->setProperty('visit_last_action_time', strtotime($visitRow['visit_last_action_time'])); - $visitProperties->setProperty('visit_first_action_time', strtotime($visitRow['visit_first_action_time'])); $visitProperties->setProperty('idvisitor', $visitRow['idvisitor']); $visitProperties->setProperty('user_id', $visitRow['user_id']); @@ -145,11 +124,12 @@ class VisitorRecognizer { // These values will be used throughout the request foreach ($this->getVisitorFieldsPersist() as $field) { + $value = $this->visitRow[$field]; if ($field == 'visit_last_action_time' || $field == 'visit_first_action_time') { - continue; + $value = strtotime($value); } - $visitProperties->setProperty($field, $this->visitRow[$field]); + $visitProperties->setProperty($field, $value); } Common::printDebug("The visit is part of an existing visit ( @@ -277,4 +257,9 @@ class VisitorRecognizer return $this->visitFieldsToSelect; } + + public function getLastKnownVisit() + { + return $this->visitRow; + } }
\ No newline at end of file |