Use Git HEAD hash for the template cache folder name.

This commit is contained in:
flash 2023-01-01 20:33:32 +00:00
parent 08f8f59fe6
commit f45dc55d48
2 changed files with 6 additions and 3 deletions

View file

@ -1,7 +1,6 @@
<?php
namespace Misuzu;
use PDO;
use Index\Autoloader;
use Index\Environment;
use Index\Data\ConnectionFailedException;
@ -143,7 +142,11 @@ if(!is_readable(MSZ_STORAGE) || !is_writable(MSZ_STORAGE)) {
GeoIP::init($cfg->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);
}

View file

@ -1,8 +1,8 @@
<?php
namespace Misuzu;
use Misuzu\Config\IConfig;
use Misuzu\Template;
use Misuzu\Config\IConfig;
use Misuzu\SharpChat\SharpChatRoutes;
use Misuzu\Users\Users;
use Index\Data\IDbConnection;