Make WordPress Core

Changeset 32923


Ignore:
Timestamp:
06/24/2015 04:48:18 AM (10 years ago)
Author:
dd32
Message:

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

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

Legend:

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

    r32654 r32923  
    311311     */
    312312    public function gethchmod( $file ){
    313         $perms = $this->getchmod($file);
     313        $perms = intval( $this->getchmod( $file ), 8 );
    314314        if (($perms & 0xC000) == 0xC000) // Socket
    315315            $info = 's';
     
    353353
    354354    /**
     355     * Gets the permissions of the specified file or filepath in their octal format
     356     *
     357     * @since 4.0
     358     * @param string $file
     359     * @return string the last 3 characters of the octal number
     360     */
     361    public function getchmod( $file ) {
     362        return '777';
     363    }
     364
     365    /**
    355366     * Convert *nix-style file permissions to a octal number.
    356367     *
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php

    r32656 r32923  
    385385     * @staticvar bool $is_windows
    386386     * @param string $line
    387      * @return string
     387     * @return array
    388388     */
    389389    public function parselisting($line) {
     
    427427                $b['type'] = 'f';
    428428            $b['perms'] = $lucifer[0];
     429            $b['permsn'] = $this->getnumchmodfromh( $b['perms'] );
    429430            $b['number'] = $lucifer[1];
    430431            $b['owner'] = $lucifer[2];
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r32656 r32923  
    450450                $struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] );
    451451
     452            // Add the Octal representation of the file permissions
     453            $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] );
     454
    452455            $ret[ $struc['name'] ] = $struc;
    453456        }
Note: See TracChangeset for help on using the changeset viewer.