WordPress.org

Make WordPress Core

Changeset 27566


Ignore:
Timestamp:
03/17/2014 08:16:40 PM (7 years ago)
Author:
nacin
Message:

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

props DavidAnderson.
fixes #26598.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-direct.php

    r26869 r27566  
    195195     *
    196196     * @param string $file Path to the file.
    197      * @return string Mode of the file (last 4 digits).
     197     * @return string Mode of the file (last 3 digits).
    198198     */
    199199    function getchmod($file) {
    200         return substr(decoct(@fileperms($file)),3);
     200        return substr( decoct( @fileperms( $file ) ), -3 );
    201201    }
    202202
  • trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php

    r25560 r27566  
    231231
    232232    function getchmod($file) {
    233         return substr(decoct(@fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/') )),3);
     233        return substr( decoct( @fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ) ) ), -3 );
    234234    }
    235235
Note: See TracChangeset for help on using the changeset viewer.