aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/smb.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-11-29 12:58:57 +0100
committerVincent Petry <pvince81@owncloud.com>2013-11-29 13:01:01 +0100
commitd69243ee5144afeed57f513b0b50f9f2dbcdd36a (patch)
treedd96718d8dae5b51423fdc05c8e59b09fdd5dde2 /apps/files_external/lib/smb.php
parent41a1a32e5ad19c041e22b20873e769ecfa6aa8c8 (diff)
downloadnextcloud-server-d69243ee5144afeed57f513b0b50f9f2dbcdd36a.tar.gz
nextcloud-server-d69243ee5144afeed57f513b0b50f9f2dbcdd36a.zip
Fixed FTP and SMB to use rmdir() when deleting folders
Some storages need to use different calls for deleting files or folders, usually unlink() and rmdir(). Fixes #4532 (SMB dir deletion) Fixes #5941 (FTP dir deletion) Note that the extra is_dir() should be fast because it's read from the stat cache.
Diffstat (limited to 'apps/files_external/lib/smb.php')
-rw-r--r--apps/files_external/lib/smb.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 5bff597fdca..c5fba92ee68 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -82,12 +82,18 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
}
/**
- * Unlinks file
+ * Unlinks file or directory
* @param string @path
*/
public function unlink($path) {
- unlink($this->constructUrl($path));
- clearstatcache();
+ if ($this->is_dir($path)) {
+ $this->rmdir($path);
+ }
+ else {
+ $url = $this->constructUrl($path);
+ unlink($url);
+ clearstatcache(false, $url);
+ }
// smb4php still returns false even on success so
// check here whether file was really deleted
return !file_exists($path);