forked from leftypol/leftypol
template.php install.php: handle cache directory being a symlink
This commit is contained in:
parent
06214a1e26
commit
5873987599
2 changed files with 7 additions and 5 deletions
|
@ -13,12 +13,15 @@ $twig = false;
|
||||||
|
|
||||||
function load_twig() {
|
function load_twig() {
|
||||||
global $twig, $config;
|
global $twig, $config;
|
||||||
|
|
||||||
|
$cache_dir = "{$config['dir']['template']}/cache/";
|
||||||
|
|
||||||
$loader = new Twig_Loader_Filesystem($config['dir']['template']);
|
$loader = new Twig_Loader_Filesystem($config['dir']['template']);
|
||||||
$loader->setPaths($config['dir']['template']);
|
$loader->setPaths($config['dir']['template']);
|
||||||
$twig = new Twig_Environment($loader, array(
|
$twig = new Twig_Environment($loader, array(
|
||||||
'autoescape' => false,
|
'autoescape' => false,
|
||||||
'cache' => is_writable('templates') || (is_dir('templates/cache') && is_writable('templates/cache')) ?
|
'cache' => is_writable('templates/') || (is_dir($cache_dir) && is_writable($cache_dir)) ?
|
||||||
"{$config['dir']['template']}/cache" : false,
|
$cache_dir : false,
|
||||||
'debug' => $config['debug']
|
'debug' => $config['debug']
|
||||||
));
|
));
|
||||||
$twig->addExtension(new Twig_Extensions_Extension_Tinyboard());
|
$twig->addExtension(new Twig_Extensions_Extension_Tinyboard());
|
||||||
|
|
|
@ -818,14 +818,14 @@ if ($step == 0) {
|
||||||
array(
|
array(
|
||||||
'category' => 'File permissions',
|
'category' => 'File permissions',
|
||||||
'name' => getcwd() . '/templates/cache',
|
'name' => getcwd() . '/templates/cache',
|
||||||
'result' => is_writable('templates') || (is_dir('templates/cache') && is_writable('templates/cache')),
|
'result' => is_dir('templates/cache/') && is_writable('templates/cache/'),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'message' => 'You must give vichan permission to create (and write to) the <code>templates/cache</code> directory or performance will be drastically reduced.'
|
'message' => 'You must give vichan permission to create (and write to) the <code>templates/cache</code> directory or performance will be drastically reduced.'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'category' => 'File permissions',
|
'category' => 'File permissions',
|
||||||
'name' => getcwd() . '/tmp/cache',
|
'name' => getcwd() . '/tmp/cache',
|
||||||
'result' => is_dir('tmp/cache') && is_writable('tmp/cache'),
|
'result' => is_dir('tmp/cache/') && is_writable('tmp/cache/'),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'message' => 'You must give vichan permission to write to the <code>tmp/cache</code> directory.'
|
'message' => 'You must give vichan permission to write to the <code>tmp/cache</code> directory.'
|
||||||
),
|
),
|
||||||
|
@ -993,4 +993,3 @@ if ($step == 0) {
|
||||||
|
|
||||||
echo Element('page.html', $page);
|
echo Element('page.html', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue