| 1 | 623c623
|
|---|
| 2 | < * {@internal Missing Short Description}}
|
|---|
| 3 | ---
|
|---|
| 4 | > * Determines how files from the wordpress-install should be accessed.
|
|---|
| 5 | 632c632,638
|
|---|
| 6 | < $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets'
|
|---|
| 7 | ---
|
|---|
| 8 | > $method = false;
|
|---|
| 9 | > if ( ! $context )
|
|---|
| 10 | > $context = WP_CONTENT_DIR;
|
|---|
| 11 | >
|
|---|
| 12 | > if ( ! $method && defined('FS_METHOD') ) {
|
|---|
| 13 | > $method = FS_METHOD; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets'
|
|---|
| 14 | > }
|
|---|
| 15 | 634,636c640,644
|
|---|
| 16 | < if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
|
|---|
| 17 | < if ( !$context )
|
|---|
| 18 | < $context = WP_CONTENT_DIR;
|
|---|
| 19 | ---
|
|---|
| 20 | > if ( ! $method
|
|---|
| 21 | > && is_writable($context)
|
|---|
| 22 | > && function_exists('fileowner')
|
|---|
| 23 | > && function_exists('filegroup')
|
|---|
| 24 | > ) {
|
|---|
| 25 | 638,644c646,660
|
|---|
| 26 | < $temp_file_name = $context . '.write-test-' . time();
|
|---|
| 27 | < $temp_handle = @fopen($temp_file_name, 'w');
|
|---|
| 28 | < if ( $temp_handle ) {
|
|---|
| 29 | < if ( getmyuid() == fileowner($temp_file_name) )
|
|---|
| 30 | < $method = 'direct';
|
|---|
| 31 | < @fclose($temp_handle);
|
|---|
| 32 | < unlink($temp_file_name);
|
|---|
| 33 | ---
|
|---|
| 34 | > $owner = @fileowner($context);
|
|---|
| 35 | > $group = @filegroup($context);
|
|---|
| 36 | > if ( false !== $owner && false !== $group ) {
|
|---|
| 37 | > $temp_file_name = $context . 'temp-write-test-' . time();
|
|---|
| 38 | > $temp_handle = @fopen($temp_file_name, 'w');
|
|---|
| 39 | > if ( $temp_handle ) {
|
|---|
| 40 | > $php_owner = @fileowner($temp_file_name);
|
|---|
| 41 | > $php_group = @filegroup($temp_file_name);
|
|---|
| 42 | > if ( $php_owner === $owner
|
|---|
| 43 | > || ( $php_owner === $group && $php_group === $group )
|
|---|
| 44 | > ) // Success, direct-access seems possible
|
|---|
| 45 | > $method = 'direct';
|
|---|
| 46 | > @fclose($temp_handle);
|
|---|
| 47 | > @unlink($temp_file_name);
|
|---|
| 48 | > }
|
|---|
| 49 | 646c662
|
|---|
| 50 | < }
|
|---|
| 51 | ---
|
|---|
| 52 | > }
|
|---|
| 53 | 650a667
|
|---|
| 54 | >
|
|---|