Ticket #22900: 22900.diff
File 22900.diff, 2.2 KB (added by , 13 years ago) |
---|
-
wp-includes/class-http.php
141 141 // Force some settings if we are streaming to a file and check for existence and perms of destination directory 142 142 if ( $r['stream'] ) { 143 143 $r['blocking'] = true; 144 if ( ! is_writable( dirname( $r['filename'] ) ) )144 if ( ! wp_is_writable( dirname( $r['filename'] ) ) ) 145 145 return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) ); 146 146 } 147 147 -
wp-includes/functions.php
1401 1401 if ( $temp ) 1402 1402 return trailingslashit( rtrim( $temp, '\\' ) ); 1403 1403 1404 $is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) );1405 1406 1404 if ( function_exists('sys_get_temp_dir') ) { 1407 1405 $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 ) ) { 1409 1407 return trailingslashit( rtrim( $temp, '\\' ) ); 1410 1408 } 1411 1409 } 1412 1410 1413 1411 $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 ) ) 1415 1413 return trailingslashit( rtrim( $temp, '\\' ) ); 1416 1414 1417 1415 $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 ) ) 1419 1417 return $temp; 1420 1418 1421 1419 $temp = '/tmp/'; … … 1423 1421 } 1424 1422 1425 1423 /** 1426 * Workaround for Windows bug in is_writable() function1424 * Detect if a directory is writable. 1427 1425 * 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 */ 1433 function 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 * 1428 1443 * @since 2.8.0 1429 1444 * 1430 1445 * @param string $path