summaryrefslogtreecommitdiffstats
path: root/lib/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-06-06 20:47:20 +0200
committerRobin Appelman <icewind@owncloud.com>2013-06-17 17:34:09 +0200
commit63c898c064233d08823e1b18ec7cb20185b1fe05 (patch)
treefc8adb26e0dc3520a0a5d546468d2a63cca91afb /lib/files
parent6156d71832ee031d8d1f50d8dbff7d0bcfb45541 (diff)
downloadnextcloud-server-63c898c064233d08823e1b18ec7cb20185b1fe05.tar.gz
nextcloud-server-63c898c064233d08823e1b18ec7cb20185b1fe05.zip
Make rmdir recursive for local storage
Diffstat (limited to 'lib/files')
-rw-r--r--lib/files/storage/local.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/files/storage/local.php b/lib/files/storage/local.php
index d684905bf9a..b08fd73ce19 100644
--- a/lib/files/storage/local.php
+++ b/lib/files/storage/local.php
@@ -39,7 +39,27 @@ if (\OC_Util::runningOnWindows()) {
}
public function rmdir($path) {
- return @rmdir($this->datadir . $path);
+ try {
+ $it = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator($this->datadir . $path),
+ \RecursiveIteratorIterator::CHILD_FIRST
+ );
+ foreach ($it as $file) {
+ /**
+ * @var \SplFileInfo $file
+ */
+ if (in_array($file->getBasename(), array('.', '..'))) {
+ continue;
+ } elseif ($file->isDir()) {
+ rmdir($file->getPathname());
+ } elseif ($file->isFile() || $file->isLink()) {
+ unlink($file->getPathname());
+ }
+ }
+ return rmdir($this->datadir . $path);
+ } catch (\UnexpectedValueException $e) {
+ return false;
+ }
}
public function opendir($path) {