Make WordPress Core

Ticket #20778: 20778.patch

File 20778.patch, 1.7 KB (added by kurtpayne, 12 years ago)
  • wp-includes/functions.php

     
    13641364
    13651365/**
    13661366 * Determines a writable directory for temporary files.
    1367  * Function's preference is to WP_CONTENT_DIR followed by the return value of <code>sys_get_temp_dir()</code>, before finally defaulting to /tmp/
     1367 * Function's preference is the return value of <code>sys_get_temp_dir()</code>, followed by WP_CONTENT_DIR, before finally defaulting to /tmp/
    13681368 *
    13691369 * In the event that this function does not find a writable location, It may be overridden by the <code>WP_TEMP_DIR</code> constant in your <code>wp-config.php</code> file.
    13701370 *
     
    13801380        if ( $temp )
    13811381                return trailingslashit($temp);
    13821382
    1383         $temp = WP_CONTENT_DIR . '/';
    1384         if ( is_dir($temp) && @is_writable($temp) )
    1385                 return $temp;
    1386 
    13871383        if  ( function_exists('sys_get_temp_dir') ) {
    1388                 $temp = sys_get_temp_dir();
    1389                 if ( @is_writable($temp) )
    1390                         return trailingslashit($temp);
     1384                $_temp = sys_get_temp_dir();
     1385                if ( ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) && win_is_writable( $_temp ) ) || @is_writable( $_temp ) ) {
     1386                        $temp = $_temp;
     1387                        return trailingslashit( $temp );
     1388                }
    13911389        }
    13921390
    13931391        $temp = ini_get('upload_tmp_dir');
    1394         if ( is_dir($temp) && @is_writable($temp) )
     1392        if ( is_dir( $temp ) && ( ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) && win_is_writable( $temp ) ) || @is_writable( $temp ) ) )
    13951393                return trailingslashit($temp);
    13961394
     1395        $temp = WP_CONTENT_DIR . '/';
     1396        if ( is_dir( $temp ) && ( ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) && win_is_writable( $temp ) ) || @is_writable( $temp ) ) )
     1397                return $temp;
     1398
    13971399        $temp = '/tmp/';
    13981400        return $temp;
    13991401}