From a2324e5bee6c03ebb7168f87f37fa39825bb050c Mon Sep 17 00:00:00 2001 From: Jonas Raoni Soares da Silva Date: Tue, 19 Mar 2024 15:53:22 +0300 Subject: [PATCH] pkp/pkp-lib#9806 Included base URL to the CSS cache (cherry picked from commit ae4d9d509ab01efbaab3d9dba6ee265ea82be10d) --- classes/template/PKPTemplateManager.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/classes/template/PKPTemplateManager.php b/classes/template/PKPTemplateManager.php index ef8d42aea99..a468e92fa7a 100644 --- a/classes/template/PKPTemplateManager.php +++ b/classes/template/PKPTemplateManager.php @@ -25,9 +25,6 @@ use APP\core\Application; use APP\core\PageRouter; use APP\core\Request; - -require_once('./lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php'); // Seems to be needed? - use APP\core\Services; use APP\facades\Repo; use APP\file\PublicFileManager; @@ -66,6 +63,8 @@ use Smarty; use Smarty_Internal_Template; +require_once('./lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php'); // Seems to be needed? + /* This definition is required by Smarty */ define('SMARTY_DIR', Core::getBaseDir() . '/lib/pkp/lib/vendor/smarty/smarty/libs/'); @@ -505,10 +504,10 @@ public function cacheLess($path, $styles) */ public function getCachedLessFilePath($name) { - $cacheDirectory = CacheManager::getFileCachePath(); - $context = $this->_request->getContext(); - $contextId = $context instanceof Context ? $context->getId() : 0; - return "{$cacheDirectory}/{$contextId}-{$name}.css"; + $directory = CacheManager::getFileCachePath(); + $contextId = $this->_request->getContext()?->getId() ?? 0; + $hash = crc32($this->_request->getBaseUrl()); + return "{$directory}/{$contextId}-{$name}-{$hash}.css"; } /**