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:
-rw-r--r--core/Tracker/Visit.php14
-rw-r--r--plugins/UserSettings/API.php2
2 files changed, 9 insertions, 7 deletions
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index 470ec3eb4c..cfca27271a 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -14,7 +14,7 @@ use Piwik\Config;
use Piwik\IP;
use Piwik\Piwik;
use Piwik\Tracker;
-use UserAgentParser;
+use DeviceDetector;
/**
* Class used to handle a Visit.
@@ -592,20 +592,22 @@ class Visit implements VisitInterface
if (is_array($this->userSettingsInformation)) {
return $this->userSettingsInformation;
}
- require_once PIWIK_INCLUDE_PATH . '/libs/UserAgentParser/UserAgentParser.php';
list($plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF,
$plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie) = $this->request->getPlugins();
$resolution = $this->request->getParam('res');
$userAgent = $this->request->getUserAgent();
- $aBrowserInfo = UserAgentParser::getBrowser($userAgent);
- $browserName = ($aBrowserInfo !== false && $aBrowserInfo['id'] !== false) ? $aBrowserInfo['id'] : 'UNK';
+ $deviceDetector = new DeviceDetector($userAgent);
+ $deviceDetector->parse();
+ $aBrowserInfo = $deviceDetector->getBrowser();
+
+ $browserName = ($aBrowserInfo !== false && $aBrowserInfo['short_name'] !== false) ? $aBrowserInfo['short_name'] : 'UNK';
$browserVersion = ($aBrowserInfo !== false && $aBrowserInfo['version'] !== false) ? $aBrowserInfo['version'] : '';
- $os = UserAgentParser::getOperatingSystem($userAgent);
- $os = $os === false ? 'UNK' : $os['id'];
+ $os = $deviceDetector->getOS();
+ $os = empty($os['short_name']) ? 'UNK' : $os['short_name'];
$browserLang = substr($this->request->getBrowserLanguage(), 0, 20); // limit the length of this string to match db
$configurationHash = $this->getConfigHash(
diff --git a/plugins/UserSettings/API.php b/plugins/UserSettings/API.php
index 036e4d14c0..432863c1ed 100644
--- a/plugins/UserSettings/API.php
+++ b/plugins/UserSettings/API.php
@@ -65,7 +65,7 @@ class API extends \Piwik\Plugin\API
/**
* Gets a DataTable displaying number of visits by operating system family. The operating
- * system families are listed in /libs/UserAgentParser/UserAgentParser.php.
+ * system families are listed in vendor piwik/device-detector.
*/
public function getOSFamily($idSite, $period, $date, $segment = false)
{