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:
authorsgiehl <stefan@piwik.org>2015-01-19 02:17:29 +0300
committersgiehl <stefan@piwik.org>2015-01-19 02:17:29 +0300
commitfa4ae23332189ec1e2e9a5eff47d80a82fbb27cf (patch)
tree1da67df60bb0dc09714efdf1b5ce8f63fb03f222
parent20c994ca4110eb1478d356d3582f211821d5ad6f (diff)
fixed device detector cache; added fallback for old windows short codes
-rw-r--r--core/DeviceDetectorCache.php27
-rw-r--r--plugins/DevicesDetection/Visitor.php2
-rw-r--r--plugins/DevicesDetection/functions.php13
3 files changed, 38 insertions, 4 deletions
diff --git a/core/DeviceDetectorCache.php b/core/DeviceDetectorCache.php
index c337b1b0a4..bd66523519 100644
--- a/core/DeviceDetectorCache.php
+++ b/core/DeviceDetectorCache.php
@@ -18,7 +18,7 @@ use Exception;
*
* Static caching speeds up multiple detections in one request, which is the case when sending bulk requests
*/
-class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface
+class DeviceDetectorCache implements \DeviceDetector\Cache\Cache
{
protected static $staticCache = array();
@@ -37,7 +37,7 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface
* @param string $id The cache entry ID
* @return array|bool False on error, or array the cache content
*/
- public function get($id)
+ public function fetch($id)
{
if (empty($id)) {
return false;
@@ -58,7 +58,7 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface
* @throws \Exception
* @return bool True if the entry was succesfully stored
*/
- public function set($id, $content)
+ public function save($id, $content, $ttl=0)
{
if (empty($id)) {
return false;
@@ -69,4 +69,25 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface
return $this->cache->save($id, $content, $this->ttl);
}
+ public function contains($id)
+ {
+ return !empty(self::$staticCache[$id]) && $this->cache->contains($id);
+ }
+
+ public function delete($id)
+ {
+ if (empty($id)) {
+ return false;
+ }
+
+ unset(self::$staticCache[$id]);
+
+ return $this->cache->delete($id);
+ }
+
+ public function flushAll()
+ {
+ return $this->cache->flushAll();
+ }
+
}
diff --git a/plugins/DevicesDetection/Visitor.php b/plugins/DevicesDetection/Visitor.php
index aa5b16c2ae..63e67a53a4 100644
--- a/plugins/DevicesDetection/Visitor.php
+++ b/plugins/DevicesDetection/Visitor.php
@@ -31,7 +31,7 @@ class Visitor
public function getOperatingSystem()
{
- return getOsFullName($this->details['config_os']);
+ return getOsFullName($this->details['config_os'] . ";" . $this->details['config_os_version']);
}
public function getOperatingSystemIcon()
diff --git a/plugins/DevicesDetection/functions.php b/plugins/DevicesDetection/functions.php
index 8ab0ffe925..1aff9a6fb7 100644
--- a/plugins/DevicesDetection/functions.php
+++ b/plugins/DevicesDetection/functions.php
@@ -240,6 +240,19 @@ function _mapLegacyOsShortCodes($shortCode)
'DSI' => 'NDS', // Nintendo DSi => Nintendo Mobile
'PSV' => 'PSP', // PlayStation Vita => PlayStation Portable
'MAE' => 'SMG', // Maemo => MeeGo
+ 'W10' => 'WIN',
+ 'W2K' => 'WIN',
+ 'W31' => 'WIN',
+ 'WI7' => 'WIN',
+ 'WI8' => 'WIN',
+ 'W81' => 'WIN',
+ 'W95' => 'WIN',
+ 'W98' => 'WIN',
+ 'WME' => 'WIN',
+ 'WNT' => 'WIN',
+ 'WS3' => 'WIN',
+ 'WVI' => 'WIN',
+ 'WXP' => 'WIN',
//'VMS' => '', // OpenVMS => ??
);
return array_key_exists($shortCode, $legacyShortCodes) ? $legacyShortCodes[$shortCode] : $shortCode;