问题描述
根据 WordPress 的代码,FS_METHOD = 'direct'是适当的选择。
(Primary Preference) “direct” forces it to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts, This is chosen automatically when appropriate.
http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants
适合的标准是什么?
最佳解决方案
这里是代码 from wp-admin/includes/file.php:
if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
    if ( !$context )
        $context = WP_CONTENT_DIR;
    // If the directory doesn't exist (wp-content/languages) then use the parent directory
    // as we'll create it.
    if ( WP_LANG_DIR == $context && ! is_dir( $context ) )
        $context = dirname( $context );
    $context = trailingslashit($context);
    $temp_file_name = $context . 'temp-write-test-' . time();
    $temp_handle = @fopen($temp_file_name, 'w');
    if ( $temp_handle ) {
        if ( getmyuid() == @fileowner($temp_file_name) )
            $method = 'direct';
        @fclose($temp_handle);
        @unlink($temp_file_name);
    }
}
测试似乎是
- 
我们可以在 wp-content 或 wp-content /languages 目录中创建一个临时文件吗? 
- 
该文件是否属于当前的 Unix 用户,即 wp-content 上没有 setuid? 
如果我们自己没有指定 FS_METHOD,并且如果必要的文件系统调用检查#2,则只执行此检查。临时文件随后被清理。
参考文献
注:本文内容整合自 Google/Baidu/Bing 辅助翻译的英文资料结果。如果您对结果不满意,可以加入我们改善翻译效果:薇晓朵技术论坛。
 
											
				