aboutsummaryrefslogtreecommitdiff
path: root/classes/Cache_Local.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2024-06-14 13:47:14 +0300
committerAndrew Dolgov <fox@fakecake.org>2024-06-14 13:47:14 +0300
commitcc51487f080166b2a21eb529f1d4fc29994d9ff1 (patch)
treee87e5ce6c96a233b9f50c8fb456b02834a585ec1 /classes/Cache_Local.php
parent66db7dc0ac996f528f6ff9d71f3cc7ec30d65278 (diff)
parent9e6684e9277dace834ef10dab21c5b585f291675 (diff)
Merge branch 'master' into weblate-integration
Diffstat (limited to 'classes/Cache_Local.php')
-rw-r--r--classes/Cache_Local.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/classes/Cache_Local.php b/classes/Cache_Local.php
index 8ac634a3e..dd3548111 100644
--- a/classes/Cache_Local.php
+++ b/classes/Cache_Local.php
@@ -11,7 +11,14 @@ class Cache_Local implements Cache_Adapter {
}
public function set_dir(string $dir) : void {
- $this->dir = Config::get(Config::CACHE_DIR) . "/" . basename(clean($dir));
+ $cache_dir = Config::get(Config::CACHE_DIR);
+
+ // use absolute path local to current dir if CACHE_DIR is relative
+ // TODO: maybe add a special method to Config() for this?
+ if ($cache_dir[0] != '/')
+ $cache_dir = dirname(__DIR__) . "/$cache_dir";
+
+ $this->dir = $cache_dir . "/" . basename(clean($dir));
$this->make_dir();
}