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
path: root/core
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-06-03 05:37:07 +0400
committermattab <matthieu.aubry@gmail.com>2014-06-03 05:37:07 +0400
commit226a767be6122628fbc9e5e5f4da3e0e81a4a10f (patch)
treefdf5445c48f0174538e60738805c4760ee83d867 /core
parentfe4c88429f395f1c700947a8f4c2b3ffef7cf4a7 (diff)
Reuse the Settings object, for performance improvements (only parse the User agent once)
refs https://github.com/piwik/piwik/pull/296
Diffstat (limited to 'core')
-rw-r--r--core/Tracker/Visit.php13
-rw-r--r--core/Tracker/Visitor.php4
2 files changed, 8 insertions, 9 deletions
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index 25b69abead..d763fb7031 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -144,7 +144,7 @@ class Visit implements VisitInterface
/***
* Visitor recognition
*/
- $visitor = New Visitor($this->request, $this->visitorInfo, $this->visitorCustomVariables);
+ $visitor = new Visitor($this->request, $this->getSettingsObject(), $this->visitorInfo, $this->visitorCustomVariables);
$visitor->recognize();
$this->visitorKnown = $visitor->isVisitorKnown();
@@ -381,16 +381,16 @@ class Visit implements VisitInterface
}
/**
- * Gets the UserSettings information and returns them in an array of name => value
+ * Gets the UserSettings object
*
- * @return array
+ * @return Settings
*/
- protected function getUserSettingsInformation()
+ protected function getSettingsObject()
{
if(is_null($this->userSettings)) {
$this->userSettings = new Settings( $this->request, $this->getVisitorIp() );
}
- return $this->userSettings->getInfo();
+ return $this->userSettings;
}
/**
@@ -521,7 +521,8 @@ class Visit implements VisitInterface
}
// User settings
- $userInfo = $this->getUserSettingsInformation();
+ $userInfo = $this->getSettingsObject();
+ $userInfo = $userInfo->getInfo();
// Referrer data
$referrer = new Referrer();
diff --git a/core/Tracker/Visitor.php b/core/Tracker/Visitor.php
index 15e69eab96..19ac7171e4 100644
--- a/core/Tracker/Visitor.php
+++ b/core/Tracker/Visitor.php
@@ -16,13 +16,11 @@ use Piwik\Tracker;
class Visitor
{
- function __construct(Request $request, $visitorInfo = array(), $customVariables = null)
+ function __construct(Request $request, Tracker\Settings $settings, $visitorInfo = array(), $customVariables = null)
{
$this->request = $request;
$this->visitorInfo = $visitorInfo;
$this->customVariables = $customVariables;
-
- $settings = new Tracker\Settings($request, $this->visitorInfo['location_ip']);
$this->userInfo = $settings->getInfo();
}