Skip to content
Extraits de code Groupes Projets
Valider fa4ae233 rédigé par sgiehl's avatar sgiehl
Parcourir les fichiers

fixed device detector cache; added fallback for old windows short codes

parent 20c994ca
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -18,7 +18,7 @@ use Exception; ...@@ -18,7 +18,7 @@ use Exception;
* *
* Static caching speeds up multiple detections in one request, which is the case when sending bulk requests * 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(); protected static $staticCache = array();
...@@ -37,7 +37,7 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface ...@@ -37,7 +37,7 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface
* @param string $id The cache entry ID * @param string $id The cache entry ID
* @return array|bool False on error, or array the cache content * @return array|bool False on error, or array the cache content
*/ */
public function get($id) public function fetch($id)
{ {
if (empty($id)) { if (empty($id)) {
return false; return false;
...@@ -58,7 +58,7 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface ...@@ -58,7 +58,7 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface
* @throws \Exception * @throws \Exception
* @return bool True if the entry was succesfully stored * @return bool True if the entry was succesfully stored
*/ */
public function set($id, $content) public function save($id, $content, $ttl=0)
{ {
if (empty($id)) { if (empty($id)) {
return false; return false;
...@@ -69,4 +69,25 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface ...@@ -69,4 +69,25 @@ class DeviceDetectorCache implements \DeviceDetector\Cache\CacheInterface
return $this->cache->save($id, $content, $this->ttl); 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();
}
} }
...@@ -31,7 +31,7 @@ class Visitor ...@@ -31,7 +31,7 @@ class Visitor
public function getOperatingSystem() public function getOperatingSystem()
{ {
return getOsFullName($this->details['config_os']); return getOsFullName($this->details['config_os'] . ";" . $this->details['config_os_version']);
} }
public function getOperatingSystemIcon() public function getOperatingSystemIcon()
......
...@@ -240,6 +240,19 @@ function _mapLegacyOsShortCodes($shortCode) ...@@ -240,6 +240,19 @@ function _mapLegacyOsShortCodes($shortCode)
'DSI' => 'NDS', // Nintendo DSi => Nintendo Mobile 'DSI' => 'NDS', // Nintendo DSi => Nintendo Mobile
'PSV' => 'PSP', // PlayStation Vita => PlayStation Portable 'PSV' => 'PSP', // PlayStation Vita => PlayStation Portable
'MAE' => 'SMG', // Maemo => MeeGo '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 => ?? //'VMS' => '', // OpenVMS => ??
); );
return array_key_exists($shortCode, $legacyShortCodes) ? $legacyShortCodes[$shortCode] : $shortCode; return array_key_exists($shortCode, $legacyShortCodes) ? $legacyShortCodes[$shortCode] : $shortCode;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter