diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-12-06 08:44:01 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-06 08:44:01 +0300 |
commit | 7b6a14626960795b0acdf4a064cd3982d7704f2b (patch) | |
tree | 1f8b5fc7d7869c77e91a1f8dc2ab592b3f8de4ca /plugins/SitesManager/SitesManager.php | |
parent | 1fe8a6ee582c2f61dc209b7df856695378007c23 (diff) |
Report tracking into wrong Site ID and missing token auth (#13493)
* log tracking failures
* added page
* tweak UI
* use a db column instead of option table to simplify code
* add system summary, notifiy super users by email, fixes, update, ...
* more fixes, needs tests next
* add widget for tracking failures
* ensure to not log any failure when visit is excluded
* some tests and fixes
* added tests
* added missing test
* apply review feedback
* fix tests
* trying to fix test
* fix tests
* fix update names
* fix tests
* Fix another test.
Diffstat (limited to 'plugins/SitesManager/SitesManager.php')
-rw-r--r-- | plugins/SitesManager/SitesManager.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 76576f84ed..054ecc2fce 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -8,9 +8,11 @@ */ namespace Piwik\Plugins\SitesManager; +use Piwik\Access; use Piwik\API\Request; use Piwik\Common; use Piwik\Container\StaticContainer; +use Piwik\Exception\UnexpectedWebsiteFoundException; use Piwik\Piwik; use Piwik\Plugins\CoreHome\SystemSummary; use Piwik\Plugins\PrivacyManager\PrivacyManager; @@ -36,7 +38,8 @@ class SitesManager extends \Piwik\Plugin return array( 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'Tracker.Cache.getSiteAttributes' => 'recordWebsiteDataInCache', + 'Tracker.Cache.getSiteAttributes' => array('function' => 'recordWebsiteDataInCache', 'before' => true), + 'Tracker.setTrackerCacheGeneral' => 'setTrackerCacheGeneral', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', 'SitesManager.deleteSite.end' => 'onSiteDeleted', 'System.addSystemSummaryItems' => 'addSystemSummaryItems', @@ -145,13 +148,13 @@ class SitesManager extends \Piwik\Plugin { $idSite = (int) $idSite; + $website = API::getInstance()->getSiteFromId($idSite); $urls = API::getInstance()->getSiteUrlsFromId($idSite); // add the 'hosts' entry in the website array $array['urls'] = $urls; $array['hosts'] = $this->getTrackerHosts($urls); - $website = API::getInstance()->getSiteFromId($idSite); $array['exclude_unknown_urls'] = $website['exclude_unknown_urls']; $array['excluded_ips'] = $this->getTrackerExcludedIps($website); $array['excluded_parameters'] = self::getTrackerExcludedQueryParameters($website); @@ -165,6 +168,14 @@ class SitesManager extends \Piwik\Plugin $array['type'] = $website['type']; } + public function setTrackerCacheGeneral(&$cache) + { + Access::doAsSuperUser(function () use (&$cache) { + $cache['global_excluded_user_agents'] = self::filterBlankFromCommaSepList(API::getInstance()->getExcludedUserAgentsGlobal()); + $cache['global_excluded_ips'] = self::filterBlankFromCommaSepList(API::getInstance()->getExcludedIpsGlobal()); + }); + } + /** * Returns whether we should keep URL fragments for a specific site. * |