diff options
author | sgiehl <stefan@matomo.org> | 2020-06-04 15:48:58 +0300 |
---|---|---|
committer | sgiehl <stefan@matomo.org> | 2020-06-04 16:21:37 +0300 |
commit | 5653219ad5d6e7c68fe76a9cd6bbb9ae653d9e27 (patch) | |
tree | c089ccda4aa00e58847a79058896d8242dd3710e /plugins/SitesManager/SitesManager.php | |
parent | a35070be5146539999fdd02d5323f466d314192b (diff) | |
parent | e0fb7b40b7ddf42da70e63224c43524380f57e48 (diff) |
Merge branch '3.x-dev' into 4.x-dev
Diffstat (limited to 'plugins/SitesManager/SitesManager.php')
-rw-r--r-- | plugins/SitesManager/SitesManager.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 0644e4df37..fbf6af7278 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -13,12 +13,14 @@ use Piwik\API\Request; use Piwik\Common; use Piwik\Config; use Piwik\Container\StaticContainer; +use Piwik\Date; use Piwik\Exception\UnexpectedWebsiteFoundException; use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\CoreHome\SystemSummary; use Piwik\Settings\Storage\Backend\MeasurableSettingsTable; use Piwik\Tracker\Cache; +use Piwik\Tracker\FingerprintSalt; use Piwik\Tracker\Model as TrackerModel; use Piwik\Session\SessionNamespace; @@ -197,6 +199,16 @@ class SitesManager extends \Piwik\Plugin $array['timezone'] = $this->getTimezoneFromWebsite($website); $array['ts_created'] = $website['ts_created']; $array['type'] = $website['type']; + + // we make sure to have the fingerprint salts for the last 3 days incl tmrw in the cache so we don't need to + // query the DB directly for these days + $datesToGenerateSalt = array(Date::now()->addDay(1), Date::now(), Date::now()->subDay(1), Date::now()->subDay(2)); + + $fingerprintSaltKey = new FingerprintSalt(); + foreach ($datesToGenerateSalt as $date) { + $dateString = $fingerprintSaltKey->getDateString($date, $array['timezone']); + $array[FingerprintSalt::OPTION_PREFIX . $dateString] = $fingerprintSaltKey->getSalt($dateString, $idSite); + } } public function setTrackerCacheGeneral(&$cache) |