Changeset 11454
- Timestamp:
- 05/25/2009 10:39:21 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r11450 r11454 627 627 */ 628 628 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 = 'direct'; 634 unlink($temp_file); 635 } 629 $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' 630 631 if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ 632 $temp_file_name = ABSPATH . '.' . time(); 633 $temp_handle = @fopen($temp_file_name, 'w'); 634 if ( $temp_handle && getmyuid() == fileowner($temp_file_name) ) 635 $method = 'direct'; 636 @fclose($temp_handle); 637 unlink($temp_file_name); 638 } 636 639 637 640 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2'; 638 641 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 639 642 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 );643 return apply_filters('filesystem_method', $method, $args); 641 644 } 642 645
Note: See TracChangeset
for help on using the changeset viewer.