Closed vandres closed 1 year ago
Hi, thanks for reaching out. The directories and files inside the compiled_templates
directories are created by Twig’s FilesystemCache
, not by Craft itself which is why the defaultDirMode
is not respected there.
The compiled_templates
itself is created by Craft, so the defaultDirMode
for it is respected.
Same with the nocache
directory, it’s created via Craft’s FileHelper::createDirectory()
(https://github.com/ttempleton/craft-nocache/blob/main/src/Service.php#L35), which means the defaultDirMode
is respected.
That being said, we’ll discuss this internally.
@i-just Thanks for the quick reply. Is there any way to configure Twig within Craft to use that file mode?
I’m not sure. I couldn’t see an option to do that easily. That’s why I want to discuss this internally. I’ll let you know once I have more info.
Currently FilesystemCache
doesn’t make the dir/file modes configurable. I’ve just opened a feature request to change that: twigphp/Twig#3827
If it gets implemented, we’ll definitely start taking advantage of it, and I’ll update this issue.
What happened?
Description
We are running Craft on a server, where apache is not a real user and every actual user is in the same group with apache. That are users for SFTP and running cronjobs. We had some weird issues with mutex locks, which were not accessable and cache directories, which could not be created.
In the general config we set dir and file mode to include group writing rights.
But on the server, not every directory is created with the correct mode. On the screenshot you can see, that "nocache" is created correctly, but all the other directories are just 0755.
Steps to reproduce
defaultDirMode
Expected behavior
defaultDirMode
is respected for all Craft created directoriesActual behavior
defaultDirMode
is not respected everywhereCraft CMS version
4.3.11
PHP version
8.1
Operating system and version
CentOS
Database type and version
MariaDB 10.5
Image driver and version
-
Installed plugins and versions
"require": { "craftcms/cms": "~4.3.8", "craftcms/commerce": "^4.1.0", "craftcms/commerce-paypal-checkout": "dev-develop", "craftcms/redactor": "^3.0", "mmikkel/cp-field-inspect": "^1.4", "nystudio107/craft-retour": "^4.1", "nystudio107/craft-vite": "^4.0", "php-http/curl-client": "^2.2", "putyourlightson/craft-elements-panel": "^2.0", "putyourlightson/craft-sprig": "^2.1", "sebastianlenz/linkfield": "^2.1", "spatie/craft-ray": "^2.0", "spicyweb/craft-neo": "^3.2", "ttempleton/craft-nocache": "^3.0", "typesense/typesense-php": "^4.8", "vaersaagod/geomate": "^2.1.0", "verbb/expanded-singles": "^2.0", "verbb/field-manager": "^3.0", "verbb/tablemaker": "^4.0", "verbb/wishlist": "^2.0", "vlucas/phpdotenv": "^5.4.0", "wbrowar/adminbar": "^3.2" }, "require-dev": { "deployer/deployer": "^7.0", "yiisoft/yii2-shell": "^2.0.3", "roave/security-advisories": "dev-master" },