keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

inc/cache_enabler_disk.class.php: remove all chmod() calls #339

Closed orlitzky closed 7 months ago

orlitzky commented 7 months ago

Calling chmod() on newly-created files creates some problems that are discussed in depth in issue 320. Essentially, the plugin cannot know the access control mechanisms in use, and therefore cannot know what the "correct" permissions are. Two real consequences of this are,

  1. Running "chmod 755" grants more permissions than is desired on a system where the umask would make them 750.

  2. Changing the group bits breaks POSIX access control lists.

There are always better ways to address the problem of files being created with the wrong permissions, so this commit drops the calls to chmod() to undo the regression with respect to the above two items.

Closes: https://github.com/keycdn/cache-enabler/issues/320

orlitzky commented 7 months ago

One more: thank you.

If this causes problems for anyone, I'm available to help figure out a better solution than chmod.

svenba commented 7 months ago

Thank you for your contribution!

I've pushed the new release. Let's see if this is going to cause some issues.