Filesystem: Fix getchmod() for direct and ssh2 transports, for directories.

props DavidAnderson.
fixes #26598.

Built from https://develop.svn.wordpress.org/trunk@27566


git-svn-id: http://core.svn.wordpress.org/trunk@27409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-17 20:17:15 +00:00
parent bba24b09ca
commit 3c3e9a530b
2 changed files with 3 additions and 3 deletions

View File

@ -194,10 +194,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
* FIXME does not handle errors in fileperms()
*
* @param string $file Path to the file.
* @return string Mode of the file (last 4 digits).
* @return string Mode of the file (last 3 digits).
*/
function getchmod($file) {
return substr(decoct(@fileperms($file)),3);
return substr( decoct( @fileperms( $file ) ), -3 );
}
function group($file) {

View File

@ -230,7 +230,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
}
function getchmod($file) {
return substr(decoct(@fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/') )),3);
return substr( decoct( @fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ) ) ), -3 );
}
function group($file) {