twigphp / Twig

Twig, the flexible, fast, and secure template language for PHP
https://twig.symfony.com/
BSD 3-Clause "New" or "Revised" License
8.17k stars 1.25k forks source link

[FR] `dirMode` and `fileMode` options for FilesystemCache #3827

Open brandonkelly opened 1 year ago

brandonkelly commented 1 year ago

Currently FilesystemCache creates directories with 777 permissions, and PHP files with 666 permissions. It would be nice if new dirMode and fileMode options were supported, which could be used to override those default permissions.

fabpot commented 2 months ago

I think the current code is reasonable. We're doing the same in Symfony as well. Note that the mode is affected by the umask. So, it's not necessarily 0777. You can call umask() to change the permissions.

if new dirMode and fileMode options were supported -> I'm not sure what you're referring to here?

brandonkelly commented 1 month ago

if new dirMode and fileMode options were supported -> I'm not sure what you're referring to here?

I was suggesting that Twig could add new dirMode and fileMode options, giving us a way to set the permissions programmatically when initializing the Twig environment.

fabpot commented 1 month ago

Would you agree that using umask() is enough?