From 4ab4dbf7aaaae190e6274bc6b3a4da6d7a41f6ec Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 10 Oct 2008 10:40:04 +0000 Subject: [PATCH] Check if the FTP account is rooted to the base of the WordPress install, props DD32, see #7861 git-svn-id: https://develop.svn.wordpress.org/trunk@9118 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/class-wp-filesystem-base.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index cc587f5d74..ec6c0cb2ee 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -48,7 +48,11 @@ class WP_Filesystem_Base { function abspath() { if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false ) return FTP_BASE; - return $this->find_folder(ABSPATH); + $folder = $this->find_folder(ABSPATH); + //Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. + if ( ! $folder && $this->is_dir('/wp-includes') ) + $folder = '/'; + return $folder; } /** * Returns the path on the remote filesystem of WP_CONTENT_DIR