[wp-trac] [WordPress Trac] #35823: Implement "FS_CHMOD_FORCE" constant; if set - media uploads and image resizing do NOT ignore FS_CHMOD_FILE
WordPress Trac
noreply at wordpress.org
Fri Feb 12 23:46:27 UTC 2016
#35823: Implement "FS_CHMOD_FORCE" constant; if set - media uploads and image
resizing do NOT ignore FS_CHMOD_FILE
-------------------------+-----------------------------
Reporter: Profforg | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upload | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Hello.
I want to re-open https://core.trac.wordpress.org/ticket/21251
I think that it's very strange to not giving an ability to globally
override file permissions. Even though WP lead developers thinks that it's
"not good" to use FS_CHMOD_FILE on file uploads - there should be a way to
do it. It will not be default. Default behaviour won't be changed. Filters
or other ways are a madness for users with many websites on board or for
hosting providers which want to set basic options forcefully.
The problem:
One may expect that after setting constant FS_CHMOD_FILE - all files
created or modified (maybe) by WordPress will have FS_CHMOD_FILE
permissions. But for some wierd reason it is not so. I can understand the
explanation from 21251 ticket. So it can be solved by creating a new
constant which control the behaviour.
I've attached a patch which changes upload function's logic to understand
FS_CHMOD_FORCE constant and honor it if it is defined. If it is not
defined (default), behaviour will be the same as it was before.
After applied patch it will be possible to set the following in wp-
config.php or globally:
{{{#!php
<?php
define('FS_CHMOD_FILE', 0640);
define('FS_CHMOD_FORCE', 1);
}}}
so all uploaded files will be uploaded with 0640 chmod. 0640 can be
changed to desired value for sure, this is just an example.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35823>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list