diff options
Diffstat (limited to 'core/CacheId.php')
-rw-r--r-- | core/CacheId.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/core/CacheId.php b/core/CacheId.php new file mode 100644 index 0000000000..e445424009 --- /dev/null +++ b/core/CacheId.php @@ -0,0 +1,30 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik; + +use Piwik\Translate; +use Piwik\Plugin\Manager; + +class CacheId +{ + public static function languageAware($cacheId) + { + return $cacheId . '-' . Translate::getLanguageLoaded(); + } + + public static function pluginAware($cacheId) + { + $pluginManager = Manager::getInstance(); + $pluginNames = $pluginManager->getLoadedPluginsName(); + $cacheId = $cacheId . '-' . md5(implode('', $pluginNames)); + $cacheId = self::languageAware($cacheId); + + return $cacheId; + } +} |