From 7e8b6c258ffdb579910049c9b7f0d42f931d5508 Mon Sep 17 00:00:00 2001 From: mattab Date: Mon, 8 Dec 2014 15:50:36 +1300 Subject: fixes https://github.com/PiwikPRO/plugin-InterSites/issues/2 Added notification to user when Config not setup properly + Update system tests to set the new required config --- core/Tracker.php | 5 +++++ core/Tracker/Visit.php | 2 ++ tests/PHPUnit/Integration/Tracker/SettingsTest.php | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/Tracker.php b/core/Tracker.php index 99a712a887..cb7b4494c5 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -241,6 +241,11 @@ class Tracker TrackerConfig::setConfigValue('tracking_requests_require_authentication', 0); } + // Tests can force the use of 3rd party cookie for ID visitor + if (Common::getRequestVar('forceEnableFingerprintingAcrossWebsites', false, null, $args) == 1) { + TrackerConfig::setConfigValue('enable_fingerprinting_across_websites', 1); + } + // Tests can force the use of 3rd party cookie for ID visitor if (Common::getRequestVar('forceUseThirdPartyCookie', false, null, $args) == 1) { TrackerConfig::setConfigValue('use_third_party_id_cookie', 1); diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index ee4bd97a11..4065ebe15c 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -386,7 +386,9 @@ class Visit implements VisitInterface protected function getSettingsObject() { if (is_null($this->userSettings)) { + // Note: this config settig is also checked in the InterSites plugin $isSameFingerprintAcrossWebsites = (bool)Config::getInstance()->Tracker['enable_fingerprinting_across_websites']; + $this->userSettings = new Settings( $this->request, $this->getVisitorIp(), $isSameFingerprintAcrossWebsites ); } diff --git a/tests/PHPUnit/Integration/Tracker/SettingsTest.php b/tests/PHPUnit/Integration/Tracker/SettingsTest.php index fa2dee2969..fc008467a4 100644 --- a/tests/PHPUnit/Integration/Tracker/SettingsTest.php +++ b/tests/PHPUnit/Integration/Tracker/SettingsTest.php @@ -117,10 +117,10 @@ class SettingsTest extends IntegrationTestCase public function test_getConfigId_isSame_whenIPIsAnonimisedAndBothSame() { - $settingsIpIsNotAnon = $this->makeSettings(array(), true, '125.2.0.0'); $settingsIpIsAnon = $this->makeSettings(array(), true, '125.2.0.0'); + $settingsIpIsAnonBis = $this->makeSettings(array(), true, '125.2.0.0'); - $this->assertSame($settingsIpIsNotAnon->getConfigId(), $settingsIpIsAnon->getConfigId()); + $this->assertSame($settingsIpIsAnonBis->getConfigId(), $settingsIpIsAnon->getConfigId()); } /** -- cgit v1.2.3