Make WordPress Core

Ticket #22900: 22900.diff

File 22900.diff, 2.2 KB (added by dd32, 13 years ago)
  • wp-includes/class-http.php

     
    141141                // Force some settings if we are streaming to a file and check for existence and perms of destination directory
    142142                if ( $r['stream'] ) {
    143143                        $r['blocking'] = true;
    144                         if ( ! is_writable( dirname( $r['filename'] ) ) )
     144                        if ( ! wp_is_writable( dirname( $r['filename'] ) ) )
    145145                                return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );
    146146                }
    147147
  • wp-includes/functions.php

     
    14011401        if ( $temp )
    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, '\\' ) );
    14101408                }
    14111409        }
    14121410
    14131411        $temp = ini_get('upload_tmp_dir');
    1414         if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) )
     1412        if ( is_dir( $temp ) && @wp_is_writable( $temp ) )
    14151413                return trailingslashit( rtrim( $temp, '\\' ) );
    14161414
    14171415        $temp = WP_CONTENT_DIR . '/';
    1418         if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) )
     1416        if ( is_dir( $temp ) && @wp_is_writable( $temp ) )
    14191417                return $temp;
    14201418
    14211419        $temp = '/tmp/';
     
    14231421}
    14241422
    14251423/**
    1426  * Workaround for Windows bug in is_writable() function
     1424 * Detect if a directory is writable.
    14271425 *
     1426 * This is needed as we need to selectively Workaround a PHP Windows bug in is_writable()
     1427 *
     1428 * @since 3.5.1
     1429 *
     1430 * @param string $path
     1431 * @return bool
     1432 */
     1433function wp_is_writable( $path ) {
     1434        if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
     1435                return win_is_writable( $path );
     1436        else
     1437                return is_writable( $path );
     1438}
     1439
     1440/**
     1441 * Workaround for PHP Windows bug in is_writable()
     1442 *
    14281443 * @since 2.8.0
    14291444 *
    14301445 * @param string $path