From f45dc55d4859a55e16fd3dde408996deb7e50ab6 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 1 Jan 2023 20:33:32 +0000 Subject: [PATCH] Use Git HEAD hash for the template cache folder name. --- misuzu.php | 7 +++++-- src/MszContext.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/misuzu.php b/misuzu.php index 51ebc8b..62a3ef0 100644 --- a/misuzu.php +++ b/misuzu.php @@ -1,7 +1,6 @@ getValue('geoip.database', CfgType::T_STR, '/var/lib/GeoIP/GeoLite2-Country.mmdb')); if(!MSZ_DEBUG) { - $twigCache = sys_get_temp_dir() . '/msz-tpl-cache-' . md5(MSZ_ROOT); + $twigCacheDirSfx = GitInfo::hash(true); + if(empty($twigCacheDirSfx)) + $twigCacheDirSfx = md5(MSZ_ROOT); + + $twigCache = sys_get_temp_dir() . '/msz-tpl-' . $twigCacheDirSfx; if(!is_dir($twigCache)) mkdir($twigCache, 0775, true); } diff --git a/src/MszContext.php b/src/MszContext.php index 85e6ad8..dcb318a 100644 --- a/src/MszContext.php +++ b/src/MszContext.php @@ -1,8 +1,8 @@