diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2021-05-31 03:57:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 03:57:53 +0300 |
commit | e0417845f8fd7031e00e97c3576415c998abb2ce (patch) | |
tree | bcb32121d164b62229209534538f8ca7c2bf6705 /plugins | |
parent | 30eec9445b0a2117f80305f7a367121039f04817 (diff) |
Allow overriding some Tracker config by idSite (#17636)
* Allow tracker config to be customized per site (for some configs)
* Update Response.php
* allow few more settings to be overwritten on a per site basis
* idsite parameter may not be specified during Tracker\Request::__construct() (eg, during bulk tracking)
* Fix another test.
* Just make idsite optional for TrackerConfig::getConfigValue() calls.
* try to fix remaining failure
* forgot to add test file
Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreHome/Tracker/VisitRequestProcessor.php | 4 | ||||
-rw-r--r-- | plugins/Referrers/Columns/Campaign.php | 8 | ||||
-rw-r--r-- | plugins/Referrers/Columns/Website.php | 15 |
3 files changed, 4 insertions, 23 deletions
diff --git a/plugins/CoreHome/Tracker/VisitRequestProcessor.php b/plugins/CoreHome/Tracker/VisitRequestProcessor.php index 1f4706f859..65906cd45e 100644 --- a/plugins/CoreHome/Tracker/VisitRequestProcessor.php +++ b/plugins/CoreHome/Tracker/VisitRequestProcessor.php @@ -184,7 +184,7 @@ class VisitRequestProcessor extends RequestProcessor } $wasLastActionYesterday = $this->wasLastActionNotToday($visitProperties, $request, $lastKnownVisit); - $forceNewVisitAtMidnight = (bool) Config::getInstance()->Tracker['create_new_visit_after_midnight']; + $forceNewVisitAtMidnight = (bool) TrackerConfig::getConfigValue('create_new_visit_after_midnight', $request->getIdSiteIfExists()); if ($wasLastActionYesterday && $forceNewVisitAtMidnight) { Common::printDebug("Visitor detected, but last action was yesterday..."); @@ -192,7 +192,7 @@ class VisitRequestProcessor extends RequestProcessor return true; } - if (!TrackerConfig::getConfigValue('enable_userid_overwrites_visitorid') + if (!TrackerConfig::getConfigValue('enable_userid_overwrites_visitorid', $request->getIdSiteIfExists()) && !$this->lastUserIdWasSetAndDoesMatch($visitProperties, $request)) { Common::printDebug("Visitor detected, but last user_id does not match..."); return true; diff --git a/plugins/Referrers/Columns/Campaign.php b/plugins/Referrers/Columns/Campaign.php index c34daebf90..c5fd824a33 100644 --- a/plugins/Referrers/Columns/Campaign.php +++ b/plugins/Referrers/Columns/Campaign.php @@ -23,14 +23,8 @@ class Campaign extends Base * * @var bool */ - protected $createNewVisitWhenCampaignChanges; protected $nameSingular = 'Referrers_ColumnCampaign'; - public function __construct() - { - $this->createNewVisitWhenCampaignChanges = TrackerConfig::getConfigValue('create_new_visit_when_campaign_changes') == 1; - } - /** * If we should create a new visit when the campaign changes, check if the campaign info changed and if so * force the tracker to create a new visit.i @@ -42,7 +36,7 @@ class Campaign extends Base */ public function shouldForceNewVisit(Request $request, Visitor $visitor, Action $action = null) { - if (!$this->createNewVisitWhenCampaignChanges) { + if (TrackerConfig::getConfigValue('create_new_visit_when_campaign_changes', $request->getIdSiteIfExists()) != 1) { return false; } diff --git a/plugins/Referrers/Columns/Website.php b/plugins/Referrers/Columns/Website.php index da693f1674..73aa5bcbed 100644 --- a/plugins/Referrers/Columns/Website.php +++ b/plugins/Referrers/Columns/Website.php @@ -20,22 +20,9 @@ class Website extends Base protected $type = self::TYPE_TEXT; protected $nameSingular = 'General_Website'; - /** - * Set using the `[Tracker] create_new_visit_when_website_referrer_changes` INI config option. - * If true, will force new visits if the referrer website changes. - * - * @var bool - */ - protected $createNewVisitWhenWebsiteReferrerChanges; - - public function __construct() - { - $this->createNewVisitWhenWebsiteReferrerChanges = TrackerConfig::getConfigValue('create_new_visit_when_website_referrer_changes') == 1; - } - public function shouldForceNewVisit(Request $request, Visitor $visitor, Action $action = null) { - if (!$this->createNewVisitWhenWebsiteReferrerChanges) { + if (TrackerConfig::getConfigValue('create_new_visit_when_website_referrer_changes', $request->getIdSiteIfExists()) != 1) { return false; } |