Content Folder Permissions on create in kirby 3

#1

Same question as on: Content Folder Permissions on create but for Kirby 3? How can we change this setting? I didn’t found it in the documentation.

I only want to change the permission of the created files/directories from 644 to 664.

#2

I can’t find any file/folder permission setting anywhere in the source code. You could use a hook to chmod() the folder/file upon creation.

#3

thanks for your response I used the following hooks. Based on https://getkirby.com/docs/reference/plugins/extensions/hooks

function updateDirectoryPermissions()
{
    $path = __DIR__ . '/../../content';

    exec("find " . $path . " -type d -exec chmod 0664 {} +");
    exec("find " . $path . " -type f -exec chmod 0664 {} +");
}

// site/config/config.php 
return [
    'hooks' => [
    'page.create:after' => function ($page) {
        updateDirectoryPermissions();
    },
    'page.update:after' => function ($newPage, $oldPage) {
        updateDirectoryPermissions();
    }
]
#4

Maybe there’s also a way to set this generally on your server instead of using the hook. You could contact your provider to find out.