[wp-trac] Re: [WordPress Trac] #10170: File Permissions on Creation
(Plugin but might be Theme as well)
WordPress Trac
wp-trac at lists.automattic.com
Fri Jun 26 10:13:55 GMT 2009
#10170: File Permissions on Creation (Plugin but might be Theme as well)
-------------------------+--------------------------------------------------
Reporter: hakre | Owner: dd32
Type: enhancement | Status: reopened
Priority: normal | Milestone:
Component: Filesystem | Version: 2.8
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Changes (by hakre):
* status: closed => reopened
* resolution: worksforme =>
Comment:
I could analyze it now and found the cause: it's the umask. As said, 0755
is the default FS_CHMOD_DIR. That is perfecly well.
''WP_Filesystem_Direct->mkdir()'' does use that value then as parameter of
the PHP ''mkdir()'' function. This is where the (design) error resides.
Because ''mkdir()'' will apply the umask (see the PHP
''umask()''-function) to the mode while creating the directory. In my case
the umask is 77 and therefore the directory is created with the 0700 mode.
Conclusion: ''WP_Filesystem_Direct'' does not reflect umask settings while
creating a new directory.
Fix: chmod the path after mkdir:
{{{
if ( ! @mkdir($path, $chmod) )
return false;
chmod($path, $chmod);
}}}
I already tested that fragment and will provide a patch against current
trunk in a minute.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10170#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list