Skip to content

Commit

Permalink
Merge pull request #11 from moufmouf/fix_file_issue_with_twig_cache
Browse files Browse the repository at this point in the history
Fixing file issues with Twig cache and several users generating cache
  • Loading branch information
moufmouf committed Aug 7, 2018
2 parents 5195ee3 + d2f9371 commit 1bba9f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Mouf/Html/Renderer/FileBasedRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ public function __construct($directory = "src/templates", CacheInterface $cacheS
$this->priority = $priority;

$loader = new \Twig_Loader_Filesystem(ROOT_PATH.$this->directory);
$cacheFilesystem = new \Twig_Cache_Filesystem(rtrim(sys_get_temp_dir(),'/\\').'/mouftwigtemplatemain_'.str_replace(":", "", ROOT_PATH).$this->directory);
if (function_exists('posix_geteuid')) {
$posixGetuid = posix_geteuid();
} else {
$posixGetuid = '';
}
$cacheFilesystem = new \Twig_Cache_Filesystem(rtrim(sys_get_temp_dir(),'/\\').'/mouftwigtemplatemain_'.$posixGetuid.'_'.str_replace(":", "", ROOT_PATH).$this->directory);
if ($twig === null) {

$this->twig = new \Twig_Environment($loader, array(
Expand Down

0 comments on commit 1bba9f6

Please sign in to comment.