I am using Cake\Cache\Engine\FileEngine
for cache in my CakePHP 3.6 app. I would like to define cache directories permissions. I have tried using 'mask' in Cache config, but it only affects the files that the cache is creating, not directories.
It looks like cache directory permissions are always set to drwxr-xr-x
, which makes it a problem for me, because in such a case only the owner can delete files in these directories. I need a directory be writable by group as well, not only the owner.
Question: Is it possible to define what file permissions should the cache directories be created with by CakePHP?
My current config:
'_cake_model_' => [
'className' => 'Cake\Cache\Engine\FileEngine',
'prefix' => 'myapp_cake_model_',
'path' => CACHE . 'models/',
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKEMODEL_URL', null),
'mask' => 0666,
],
/tmp/cache listing:
drwxr-xr-x 2 www-data www-data 4096 Feb 7 12:15 models/
-rw-rw-rw- 1 www-data www-data 396020 Feb 7 12:07 myapp_cake_routes_route_collection
drwxr-xr-x 2 www-data www-data 4096 Feb 7 12:05 persistent/
Note: I understand I can manually chmod
the directories, but they will get recreated with the default permissions after deleting them, so it's not the best fix.