[wp-trac] [WordPress Trac] #20778: get_temp_dir should use the system tmp directory as first choice

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 25 07:15:26 UTC 2012


#20778: get_temp_dir should use the system tmp directory as first choice
------------------------------------+-----------------------
 Reporter:  simonwheatley           |       Owner:  dd32
     Type:  enhancement             |      Status:  accepted
 Priority:  normal                  |   Milestone:  3.5
Component:  Filesystem              |     Version:  2.5
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+-----------------------
Changes (by dd32):

 * status:  assigned => accepted


Comment:

 I completely agree with switching the priorities here, however, the latest
 patch has a small logic error in the case of win_is_writable().

 If win_is_writable() is designed to work around cases where is_writable()
 returns true when it can't actually write to a directory, the current
 logic goes as follows:[[BR]]
 {{{ If ( ( is windows AND windows is writable ) OR is writable ) }}}[[BR]]
 On affected windows hosts that would boil down to {{{ If ( ( 1 AND 0 ) OR
 1 ) }}}

 I'm not sure I understand the want to avoid writing to the `$temp`
 variable, as if a path that can't be written to is stored in it, It'll be
 overwritten by the next location test anyway, and failing all tests,
 overwritten with `/tmp/`.  Micro-optimizations definitely isn't needed
 here, so that just seems to increase the complexity of the function.

 I haven't tested on a Windows environment with ACL's in place yet, but
 attached is my take on the patch, Anyone see anything wrong with this
 approach?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20778#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list