summaryrefslogtreecommitdiffstats
path: root/lib/files/storage/mappedlocal.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/files/storage/mappedlocal.php')
-rw-r--r--lib/files/storage/mappedlocal.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/files/storage/mappedlocal.php b/lib/files/storage/mappedlocal.php
index ba3fcdc5c9e..cf5d9b3ef4f 100644
--- a/lib/files/storage/mappedlocal.php
+++ b/lib/files/storage/mappedlocal.php
@@ -34,10 +34,30 @@ class MappedLocal extends \OC\Files\Storage\Common{
return @mkdir($this->buildPath($path));
}
public function rmdir($path) {
- if ($result = @rmdir($this->buildPath($path))) {
- $this->cleanMapper($path);
+ try {
+ $it = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator($this->buildPath($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());
+ }
+ }
+ if ($result = @rmdir($this->buildPath($path))) {
+ $this->cleanMapper($path);
+ }
+ return $result;
+ } catch (\UnexpectedValueException $e) {
+ return false;
}
- return $result;
}
public function opendir($path) {
$files = array('.', '..');