WordPress.org

Make WordPress Core

Ticket #14401: wordpress-ftp-path-fix.diff

File wordpress-ftp-path-fix.diff, 950 bytes (added by vericgar, 7 years ago)
  • wp-admin/includes/class-wp-filesystem-base.php

    diff -ur wordpress.orig//wp-admin/includes/class-wp-filesystem-base.php wordpress/wp-admin/includes/class-wp-filesystem-base.php
    old new  
    152152                        foreach ( $constant_overrides as $constant => $dir )
    153153                                if ( defined($constant) && $folder === $dir )
    154154                                        return trailingslashit(constant($constant));
     155               
     156                        // catch all for any other FTP path using ABSPATH
     157                        if ( defined('FTP_BASE') && (strpos($folder, ABSPATH) !== false ) ) {
     158                                $ftpfolder = str_replace(ABSPATH, trailingslashit(FTP_BASE), $folder);
     159                                if ( $this->is_dir($ftpfolder) ) {
     160                                        return $ftpfolder;
     161                                }
     162                        }
    155163                } elseif ( 'direct' == $this->method ) {
    156164                        $folder = str_replace('\\', '/', $folder); //Windows path sanitiation
    157165                        return trailingslashit($folder);