Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-04-14 04:57:52 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-04-16 07:39:18 +0300
commit6b6743c0da73087e2d5534889201355bad500c3e (patch)
tree4b8ce39ccac582a0d5f9bca3f46c92dacbabb1e8
parent140c3b03e79499835a9af406e591b26869beba28 (diff)
Improve performance of BulkTracking and QueuedTracking
-rw-r--r--core/Common.php10
-rw-r--r--core/EventDispatcher.php27
-rw-r--r--core/Plugin/Manager.php35
-rw-r--r--core/Tracker.php9
-rw-r--r--core/Tracker/Action.php7
-rw-r--r--core/Tracker/Cache.php7
-rw-r--r--core/Tracker/Request.php80
-rw-r--r--core/Tracker/Visit.php18
-rw-r--r--core/Tracker/Visit/Factory.php2
-rw-r--r--core/Tracker/Visitor.php94
-rw-r--r--core/UrlHelper.php12
-rw-r--r--plugins/Referrers/Columns/Base.php9
-rwxr-xr-xtests/LocalTracker.php2
-rw-r--r--tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php2
-rw-r--r--tests/PHPUnit/Integration/Tracker/VisitTest.php2
-rwxr-xr-xtests/PHPUnit/System/BlobReportLimitingTest.php7
16 files changed, 224 insertions, 99 deletions
diff --git a/core/Common.php b/core/Common.php
index 1ed8d48935..2a9d3cbe0a 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -379,9 +379,13 @@ class Common
*/
private static function undoMagicQuotes($value)
{
- if (version_compare(PHP_VERSION, '5.4', '<') &&
- get_magic_quotes_gpc()) {
+ static $shouldUndo;
+ if (!isset($shouldUndo)) {
+ $shouldUndo = version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc();
+ }
+
+ if ($shouldUndo) {
$value = stripslashes($value);
}
@@ -470,7 +474,7 @@ class Common
}
$value = self::sanitizeInputValues($requestArrayToUse[$varName]);
- if (!is_null($varType)) {
+ if (isset($varType)) {
$ok = false;
if ($varType === 'string') {
diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php
index bdec8c1c7c..5cc65c84b0 100644
--- a/core/EventDispatcher.php
+++ b/core/EventDispatcher.php
@@ -52,6 +52,8 @@ class EventDispatcher extends Singleton
*/
private $pluginManager;
+ private $pluginHooks = array();
+
/**
* Constructor.
*/
@@ -78,29 +80,36 @@ class EventDispatcher extends Singleton
$this->pendingEvents[] = array($eventName, $params);
}
+ $manager = $this->getPluginManager();
+
if (empty($plugins)) {
- $plugins = $this->getPluginManager()->getPluginsLoadedAndActivated();
+ $plugins = $manager->getPluginsLoadedAndActivated();
}
$callbacks = array();
// collect all callbacks to execute
- foreach ($plugins as $plugin) {
- if (is_string($plugin)) {
- $plugin = $this->getPluginManager()->getLoadedPlugin($plugin);
+ foreach ($plugins as $pluginName) {
+ if (!is_string($pluginName)) {
+ $pluginName = $pluginName->getPluginName();
}
- if (empty($plugin)) {
- return; // may happen in unit tests
+ if (!isset($this->pluginHooks[$pluginName])) {
+ $plugin = $manager->getLoadedPlugin($pluginName);
+ $this->pluginHooks[$pluginName] = $plugin->getListHooksRegistered();
}
-
- $hooks = $plugin->getListHooksRegistered();
+ $hooks = $this->pluginHooks[$pluginName];
if (isset($hooks[$eventName])) {
list($pluginFunction, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($hooks[$eventName]);
- $callbacks[$callbackGroup][] = is_string($pluginFunction) ? array($plugin, $pluginFunction) : $pluginFunction;
+ if (is_string($pluginFunction)) {
+ $plugin = $manager->getLoadedPlugin($pluginName);
+ $callbacks[$callbackGroup][] = array($plugin, $pluginFunction) ;
+ } else {
+ $callbacks[$callbackGroup][] = $pluginFunction;
+ }
}
}
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php
index 22eb0296d1..6249cf71dd 100644
--- a/core/Plugin/Manager.php
+++ b/core/Plugin/Manager.php
@@ -44,6 +44,8 @@ class Manager extends Singleton
protected $doLoadPlugins = true;
+ private $pluginsLoadedAndActivated;
+
/**
* @var Plugin[]
*/
@@ -426,6 +428,7 @@ class Manager extends Singleton
*/
private function clearCache($pluginName)
{
+ $this->resetTransientCache();
Filesystem::deleteAllCacheOnUpdate($pluginName);
}
@@ -678,6 +681,7 @@ class Manager extends Singleton
*/
public function loadPlugins(array $pluginsToLoad)
{
+ $this->resetTransientCache();
$this->pluginsToLoad = $this->makePluginsToLoad($pluginsToLoad);
$this->reloadActivatedPlugins();
}
@@ -765,15 +769,21 @@ class Manager extends Singleton
*/
public function getPluginsLoadedAndActivated()
{
- $plugins = $this->getLoadedPlugins();
- $enabled = $this->getActivatedPlugins();
+ if (is_null($this->pluginsLoadedAndActivated)) {
+ $enabled = $this->getActivatedPlugins();
- if (empty($enabled)) {
- return array();
+ if (empty($enabled)) {
+ return array();
+ }
+
+ $plugins = $this->getLoadedPlugins();
+ $enabled = array_combine($enabled, $enabled);
+ $plugins = array_intersect_key($plugins, $enabled);
+
+ $this->pluginsLoadedAndActivated = $plugins;
}
- $enabled = array_combine($enabled, $enabled);
- $plugins = array_intersect_key($plugins, $enabled);
- return $plugins;
+
+ return $this->pluginsLoadedAndActivated;
}
/**
@@ -936,6 +946,11 @@ class Manager extends Singleton
return "\\Piwik\\Plugins\\$pluginName\\$className";
}
+ private function resetTransientCache()
+ {
+ $this->pluginsLoadedAndActivated = null;
+ }
+
/**
* Unload plugin
*
@@ -944,6 +959,8 @@ class Manager extends Singleton
*/
public function unloadPlugin($plugin)
{
+ $this->resetTransientCache();
+
if (!($plugin instanceof Plugin)) {
$oPlugin = $this->loadPlugin($plugin);
if ($oPlugin === null) {
@@ -962,6 +979,8 @@ class Manager extends Singleton
*/
public function unloadPlugins()
{
+ $this->resetTransientCache();
+
$pluginsLoaded = $this->getLoadedPlugins();
foreach ($pluginsLoaded as $plugin) {
$this->unloadPlugin($plugin);
@@ -992,6 +1011,8 @@ class Manager extends Singleton
*/
public function addLoadedPlugin($pluginName, Plugin $newPlugin)
{
+ $this->resetTransientCache();
+
$this->loadedPlugins[$pluginName] = $newPlugin;
}
diff --git a/core/Tracker.php b/core/Tracker.php
index ff5694e3a0..3bba991be4 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -132,8 +132,6 @@ class Tracker
if ($request->isEmptyRequest()) {
Common::printDebug("The request is empty");
} else {
- $this->loadTrackerPlugins();
-
Common::printDebug("Current datetime: " . date("Y-m-d H:i:s", $request->getCurrentTimestamp()));
$visit = Visit\Factory::make();
@@ -171,6 +169,13 @@ class Tracker
}
}
+ public static function restoreTrackerPlugins()
+ {
+ if (SettingsServer::isTrackerApiRequest() && Tracker::$initTrackerMode) {
+ Plugin\Manager::getInstance()->loadTrackerPlugins();
+ }
+ }
+
public function getCountOfLoggedRequests()
{
return $this->countOfLoggedRequests;
diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php
index b892866781..6775a0a65d 100644
--- a/core/Tracker/Action.php
+++ b/core/Tracker/Action.php
@@ -125,7 +125,12 @@ abstract class Action
private static function getAllActions(Request $request)
{
- $actions = Manager::getInstance()->findMultipleComponents('Actions', '\\Piwik\\Tracker\\Action');
+ static $actions;
+
+ if (is_null($actions)) {
+ $actions = Manager::getInstance()->findMultipleComponents('Actions', '\\Piwik\\Tracker\\Action');
+ }
+
$instances = array();
foreach ($actions as $action) {
diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php
index 22b57a9cc2..1c333069eb 100644
--- a/core/Tracker/Cache.php
+++ b/core/Tracker/Cache.php
@@ -15,6 +15,8 @@ use Piwik\Common;
use Piwik\Config;
use Piwik\Option;
use Piwik\Piwik;
+use Piwik\Plugin;
+use Piwik\SettingsServer;
use Piwik\Tracker;
/**
@@ -105,6 +107,8 @@ class Cache
$cache->save($cacheId, $content, self::getTtl());
}
+ Tracker::restoreTrackerPlugins();
+
return $content;
}
@@ -160,6 +164,9 @@ class Cache
Piwik::postEvent('Tracker.setTrackerCacheGeneral', array(&$cacheContent));
self::setCacheGeneral($cacheContent);
Common::printDebug("General tracker cache was re-created.");
+
+ Tracker::restoreTrackerPlugins();
+
return $cacheContent;
}
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php
index 23f01a555b..7194101ee3 100644
--- a/core/Tracker/Request.php
+++ b/core/Tracker/Request.php
@@ -20,6 +20,7 @@ use Piwik\Network\IPUtils;
use Piwik\Piwik;
use Piwik\Plugins\CustomVariables\CustomVariables;
use Piwik\Tracker;
+use Piwik\Cache as PiwikCache;
/**
* The Request object holding the http parameters for this tracking request. Use getParam() to fetch a named parameter.
@@ -27,6 +28,10 @@ use Piwik\Tracker;
*/
class Request
{
+ private $cdtCache;
+ private $idSiteCache;
+ private $paramsCache = array();
+
/**
* @var array
*/
@@ -108,13 +113,29 @@ class Request
if ($shouldAuthenticate) {
+ try {
+ $idSite = $this->getIdSite();
+ } catch (Exception $e) {
+ $this->isAuthenticated = false;
+ return;
+ }
+
if (empty($tokenAuth)) {
$tokenAuth = Common::getRequestVar('token_auth', false, 'string', $this->params);
}
+ $cache = PiwikCache::getTransientCache();
+ $cacheKey = 'tracker_request_authentication_' . $idSite . '_' . $tokenAuth;
+
+ if ($cache->contains($cacheKey)) {
+ Common::printDebug("token_auth is authenticated in cache!");
+ $this->isAuthenticated = $cache->fetch($cacheKey);
+ return;
+ }
+
try {
- $idSite = $this->getIdSite();
$this->isAuthenticated = self::authenticateSuperUserOrAdmin($tokenAuth, $idSite);
+ $cache->save($cacheKey, $this->isAuthenticated);
} catch (Exception $e) {
$this->isAuthenticated = false;
}
@@ -294,11 +315,11 @@ class Request
// other
'bots' => array(0, 'int'),
'dp' => array(0, 'int'),
- 'rec' => array(false, 'int'),
+ 'rec' => array(0, 'int'),
'new_visit' => array(0, 'int'),
// Ecommerce
- 'ec_id' => array(false, 'string'),
+ 'ec_id' => array('', 'string'),
'ec_st' => array(false, 'float'),
'ec_tx' => array(false, 'float'),
'ec_sh' => array(false, 'float'),
@@ -306,24 +327,24 @@ class Request
'ec_items' => array('', 'json'),
// Events
- 'e_c' => array(false, 'string'),
- 'e_a' => array(false, 'string'),
- 'e_n' => array(false, 'string'),
+ 'e_c' => array('', 'string'),
+ 'e_a' => array('', 'string'),
+ 'e_n' => array('', 'string'),
'e_v' => array(false, 'float'),
// some visitor attributes can be overwritten
- 'cip' => array(false, 'string'),
- 'cdt' => array(false, 'string'),
- 'cid' => array(false, 'string'),
- 'uid' => array(false, 'string'),
+ 'cip' => array('', 'string'),
+ 'cdt' => array('', 'string'),
+ 'cid' => array('', 'string'),
+ 'uid' => array('', 'string'),
// Actions / pages
- 'cs' => array(false, 'string'),
+ 'cs' => array('', 'string'),
'download' => array('', 'string'),
'link' => array('', 'string'),
'action_name' => array('', 'string'),
'search' => array('', 'string'),
- 'search_cat' => array(false, 'string'),
+ 'search_cat' => array('', 'string'),
'search_count' => array(-1, 'int'),
'gt_ms' => array(-1, 'int'),
@@ -334,6 +355,10 @@ class Request
'c_i' => array('', 'string'),
);
+ if (isset($this->paramsCache[$name])) {
+ return $this->paramsCache[$name];
+ }
+
if (!isset($supportedParams[$name])) {
throw new Exception("Requested parameter $name is not a known Tracking API Parameter.");
}
@@ -341,9 +366,18 @@ class Request
$paramDefaultValue = $supportedParams[$name][0];
$paramType = $supportedParams[$name][1];
- $value = Common::getRequestVar($name, $paramDefaultValue, $paramType, $this->params);
+ if ($this->hasParam($name)) {
+ $this->paramsCache[$name] = Common::getRequestVar($name, $paramDefaultValue, $paramType, $this->params);
+ } else {
+ $this->paramsCache[$name] = $paramDefaultValue;
+ }
+
+ return $this->paramsCache[$name];
+ }
- return $value;
+ private function hasParam($name)
+ {
+ return isset($this->params[$name]);
}
public function getParams()
@@ -353,10 +387,12 @@ class Request
public function getCurrentTimestamp()
{
- $cdt = $this->getCustomTimestamp();
+ if (!isset($this->cdtCache)) {
+ $this->cdtCache = $this->getCustomTimestamp();
+ }
- if (!empty($cdt)) {
- return $cdt;
+ if (!empty($this->cdtCache)) {
+ return $this->cdtCache;
}
return $this->timestamp;
@@ -369,6 +405,10 @@ class Request
protected function getCustomTimestamp()
{
+ if (!$this->hasParam('cdt')) {
+ return false;
+ }
+
$cdt = $this->getParam('cdt');
if (empty($cdt)) {
@@ -418,6 +458,10 @@ class Request
public function getIdSite()
{
+ if (isset($this->idSiteCache)) {
+ return $this->idSiteCache;
+ }
+
$idSite = Common::getRequestVar('idsite', 0, 'int', $this->params);
/**
@@ -438,6 +482,8 @@ class Request
throw new UnexpectedWebsiteFoundException('Invalid idSite: \'' . $idSite . '\'');
}
+ $this->idSiteCache = $idSite;
+
return $idSite;
}
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index f672cd96da..4d81bc2f3b 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -54,6 +54,8 @@ class Visit implements VisitInterface
protected $userSettings;
protected $visitorCustomVariables = array();
+ public static $dimensions;
+
/**
* @param Request $request
*/
@@ -584,16 +586,18 @@ class Visit implements VisitInterface
protected function getAllVisitDimensions()
{
- $dimensions = VisitDimension::getAllDimensions();
+ if (is_null(self::$dimensions)) {
+ self::$dimensions = VisitDimension::getAllDimensions();
- $dimensionNames = array();
- foreach($dimensions as $dimension) {
- $dimensionNames[] = $dimension->getColumnName();
- }
+ $dimensionNames = array();
+ foreach(self::$dimensions as $dimension) {
+ $dimensionNames[] = $dimension->getColumnName();
+ }
- Common::printDebug("Following dimensions have been collected from plugins: " . implode(", ", $dimensionNames));
+ Common::printDebug("Following dimensions have been collected from plugins: " . implode(", ", $dimensionNames));
+ }
- return $dimensions;
+ return self::$dimensions;
}
private function getVisitStandardLength()
diff --git a/core/Tracker/Visit/Factory.php b/core/Tracker/Visit/Factory.php
index 71362dddea..1d9349dfb1 100644
--- a/core/Tracker/Visit/Factory.php
+++ b/core/Tracker/Visit/Factory.php
@@ -37,7 +37,7 @@ class Factory
*/
Piwik::postEvent('Tracker.makeNewVisitObject', array(&$visit));
- if (is_null($visit)) {
+ if (!isset($visit)) {
$visit = new Visit();
} elseif (!($visit instanceof VisitInterface)) {
throw new Exception("The Visit object set in the plugin must implement VisitInterface");
diff --git a/core/Tracker/Visitor.php b/core/Tracker/Visitor.php
index d9aadb640e..4088e724f1 100644
--- a/core/Tracker/Visitor.php
+++ b/core/Tracker/Visitor.php
@@ -173,54 +173,58 @@ class Visitor
*/
private function getVisitFieldsPersist()
{
- $fields = array(
- 'idvisitor',
- 'idvisit',
- 'user_id',
-
- 'visit_exit_idaction_url',
- 'visit_exit_idaction_name',
- 'visitor_returning',
- 'visitor_days_since_first',
- 'visitor_days_since_order',
- 'visitor_count_visits',
- 'visit_goal_buyer',
-
- 'location_country',
- 'location_region',
- 'location_city',
- 'location_latitude',
- 'location_longitude',
-
- 'referer_name',
- 'referer_keyword',
- 'referer_type',
- );
-
- $dimensions = VisitDimension::getAllDimensions();
-
- foreach ($dimensions as $dimension) {
- if ($dimension->hasImplementedEvent('onExistingVisit')) {
- $fields[] = $dimension->getColumnName();
- }
+ static $fields;
+
+ if (is_null($fields)) {
+ $fields = array(
+ 'idvisitor',
+ 'idvisit',
+ 'user_id',
+
+ 'visit_exit_idaction_url',
+ 'visit_exit_idaction_name',
+ 'visitor_returning',
+ 'visitor_days_since_first',
+ 'visitor_days_since_order',
+ 'visitor_count_visits',
+ 'visit_goal_buyer',
+
+ 'location_country',
+ 'location_region',
+ 'location_city',
+ 'location_latitude',
+ 'location_longitude',
+
+ 'referer_name',
+ 'referer_keyword',
+ 'referer_type',
+ );
+
+ $dimensions = VisitDimension::getAllDimensions();
+
+ foreach ($dimensions as $dimension) {
+ if ($dimension->hasImplementedEvent('onExistingVisit')) {
+ $fields[] = $dimension->getColumnName();
+ }
- foreach ($dimension->getRequiredVisitFields() as $field) {
- $fields[] = $field;
+ foreach ($dimension->getRequiredVisitFields() as $field) {
+ $fields[] = $field;
+ }
}
- }
- /**
- * This event collects a list of [visit entity](/guides/persistence-and-the-mysql-backend#visits) properties that should be loaded when reading
- * the existing visit. Properties that appear in this list will be available in other tracking
- * events such as 'onExistingVisit'.
- *
- * Plugins can use this event to load additional visit entity properties for later use during tracking.
- */
- Piwik::postEvent('Tracker.getVisitFieldsToPersist', array(&$fields));
-
- array_unshift($fields, 'visit_first_action_time');
- array_unshift($fields, 'visit_last_action_time');
- $fields = array_unique($fields);
+ /**
+ * This event collects a list of [visit entity](/guides/persistence-and-the-mysql-backend#visits) properties that should be loaded when reading
+ * the existing visit. Properties that appear in this list will be available in other tracking
+ * events such as 'onExistingVisit'.
+ *
+ * Plugins can use this event to load additional visit entity properties for later use during tracking.
+ */
+ Piwik::postEvent('Tracker.getVisitFieldsToPersist', array(&$fields));
+
+ array_unshift($fields, 'visit_first_action_time');
+ array_unshift($fields, 'visit_last_action_time');
+ $fields = array_unique($fields);
+ }
return $fields;
}
diff --git a/core/UrlHelper.php b/core/UrlHelper.php
index cf2eb468c8..20501515f2 100644
--- a/core/UrlHelper.php
+++ b/core/UrlHelper.php
@@ -155,6 +155,14 @@ class UrlHelper
if (strlen($urlQuery) == 0) {
return array();
}
+
+ $cache = Cache::getTransientCache();
+ $cacheKey = 'arrayFromQuery' . $urlQuery;
+
+ if ($cache->contains($cacheKey)) {
+ return $cache->fetch($cacheKey);
+ }
+
if ($urlQuery[0] == '?') {
$urlQuery = substr($urlQuery, 1);
}
@@ -200,6 +208,9 @@ class UrlHelper
$nameToValue[$name] = $value;
}
}
+
+ $cache->save($cacheKey, $nameToValue);
+
return $nameToValue;
}
@@ -214,6 +225,7 @@ class UrlHelper
public static function getParameterFromQueryString($urlQuery, $parameter)
{
$nameToValue = self::getArrayFromQueryString($urlQuery);
+
if (isset($nameToValue[$parameter])) {
return $nameToValue[$parameter];
}
diff --git a/plugins/Referrers/Columns/Base.php b/plugins/Referrers/Columns/Base.php
index feacc90e55..5c80aa6349 100644
--- a/plugins/Referrers/Columns/Base.php
+++ b/plugins/Referrers/Columns/Base.php
@@ -70,7 +70,7 @@ abstract class Base extends VisitDimension
{
$cacheKey = $referrerUrl . $currentUrl . $idSite;
- if (array_key_exists($cacheKey, self::$cachedReferrer)) {
+ if (isset(self::$cachedReferrer[$cacheKey])) {
return self::$cachedReferrer[$cacheKey];
}
@@ -108,9 +108,7 @@ abstract class Base extends VisitDimension
}
}
- if (!empty($this->referrerHost)
- && !$referrerDetected
- ) {
+ if (!$referrerDetected && !empty($this->referrerHost)) {
$this->typeReferrerAnalyzed = Common::REFERRER_TYPE_WEBSITE;
$this->nameReferrerAnalyzed = Common::mb_strtolower($this->referrerHost);
}
@@ -345,7 +343,6 @@ abstract class Base extends VisitDimension
$type = $visitor->getVisitorColumn('referer_type');
$name = $visitor->getVisitorColumn('referer_name');
$keyword = $visitor->getVisitorColumn('referer_keyword');
- $time = $visitor->getVisitorColumn('visit_first_action_time');
// 0) In some (unknown!?) cases the campaign is not found in the attribution cookie, but the URL ref was found.
// In this case we look up if the current visit is credited to a campaign and will credit this campaign rather than the URL ref (since campaigns have higher priority)
@@ -359,7 +356,6 @@ abstract class Base extends VisitDimension
$type = Common::REFERRER_TYPE_CAMPAIGN;
$name = $referrerCampaignName;
$keyword = $referrerCampaignKeyword;
- $time = $referrerTimestamp;
} // 2) Referrer URL parsing
elseif (!empty($referrerUrl)) {
@@ -371,7 +367,6 @@ abstract class Base extends VisitDimension
$type = $referrer['referer_type'];
$name = $referrer['referer_name'];
$keyword = $referrer['referer_keyword'];
- $time = $referrerTimestamp;
}
}
diff --git a/tests/LocalTracker.php b/tests/LocalTracker.php
index 6e251e6d21..fd98ccfd89 100755
--- a/tests/LocalTracker.php
+++ b/tests/LocalTracker.php
@@ -45,6 +45,7 @@ class Piwik_LocalTracker extends PiwikTracker
// unset cached values
Cache::$cache = null;
+ Tracker\Visit::$dimensions = null;
// save some values
$plugins = Config::getInstance()->Plugins['Plugins'];
@@ -77,6 +78,7 @@ class Piwik_LocalTracker extends PiwikTracker
$request = new Tracker\RequestSet();
$request->setRequests($requests);
+ \Piwik\Plugin\Manager::getInstance()->loadTrackerPlugins();
$handler = Tracker\Handler\Factory::make();
$response = $localTracker->main($handler, $request);
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php
index a9d77d5813..02dd26cc98 100644
--- a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php
+++ b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php
@@ -15,6 +15,7 @@ use Piwik\Plugins\UserCountry\LocationProvider;
use Piwik\Tests\Framework\Fixture;
use Exception;
use Piwik\Tests\Framework\Mock\LocationProvider as MockLocationProvider;
+use Piwik\Tracker\Visit;
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Framework/Mock/LocationProvider.php';
@@ -93,6 +94,7 @@ class ManyVisitsWithGeoIP extends Fixture
if ($useLocal) {
Cache::getTransientCache()->flushAll(); // make sure dimension cache is empty between local tracking runs
+ Visit::$dimensions = null;
}
// use local tracker so mock location provider can be used
diff --git a/tests/PHPUnit/Integration/Tracker/VisitTest.php b/tests/PHPUnit/Integration/Tracker/VisitTest.php
index 919a918516..a9407b8816 100644
--- a/tests/PHPUnit/Integration/Tracker/VisitTest.php
+++ b/tests/PHPUnit/Integration/Tracker/VisitTest.php
@@ -41,6 +41,7 @@ class VisitTest extends IntegrationTestCase
Manager::getInstance()->loadTrackerPlugins();
Manager::getInstance()->loadPlugin('SitesManager');
+ Visit::$dimensions = null;
}
/**
@@ -450,6 +451,7 @@ class VisitTest extends IntegrationTestCase
$cache = Cache::getTransientCache();
$cache->save(CacheId::pluginAware('VisitDimensions'), $dimensions);
+ Visit::$dimensions = null;
}
}
diff --git a/tests/PHPUnit/System/BlobReportLimitingTest.php b/tests/PHPUnit/System/BlobReportLimitingTest.php
index 84734b7b80..d8c6cc5145 100755
--- a/tests/PHPUnit/System/BlobReportLimitingTest.php
+++ b/tests/PHPUnit/System/BlobReportLimitingTest.php
@@ -7,6 +7,7 @@
*/
namespace Piwik\Tests\System;
+use Piwik\Cache;
use Piwik\Config;
use Piwik\Plugins\Actions\ArchivingHelper;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
@@ -29,6 +30,12 @@ class BlobReportLimitingTest extends SystemTestCase
parent::setUpBeforeClass();
}
+ public function setUp()
+ {
+ Cache::getTransientCache()->flushAll();
+ parent::setUp();
+ }
+
public function getApiForTesting()
{
// TODO: test Provider plugin? Not sure if it's possible.