[Pkg-owncloud-commits] [owncloud] 52/83: make rmdir recursive for mappellocal storage backend
David Prévot
taffit at moszumanska.debian.org
Wed Dec 18 13:05:30 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch 5.0
in repository owncloud.
commit 14be3b3dbb37d6bbd95c6086af79c7c65a8d39dd
Author: Robin Appelman <icewind at owncloud.com>
Date: Sun Jun 30 17:44:49 2013 +0200
make rmdir recursive for mappellocal storage backend
Backported from d051d6f9252de915a13e1b053c54f69bcd83f5ee
---
lib/files/storage/mappedlocal.php | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/lib/files/storage/mappedlocal.php b/lib/files/storage/mappedlocal.php
index 0cdba32..ba5ac41 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('.', '..');
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list