Ticket #20778: 20778.diff
| File 20778.diff, 1.9 KB (added by dd32, 8 months ago) |
|---|
-
wp-includes/functions.php
1367 1367 1368 1368 /** 1369 1369 * Determines a writable directory for temporary files. 1370 * 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/ 1370 * Function's preference is the return value of <code>sys_get_temp_dir()</code>, 1371 * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR, 1372 * before finally defaulting to /tmp/ 1371 1373 * 1372 * 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. 1374 * In the event that this function does not find a writable location, 1375 * It may be overridden by the <code>WP_TEMP_DIR</code> constant in 1376 * your <code>wp-config.php</code> file. 1373 1377 * 1374 1378 * @since 2.5.0 1375 1379 * … … 1383 1387 if ( $temp ) 1384 1388 return trailingslashit($temp); 1385 1389 1386 $temp = WP_CONTENT_DIR . '/'; 1387 if ( is_dir($temp) && @is_writable($temp) ) 1388 return $temp; 1390 $is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ); 1389 1391 1390 1392 if ( function_exists('sys_get_temp_dir') ) { 1391 1393 $temp = sys_get_temp_dir(); 1392 if ( @is_writable($temp) ) 1393 return trailingslashit($temp); 1394 if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) ) { 1395 return trailingslashit( $temp ); 1396 } 1394 1397 } 1395 1398 1396 1399 $temp = ini_get('upload_tmp_dir'); 1397 if ( is_dir( $temp) && @is_writable($temp) )1400 if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) ) 1398 1401 return trailingslashit($temp); 1399 1402 1403 $temp = WP_CONTENT_DIR . '/'; 1404 if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) ) 1405 return $temp; 1406 1400 1407 $temp = '/tmp/'; 1401 1408 return $temp; 1402 1409 }
