Ticket #9936: 9936.2.diff
| File 9936.2.diff, 1.5 KB (added by , 16 years ago) |
|---|
-
wp-admin/includes/file.php
626 630 * @return unknown 627 631 */ 628 632 function get_filesystem_method($args = array()) { 629 $method = false; 630 if( function_exists('getmyuid') && function_exists('fileowner') ){ 631 $temp_file = wp_tempnam(); 632 if ( getmyuid() == fileowner($temp_file) ) 633 $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' 634 635 if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ 636 $temp_file_name = ABSPATH . '.' . time(); 637 $temp_handle = @fopen($temp_file_name, 'w'); 638 if ( $temp_handle && getmyuid() == fileowner($temp_file_name) ) 633 639 $method = 'direct'; 634 unlink($temp_file); 640 @fclose($temp_handle); 641 unlink($temp_file_name); 635 642 } 636 643 637 644 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2'; 638 645 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 639 646 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread 640 return apply_filters('filesystem_method', $method );647 return apply_filters('filesystem_method', $method, $args); 641 648 } 642 649 643 650 /**