Make WordPress Core


Ignore:
Timestamp:
01/03/2013 08:04:11 AM (14 years ago)
Author:
dd32
Message:

HTTP API: Introduce wp_is_writable() to wrap win_is_writable() and is_writable() to work around PHP Windows ACL issues. See #22900 for trunk

File:
1 edited

Legend:

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

    r23254 r23255  
    14021402                return trailingslashit( rtrim( $temp, '\\' ) );
    14031403
    1404         $is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) );
    1405 
    14061404        if ( function_exists('sys_get_temp_dir') ) {
    14071405                $temp = sys_get_temp_dir();
    1408                 if ( @is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) ) {
     1406                if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
    14091407                        return trailingslashit( rtrim( $temp, '\\' ) );
    1410                 }
    14111408        }
    14121409
    14131410        $temp = ini_get('upload_tmp_dir');
    1414         if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) )
     1411        if ( is_dir( $temp ) && wp_is_writable( $temp ) )
    14151412                return trailingslashit( rtrim( $temp, '\\' ) );
    14161413
    14171414        $temp = WP_CONTENT_DIR . '/';
    1418         if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) )
     1415        if ( is_dir( $temp ) && wp_is_writable( $temp ) )
    14191416                return $temp;
    14201417
    14211418        $temp = '/tmp/';
    14221419        return $temp;
     1420}
     1421
     1422/**
     1423 * Determine if a directory is writable.
     1424 *
     1425 * This function is used to work around certain ACL issues
     1426 * in PHP primarily affecting Windows Servers.
     1427 *
     1428 * @see win_is_writable()
     1429 *
     1430 * @since 3.6.0
     1431 *
     1432 * @param string $path
     1433 * @return bool
     1434 */
     1435function wp_is_writable( $path ) {
     1436        if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
     1437                return win_is_writable( $path );
     1438        else
     1439                return @is_writable( $path );
    14231440}
    14241441
Note: See TracChangeset for help on using the changeset viewer.