You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FR] dirMode and fileMode options for FilesystemCache #3827
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.
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?
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 I don’t think umask() would help in our case.
Several libraries that work with files have dirMode/dirPermission and fileMode/filePermission settings (e.g. RotatingFileHandler in Monolog), so Craft has defaultDirMode and defaultFileMode config settings, and the hope is that those could apply to directories and files created by Twig as well.
Activity
fabpot commentedon Sep 12, 2024
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 commentedon Sep 15, 2024
I was suggesting that Twig could add new
dirModeandfileModeoptions, giving us a way to set the permissions programmatically when initializing the Twig environment.fabpot commentedon Sep 15, 2024
Would you agree that using
umask()is enough?fabpot commentedon Feb 8, 2025
Any feedback on my suggestion @brandonkelly?
ericmorand commentedon Feb 8, 2025
What about not setting any permission at all and just creating the directories and files?
brandonkelly commentedon Feb 10, 2025
@fabpot I don’t think
umask()would help in our case.Several libraries that work with files have
dirMode/dirPermissionandfileMode/filePermissionsettings (e.g.RotatingFileHandlerin Monolog), so Craft hasdefaultDirModeanddefaultFileModeconfig settings, and the hope is that those could apply to directories and files created by Twig as well.brandonkelly commentedon Feb 10, 2025
(Sorry, didn’t mean to close the issue. Rogue trackpad click!)