Make WordPress Core

Changeset 23254


Ignore:
Timestamp:
01/03/2013 07:56:38 AM (13 years ago)
Author:
dd32
Message:

Clarify the Documentation in win_is_writable() and move an inline comment to the Docblock, reduces confusion about what the function actually does. See #22900

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r23229 r23254  
    14261426 * Workaround for Windows bug in is_writable() function
    14271427 *
     1428 * PHP has issues with Windows ACL's for determine if a
     1429 * directory is writable or not, this works around them by
     1430 * checking the ability to open files rather than relying
     1431 * upon PHP to interprate the OS ACL.
     1432 *
     1433 * @see http://bugs.php.net/bug.php?id=27609
     1434 * @see http://bugs.php.net/bug.php?id=30931
     1435 *
    14281436 * @since 2.8.0
    14291437 *
     
    14321440 */
    14331441function win_is_writable( $path ) {
    1434     /* will work in despite of Windows ACLs bug
    1435      * NOTE: use a trailing slash for folders!!!
    1436      * see http://bugs.php.net/bug.php?id=27609
    1437      * see http://bugs.php.net/bug.php?id=30931
    1438      */
    1439 
    1440     if ( $path[strlen( $path ) - 1] == '/' ) // recursively return a temporary file path
     1442
     1443    if ( $path[strlen( $path ) - 1] == '/' ) // if it looks like a directory, check a random file within the directory
    14411444        return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
    1442     else if ( is_dir( $path ) )
     1445    else if ( is_dir( $path ) ) // If it's a directory (and not a file) check a random file within the directory
    14431446        return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
     1447
    14441448    // check tmp file for read/write capabilities
    14451449    $should_delete_tmp_file = !file_exists( $path );
Note: See TracChangeset for help on using the changeset viewer.