summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-02-25 14:52:21 +0100
committerVincent Petry <pvince81@owncloud.com>2014-02-25 14:52:21 +0100
commit9b4af31bac977cb788a6f4a013d32ba0a21437f0 (patch)
treee8fe24fbc980088c5a6602bd2c9a92f70176007c
parentec9fe3f57f60f1b4f4f5050cd10aab9e9b1238c5 (diff)
parenta23ef25010f8232c36337bb6b48c9a0bd7a59b40 (diff)
downloadnextcloud-server-9b4af31bac977cb788a6f4a013d32ba0a21437f0.tar.gz
nextcloud-server-9b4af31bac977cb788a6f4a013d32ba0a21437f0.zip
Merge pull request #7371 from owncloud/core-storagemovedeleteall
Replace deleteAll call with unlink call on rename
-rw-r--r--lib/private/files/storage/common.php37
-rw-r--r--lib/private/files/view.php2
2 files changed, 1 insertions, 38 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index d4dca780ff3..9e826dd6192 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -140,43 +140,6 @@ abstract class Common implements \OC\Files\Storage\Storage {
return $result;
}
- /**
- * @brief Deletes all files and folders recursively within a directory
- * @param string $directory The directory whose contents will be deleted
- * @param bool $empty Flag indicating whether directory will be emptied
- * @returns bool
- *
- * @note By default the directory specified by $directory will be
- * deleted together with its contents. To avoid this set $empty to true
- */
- public function deleteAll($directory, $empty = false) {
- $directory = trim($directory, '/');
- if (!$this->is_dir($directory) || !$this->isReadable($directory)) {
- return false;
- } else {
- $directoryHandle = $this->opendir($directory);
- if (is_resource($directoryHandle)) {
- while (($contents = readdir($directoryHandle)) !== false) {
- if (!\OC\Files\Filesystem::isIgnoredDir($contents)) {
- $path = $directory . '/' . $contents;
- if ($this->is_dir($path)) {
- $this->deleteAll($path);
- } else {
- $this->unlink($path);
- }
- }
- }
- }
- if ($empty === false) {
- if (!$this->rmdir($directory)) {
- return false;
- }
- }
- return true;
- }
-
- }
-
public function getMimeType($path) {
if ($this->is_dir($path)) {
return 'httpd/unix-directory';
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index e2c565c5cbb..6f235be8e34 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -413,7 +413,7 @@ class View {
$result = $this->copy($path1, $path2);
if ($result === true) {
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
- $result = $storage1->deleteAll($internalPath1);
+ $result = $storage1->unlink($internalPath1);
}
} else {
$source = $this->fopen($path1 . $postFix1, 'r');