Added option to set cache file permissions (like you can do with Zend_Cache_Backend_File). It's needed in some setups like ours.
The cache directory wasn't created with the set permissions under some conditions (probably an umask related issue), so added a fix for that as well.
Added option to set cache file permissions.
Fix to make sure directory permissions are set.
There's definitely an issue there, but this might be taking it in the wrong direction :)
If the system were properly configured, the current umask value would be appropriate. Working around a misconfigured umask in a library seems like a bad idea. If this library is a good citizen, it would write its files as the apache/php user, and apply the currently configured umask. So I'd rather change to something like this:
chmod($fileName, 0666 & ~umask());
This does put the onus on the user (or sysadmin) to set up their umask properly, but it should just work almost everywhere.
Is there a reason you're unable to fix your system settings?
Thanks for considering :)
I'm not that familiar with unix systems/umasks and so on, so I might be wrong. But, for example, in a shared host environment the users might not be able to set the umask / or have to knowledge to set the umask.
Our case: We deploy to many different servers and environments, and don't really know about the umask setting on these. The mustache cache directory and files were created as the apache/php user, with 0644 permissions. The implicaiton of this was that the SSH/FTP user (not apache) didn't have any access to these files, and prevented any future change in the project file structure.
My opinion is that this should be optionally independent from any umask setting. Maybe people don't want all their files to be created with write permissions, just the mustache cache files. The Zend Framework user base is quite large, and they felt the need for this setting for their cache files. If you feel strongly about respecting the umask, maybe you could make the option an override instead, defaulting to umask if not set?
Thanks. I do see the value in letting people override it, but I have a strong preference that they configure their system properly instead :)
I've merged your changes, with a couple of changes:
As I said, this has been merged into dev and will go into the next release. Thanks again!
Fair enough :) Thanks!