diff options
Diffstat (limited to 'lib/private/Files/View.php')
-rw-r--r-- | lib/private/Files/View.php | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index e9daa123470..f738542ea8c 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -337,17 +337,10 @@ class View { return $this->removeMount($mount, $absolutePath); } if ($this->is_dir($path)) { - $result = $this->basicOperation('rmdir', $path, array('delete')); + return $this->basicOperation('rmdir', $path, array('delete')); } else { - $result = false; - } - - if (!$result && !$this->file_exists($path)) { //clear ghost files from the cache on delete - $storage = $mount->getStorage(); - $internalPath = $mount->getInternalPath($absolutePath); - $storage->getUpdater()->remove($internalPath); + return false; } - return $result; } /** @@ -436,7 +429,7 @@ class View { /** * @param string $path - * @param int $from + * @param int $from * @param int $to * @return bool|mixed * @throws \OCP\Files\InvalidPathException @@ -448,18 +441,18 @@ class View { $handle = $this->fopen($path, 'rb'); if ($handle) { if (fseek($handle, $from) === 0) { - $chunkSize = 8192; // 8 kB chunks - $end = $to + 1; - while (!feof($handle) && ftell($handle) < $end) { - $len = $end - ftell($handle); - if ($len > $chunkSize) { - $len = $chunkSize; - } - echo fread($handle, $len); - flush(); + $chunkSize = 8192; // 8 kB chunks + $end = $to + 1; + while (!feof($handle) && ftell($handle) < $end) { + $len = $end-ftell($handle); + if ($len > $chunkSize) { + $len = $chunkSize; } - $size = ftell($handle) - $from; - return $size; + echo fread($handle, $len); + flush(); + } + $size = ftell($handle) - $from; + return $size; } throw new \OCP\Files\UnseekableException('fseek error'); @@ -686,15 +679,7 @@ class View { if ($mount and $mount->getInternalPath($absolutePath) === '') { return $this->removeMount($mount, $absolutePath); } - $result = $this->basicOperation('unlink', $path, array('delete')); - if (!$result && !$this->file_exists($path)) { //clear ghost files from the cache on delete - $storage = $mount->getStorage(); - $internalPath = $mount->getInternalPath($absolutePath); - $storage->getUpdater()->remove($internalPath); - return true; - } else { - return $result; - } + return $this->basicOperation('unlink', $path, array('delete')); } /** |