diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index 36ab8d8a4e7fe..00cab17b67afd 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -24,6 +24,19 @@ filter="word"> + + + + + set('caching', 0); $registry->set('cache_handler', 'file'); $registry->set('cachetime', 15); + $registry->set('cache_platformprefix', 0); // Meta settings. $registry->set('MetaDesc', $options->site_metadesc); diff --git a/libraries/joomla/cache/cache.php b/libraries/joomla/cache/cache.php index 2fb22c99714e8..52e8b24f06388 100644 --- a/libraries/joomla/cache/cache.php +++ b/libraries/joomla/cache/cache.php @@ -751,6 +751,33 @@ public static function makeId() return md5(serialize($safeuriaddon)); } + /*** Set prefix cache key if device calls for separate caching + * + * @return string Platform specific prefix + * + * @since 3.5 + */ + public static function getPlatformPrefix() + { + $conf = JFactory::getConfig(); + + // No prefix when Global Config is set to no platfom specific prefix + if (!$conf->get('cache_platformprefix', '0')) + { + return ''; + } + + jimport('joomla.application.web.client'); + $webclient = new JApplicationWebClient(); + + if ($webclient->mobile) + { + return 'M-'; + } + + return ''; + } + /** * Add a directory where JCache should search for handlers. You may * either pass a string or an array of directories. diff --git a/libraries/joomla/cache/storage.php b/libraries/joomla/cache/storage.php index d22f5d9bee76a..028a19479a992 100644 --- a/libraries/joomla/cache/storage.php +++ b/libraries/joomla/cache/storage.php @@ -312,10 +312,11 @@ public function unlock($id, $group = null) */ protected function _getCacheId($id, $group) { + $prefix = JCache::getPlatformPrefix(); $name = md5($this->_application . '-' . $id . '-' . $this->_language); $this->rawname = $this->_hash . '-' . $name; - return $this->_hash . '-cache-' . $group . '-' . $name; + return $prefix . $this->_hash . '-cache-' . $group . '-' . $name; } /**