From aa06716b25e63d255e7d6b87d57df0ac1ed8c86e Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 25 May 2012 16:49:59 +0200 Subject: [PATCH] Creating a new directory for Twig cache archive/twig see #4635 --- main/inc/lib/template.lib.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 5fa1f7fbfe..20caff001b 100644 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -42,9 +42,15 @@ class Template { $template_paths = array( api_get_path(SYS_CODE_PATH).'template', //template folder - api_get_path(SYS_PLUGIN_PATH) //plugin folder + api_get_path(SYS_PLUGIN_PATH) //plugin folder ); + $cache_folder = api_get_path(SYS_ARCHIVE_PATH).'twig'; + + if (!is_dir($cache_folder)) { + mkdir($cache_folder, api_get_permissions_for_new_directories()); + } + $loader = new Twig_Loader_Filesystem($template_paths); //Setting Twig options depending on the server see http://twig.sensiolabs.org/doc/api.html#environment-options @@ -59,7 +65,7 @@ class Template { ); } else { $options = array ( - 'cache' => api_get_path(SYS_ARCHIVE_PATH), //path to the cache folder + 'cache' => $cache_folder, //path to the cache folder 'autoescape' => false, 'debug' => false, 'auto_reload' => false,