mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
WP Filesystem: Correctly parse the permissions field in the directory listings, and actually set it in FTP environments
Props mnelson4 for initial patch. Fixes #29548 Built from https://develop.svn.wordpress.org/trunk@32923 git-svn-id: http://core.svn.wordpress.org/trunk@32894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dfaa89d853
commit
8f47efe7dc
@ -310,7 +310,7 @@ class WP_Filesystem_Base {
|
||||
* @return string The *nix-style representation of permissions.
|
||||
*/
|
||||
public function gethchmod( $file ){
|
||||
$perms = $this->getchmod($file);
|
||||
$perms = intval( $this->getchmod( $file ), 8 );
|
||||
if (($perms & 0xC000) == 0xC000) // Socket
|
||||
$info = 's';
|
||||
elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
|
||||
@ -351,6 +351,17 @@ class WP_Filesystem_Base {
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the permissions of the specified file or filepath in their octal format
|
||||
*
|
||||
* @since 4.0
|
||||
* @param string $file
|
||||
* @return string the last 3 characters of the octal number
|
||||
*/
|
||||
public function getchmod( $file ) {
|
||||
return '777';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert *nix-style file permissions to a octal number.
|
||||
*
|
||||
|
@ -384,7 +384,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
/**
|
||||
* @staticvar bool $is_windows
|
||||
* @param string $line
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function parselisting($line) {
|
||||
static $is_windows = null;
|
||||
@ -426,6 +426,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
else
|
||||
$b['type'] = 'f';
|
||||
$b['perms'] = $lucifer[0];
|
||||
$b['permsn'] = $this->getnumchmodfromh( $b['perms'] );
|
||||
$b['number'] = $lucifer[1];
|
||||
$b['owner'] = $lucifer[2];
|
||||
$b['group'] = $lucifer[3];
|
||||
|
@ -449,6 +449,9 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
if ( $struc['islink'] )
|
||||
$struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] );
|
||||
|
||||
// Add the Octal representation of the file permissions
|
||||
$struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] );
|
||||
|
||||
$ret[ $struc['name'] ] = $struc;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32922';
|
||||
$wp_version = '4.3-alpha-32923';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user