From d69243ee5144afeed57f513b0b50f9f2dbcdd36a Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 29 Nov 2013 12:58:57 +0100 Subject: 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. --- apps/files_external/lib/streamwrapper.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'apps/files_external/lib/streamwrapper.php') diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index 7a1991d4f04..e484325e2fb 100644 --- a/apps/files_external/lib/streamwrapper.php +++ b/apps/files_external/lib/streamwrapper.php @@ -25,8 +25,9 @@ abstract class StreamWrapper extends Common { $this->unlink($path . '/' . $file); } } - $success = rmdir($this->constructUrl($path)); - clearstatcache(); + $url = $this->constructUrl($path); + $success = rmdir($url); + clearstatcache(false, $url); return $success; } else { return false; @@ -46,8 +47,11 @@ abstract class StreamWrapper extends Common { } public function unlink($path) { - $success = unlink($this->constructUrl($path)); - clearstatcache(); + $url = $this->constructUrl($path); + $success = unlink($url); + // normally unlink() is supposed to do this implicitly, + // but doing it anyway just to be sure + clearstatcache(false, $url); return $success; } -- cgit v1.2.3