Opened 6 years ago
Last modified 21 months ago
#33058 new defect (bug)
$wp_filesystem->exists('') returns a wrong answer (when FS_METHOD='ftpext').
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Filesystem API | Keywords: | |
Focuses: | Cc: |
Description
If the method $wp_filesystem->exists() is called with an empty string and FS_METHOD = 'ftpext' then the result is true, I think it is wrong, because when FS_METHOD is defined as 'direct' returns false.
Change History (7)
#2
@
6 years ago
I want to use the method WP_Upgrader::install_package() with
$args['clear_destination'] = true
In it exists the following code that causes problems:
$removed = true; if ( $wp_filesystem->exists( $remote_destination ) ) { $removed = $wp_filesystem->delete( $remote_destination, true ); }
#3
@
6 years ago
If $remote_destination
is an empty string, you've got deeper problems.
Sounds like the destination
parameter to WP_Upgrader::install_package()
is invalid, doesn't exist, or something else around that.
#4
@
6 years ago
I got this error because I use the following methods:
WP_Upgrader::download_package(); WP_Upgrader::unpack_package()
, and I want to install a theme from the zip archive that have a name like
theme-name-.-templates-.- 1.0.1-.-md5.zip
in a folder like
wp-content/themes/theme-name-parent
None of them has the option to rename this. When I call
WP_Upgrader::install_package()
with
$args['destination'] = WP_CONTENT_DIR . '/ themes /' . 'theme-name-parent'and
FS_METHOD = 'direct'this is possible. But not when
FS_METHOD = 'ftpext'
I think that
WP_Upgrader::install_package()
method should have the same behavior in both cases.
Personally I think calling with an empty string is the incorrect behaviour here.
FTP is most likely returning that the current directory exists (Since that's what leaving the parameter off the
ls -la
calls will do)