Skip to content

Commit

Permalink
#9806 Included base URL to the CSS cache
Browse files Browse the repository at this point in the history
(cherry picked from commit ae4d9d5)
  • Loading branch information
jonasraoni committed Mar 21, 2024
1 parent fd0bd36 commit a2324e5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions classes/template/PKPTemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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/');

Expand Down Expand Up @@ -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";
}

/**
Expand Down

0 comments on commit a2324e5

Please sign in to comment.