enigne/skin: don't use $globalContext to build cache dir path
This commit is contained in:
parent
45f340e1e3
commit
c2cb432ae6
@ -17,9 +17,9 @@ abstract class BaseSkin
|
||||
protected \Twig\Environment $twig;
|
||||
|
||||
public function __construct() {
|
||||
global $config, $globalContext;
|
||||
global $config;
|
||||
|
||||
$cache_dir = $config['skin_cache_'.(isDev() ? 'dev' : 'prod').'_dir'].'/'.$globalContext->project;
|
||||
$cache_dir = $this->getCacheDir();
|
||||
if (!file_exists($cache_dir)) {
|
||||
if (mkdir($cache_dir, $config['dirs_mode'], true))
|
||||
setperm($cache_dir);
|
||||
@ -35,6 +35,7 @@ abstract class BaseSkin
|
||||
}
|
||||
|
||||
abstract protected function getTwigLoader(): LoaderInterface;
|
||||
abstract protected function getCacheDir(): string;
|
||||
|
||||
public function set($arg1, $arg2 = null) {
|
||||
if (is_array($arg1)) {
|
||||
|
@ -14,6 +14,11 @@ class ErrorSkin
|
||||
return new FilesystemLoader(self::TEMPLATES_ROOT, APP_ROOT);
|
||||
}
|
||||
|
||||
protected function getCacheDir(): string {
|
||||
global $config;
|
||||
return $config['skin_cache_'.(isDev() ? 'dev' : 'prod').'_dir'].'/error';
|
||||
}
|
||||
|
||||
public function renderNotFound(): never {
|
||||
global $globalContext;
|
||||
if (isset($globalContext->project) && file_exists(self::TEMPLATES_ROOT.'/notfound_'.$globalContext->project.'.twig'))
|
||||
|
@ -37,6 +37,11 @@ class ForeignOneSkin
|
||||
return $twig_loader;
|
||||
}
|
||||
|
||||
protected function getCacheDir(): string {
|
||||
global $config;
|
||||
return $config['skin_cache_'.(isDev() ? 'dev' : 'prod').'_dir'].'/foreignone';
|
||||
}
|
||||
|
||||
public function renderPage(string $template, array $vars = []): Response {
|
||||
$this->exportStrings(['4in1']);
|
||||
$this->applyGlobals();
|
||||
|
@ -22,6 +22,11 @@ class InvisibleCollegeSkin
|
||||
return $twig_loader;
|
||||
}
|
||||
|
||||
protected function getCacheDir(): string {
|
||||
global $config;
|
||||
return $config['skin_cache_'.(isDev() ? 'dev' : 'prod').'_dir'].'/ic';
|
||||
}
|
||||
|
||||
/*
|
||||
public function renderPage(string $template, array $vars = []): Response {
|
||||
$this->exportStrings(['4in1']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user