diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php index 494970373..8f9675265 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -892,7 +892,7 @@ class Actions $aResult['userLanguage'] = $this->ValidateLanguage($UserLanguageRaw, '', false, true); $aResult['PluginsLink'] = $this->oPlugins->HaveJs($bAdmin) - ? 'Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $this->StaticCache() . '/' + ? 'Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $this->etag($this->oPlugins->Hash()) . '/' : ''; $bAppJsDebug = $this->oConfig->Get('debug', 'javascript', false) @@ -1033,7 +1033,8 @@ class Actions public function etag(string $sKey): string { - return \md5($sKey . $this->oConfig->Get('cache', 'index', '')); +// if ($sKey && $this->oConfig->Get('cache', 'enable', true) && $this->oConfig->Get('cache', 'http', true)) { + return \md5($sKey . $this->oConfig->Get('cache', 'index', '') . APP_VERSION); } public function cacheByKey(string $sKey): bool @@ -1095,15 +1096,6 @@ class Actions */ } - public function StaticCache(): string - { - static $sCache = null; - if (!$sCache) { - $sCache = \md5(APP_VERSION . $this->oPlugins->Hash()); - } - return $sCache; - } - public function SetActionParams(array $aCurrentActionParams, string $sMethodName = ''): self { $this->oPlugins->RunHook('filter.action-params', array($sMethodName, &$aCurrentActionParams)); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php index 9087a547a..94210b690 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php @@ -184,8 +184,9 @@ abstract class Service $sCacheFileName = ''; if ($oConfig->Get('cache', 'system_data', true)) { - $sCacheFileName = 'TMPL:' . $sLanguage . \sha1( + $sCacheFileName = 'TMPL:' . \sha1( Utils::jsonEncode(array( + $sLanguage, $oConfig->Get('cache', 'index', ''), $oActions->Plugins()->Hash(), $sAppJsMin, diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index 20cfa049c..ad1daddc9 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -380,7 +380,6 @@ class ServiceActions public function ServiceLang() : string { -// sleep(2); $sResult = ''; \header('Content-Type: application/javascript; charset=utf-8'); @@ -389,27 +388,22 @@ class ServiceActions $sLanguage = $this->oActions->ValidateLanguage($this->aPaths[3], '', $bAdmin); $bCacheEnabled = $this->Config()->Get('cache', 'system_data', true); - if (!empty($sLanguage) && $bCacheEnabled) { - $this->oActions->verifyCacheByKey($this->sQuery); - } - $sCacheFileName = ''; if ($bCacheEnabled) { - $sCacheFileName = KeyPathHelper::LangCache( - $sLanguage, $bAdmin, $this->oActions->Plugins()->Hash()); - + $sCacheFileName = KeyPathHelper::LangCache($sLanguage, $bAdmin, $this->oActions->Plugins()->Hash()); + $this->oActions->verifyCacheByKey(\md5($sCacheFileName)); $sResult = $this->Cacher()->Get($sCacheFileName); } if (!\strlen($sResult)) { $sResult = $this->oActions->compileLanguage($sLanguage, $bAdmin); - if ($bCacheEnabled && \strlen($sCacheFileName)) { + if ($sCacheFileName) { $this->Cacher()->Set($sCacheFileName, $sResult); } } - if ($bCacheEnabled) { - $this->oActions->cacheByKey($this->sQuery); + if ($sCacheFileName) { + $this->oActions->cacheByKey(\md5($sCacheFileName)); } } @@ -427,13 +421,10 @@ class ServiceActions $sMinify = ($bAppDebug || $this->Config()->Get('debug', 'javascript', false)) ? '' : 'min'; $bCacheEnabled = !$bAppDebug && $this->Config()->Get('cache', 'system_data', true); - if ($bCacheEnabled) { - $this->oActions->verifyCacheByKey($this->sQuery . $sMinify); - } - $sCacheFileName = ''; if ($bCacheEnabled) { $sCacheFileName = KeyPathHelper::PluginsJsCache($this->oActions->Plugins()->Hash()) . $sMinify; + $this->oActions->verifyCacheByKey(\md5($sCacheFileName)); $sResult = $this->Cacher()->Get($sCacheFileName); } @@ -444,8 +435,8 @@ class ServiceActions } } - if ($bCacheEnabled) { - $this->oActions->cacheByKey($this->sQuery . $sMinify); + if ($sCacheFileName) { + $this->oActions->cacheByKey(\md5($sCacheFileName)); } return $sResult; @@ -471,13 +462,10 @@ class ServiceActions $sMinify = ($bAppDebug || $this->Config()->Get('debug', 'css', false)) ? '' : 'min'; $bCacheEnabled = !$bAppDebug && $this->Config()->Get('cache', 'system_data', true); - if ($bCacheEnabled) { - $this->oActions->verifyCacheByKey($this->sQuery . $sMinify); - } - $sCacheFileName = ''; if ($bCacheEnabled) { $sCacheFileName = KeyPathHelper::CssCache($sTheme, $this->oActions->Plugins()->Hash()) . $sMinify; + $this->oActions->verifyCacheByKey(\md5($sCacheFileName . ($bJson ? 1 : 0))); $sResult = $this->Cacher()->Get($sCacheFileName); } @@ -495,8 +483,8 @@ class ServiceActions } } - if ($bCacheEnabled) { - $this->oActions->cacheByKey($this->sQuery . $sMinify); + if ($sCacheFileName) { + $this->oActions->cacheByKey(\md5($sCacheFileName . ($bJson ? 1 : 0 ))); } }