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

props DavidAnderson.
fixes #26598.


git-svn-id: https://develop.svn.wordpress.org/trunk@27566 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-03-17 20:16:40 +00:00
parent b6195eb82a
commit c35a53f8bc
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() * FIXME does not handle errors in fileperms()
* *
* @param string $file Path to the file. * @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) { function getchmod($file) {
return substr(decoct(@fileperms($file)),3); return substr( decoct( @fileperms( $file ) ), -3 );
} }
function group($file) { function group($file) {

View File

@ -230,7 +230,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
} }
function getchmod($file) { 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) { function group($file) {