Fixed directory deletion for SMB and FTP storages - #6062
Conversation
Some storages need to use different calls for deleting files or folders, usually unlink() and rmdir(). For this, added a new operation deleteFileOrDir() which default implementation will first detect whether the given argument is a file or a directory to decide which operation to use. Some storage implementations don't need to distinguish them, in which case they reimplement deleteFileOrDir() to save the extra is_dir() detection. Fixes #4532 (SMB dir deletion) Fixes #5941 (FTP dir deletion)
Some files appear with a "N" in the file listing from smbclient. Fixed smb4php to also correctly parse those.
|
Note: I ran the unit tests for FTP, SFTP, SMB, WebDAV and Dropbox and it seemed to work fine. |
|
yes. 👍 |
|
I would prefer to call the function |
|
I decided against |
|
Looks like I forgot some wrappers... |
|
Fetch Jenkins, fetch! @owncloud-bot please retest this |
|
Failed to fetch again it seems 😦 @owncloud-bot retest please |
|
Test passed. |
|
Is this ready to merge? |
|
It should be. |
|
👎 had a chat with @schiesbn and we decided to use a less risky approach: put the code for "detect if dir, then use rmdir" inside the specific ext storage classes directly. This way we don't add new API calls and make this backportable to stable5. |
|
Superseded by #6123 |
|
Backported to stable5 as 3b18c1b |
Added deleteFileOrDir() operation
Some storages need to use different calls for deleting files or folders, usually unlink() and rmdir().
For this, added a new operation deleteFileOrDir() which default implementation will first detect whether the given argument is a file or a directory to decide which operation to use.
Some storage implementations don't need to distinguish them, in which case they reimplement deleteFileOrDir() to save the extra is_dir() detection.
Fixes #4532 (SMB dir deletion)
Fixes #5941 (FTP dir deletion)
This is based on @icewind1991's suggestion here: #4531 (comment)
I tried to not break the existing APIs.
Currently, only the ajax delete.php is using that new call.
If not acceptable, the alternative is to do the is_dir() detection in delete.php for now...
Please review @icewind1991 @karlitschek @DeepDiver1975 @schiesbn