Skip to content

[4.x] Enable configuration of static cache file and directory permissions - #9755

Merged
jasonvarga merged 5 commits into
statamic:4.xfrom
ryanmitchell:feature/add-config-for-static-cache-write-permissions
Mar 22, 2024
Merged

jasonvarga merged 5 commits into
statamic:4.xfrom
ryanmitchell:feature/add-config-for-static-cache-write-permissions

Conversation

@ryanmitchell

@ryanmitchell ryanmitchell commented Mar 19, 2024 •

Copy link
Copy Markdown
Contributor

This PR provides new configuration keys for the permissions with which to write static caching files and directories.

This also reduces the default permissions inline with what you'd expect based on Flysystem. See https://github.com/thephpleague/flysystem/blob/b25a361508c407563b34fac6f64a8a17a8819675/src/UnixVisibility/PortableVisibilityConverter.php#L13-L15

Closes #9480

Comment thread src/StaticCaching/Cachers/Writer.php Resolved

@jasonvarga jasonvarga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the config part of the strategy instead? In here:

'full' => [
'driver' => 'file',
'path' => public_path('static'),
'lock_hold_length' => 0,
],

And pass the config into the Writer here:

return new FileCacher(new Writer, $this->cacheStore(), $config);

@ryanmitchell

Copy link
Copy Markdown
Contributor Author

I think this is what you meant, let me know if not: d4f5d1f (#9755)

@jasonvarga

Copy link
Copy Markdown
Member

Yup, thanks!

@jasonvarga jasonvarga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static cache writer class should use configurable permissions

3 participants