Ticket #10205: file.php.15646.diff
File file.php.15646.diff, 1.2 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/file.php
832 832 function get_filesystem_method($args = array(), $context = false) { 833 833 $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' 834 834 835 if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){835 if ( ! $method && ( function_exists('posix_getuid') || function_exists('getmyuid') ) && function_exists('fileowner') ){ 836 836 if ( !$context ) 837 837 $context = WP_CONTENT_DIR; 838 838 $context = trailingslashit($context); 839 839 $temp_file_name = $context . 'temp-write-test-' . time(); 840 840 $temp_handle = @fopen($temp_file_name, 'w'); 841 841 if ( $temp_handle ) { 842 if ( getmyuid() == @fileowner($temp_file_name) ) 842 if ( function_exists('posix_getuid') ) 843 $uid = posix_getuid(); // *correct* UID of user running script, i.e www's UID 844 else 845 $uid = getmyuid(); // next-best, UID of user owning script, i.e. johndoe's UID 846 if ( $uid == @fileowner($temp_file_name) ) 843 847 $method = 'direct'; 844 848 @fclose($temp_handle); 845 849 @unlink($temp_file_name);