#48949 closed defect (bug) (worksforme)
ftp_rmdir(): Remove directory operation failed.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.3 |
| Component: | Upgrade/Install | Keywords: | has-patch |
| Focuses: | Cc: |
Description
Whenever you need to update a plugin, this error is triggered:
Warning: ftp_rmdir(): Remove directory operation failed. in /wp-admin/includes/class-wp-filesystem-ftpext.php on line 381
when
define('FS_METHOD', 'ftpext');
is defined inside wp_config.php.
In this situation, the error seems to be caused by the deleting attemp of .maintenance file.
In this scenario the delete method of the class-wp-filesystem-ftpext.php is called with $recursive = false.
So, when .maintenance file not exists the condition on line 377 of class-wp-filesystem-ftpext.php is not executed and the next condition on line 380 is reached.
ftp_rmdir returns (rightly) a fault.
Attachments (1)
Change History (5)
#2
in reply to:
↑ 1
@
6 years ago
Yes, that's fine.
I think that the check can be placed before (outside the conditional statement) and simply return true because the file/dir was deleted.
Replying to anubisthejackle:
Something like the attached patch should do the trick: Verify the directory exists before attempting to run the delete on it.
#3
@
6 years ago
- Resolution set to worksforme
- Status changed from new to closed
This is my solution...
if ( empty( $file ) ) {
return false;
}
if ( ! $this->exists( $file ) ) {
return true;
}
if ( 'f' == $type || $this->is_file( $file ) ) {
return ftp_delete( $this->link, $file );
}
if ( ! $recursive ) {
// ...
// ...
Something like the attached patch should do the trick: Verify the directory exists before attempting to run the delete on it.