Make WordPress Core

Ticket #20778: 207778-sw.diff

File 207778-sw.diff, 1.3 KB (added by simonwheatley, 12 years ago)

Switch sys_get_temp_dir and WP_CONTENT_DIR within get_temp_dir

  • wp-includes/functions.php

     
    13631363
    13641364/**
    13651365 * Determines a writable directory for temporary files.
    1366  * 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/
     1366 * Function's preference is the return value of <code>sys_get_temp_dir()</code>, followed by WP_CONTENT_DIR, before finally defaulting to /tmp/
    13671367 *
    13681368 * 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.
    13691369 *
     
    13791379        if ( $temp )
    13801380                return trailingslashit($temp);
    13811381
    1382         $temp = WP_CONTENT_DIR . '/';
    1383         if ( is_dir($temp) && @is_writable($temp) )
    1384                 return $temp;
    1385 
    13861382        if  ( function_exists('sys_get_temp_dir') ) {
    13871383                $temp = sys_get_temp_dir();
    13881384                if ( @is_writable($temp) )
    13891385                        return trailingslashit($temp);
    13901386        }
    13911387
     1388        $temp = WP_CONTENT_DIR . '/';
     1389        if ( is_dir($temp) && @is_writable($temp) )
     1390                return $temp;
     1391
    13921392        $temp = ini_get('upload_tmp_dir');
    13931393        if ( is_dir($temp) && @is_writable($temp) )
    13941394                return trailingslashit($temp);