aboutsummaryrefslogtreecommitdiffstats
path: root/lib/files/storage/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/files/storage/common.php')
-rw-r--r--lib/files/storage/common.php28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/files/storage/common.php b/lib/files/storage/common.php
index 38fe5e546f6..3da13ac4df0 100644
--- a/lib/files/storage/common.php
+++ b/lib/files/storage/common.php
@@ -25,6 +25,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
private $scanner;
private $permissioncache;
private $watcher;
+ private $storageCache;
public function __construct($parameters) {
}
@@ -137,27 +138,21 @@ abstract class Common implements \OC\Files\Storage\Storage {
*/
public function deleteAll($directory, $empty = false) {
$directory = trim($directory, '/');
-
- if (!$this->file_exists(\OCP\USER::getUser() . '/' . $directory)
- || !$this->is_dir(\OCP\USER::getUser() . '/' . $directory)
- ) {
- return false;
- } elseif (!$this->isReadable(\OCP\USER::getUser() . '/' . $directory)) {
+ if (!$this->is_dir($directory) || !$this->isReadable($directory)) {
return false;
} else {
- $directoryHandle = $this->opendir(\OCP\USER::getUser() . '/' . $directory);
+ $directoryHandle = $this->opendir($directory);
while ($contents = readdir($directoryHandle)) {
- if ($contents != '.' && $contents != '..') {
- $path = $directory . "/" . $contents;
+ if (!\OC\Files\Filesystem::isIgnoredDir($contents)) {
+ $path = $directory . '/' . $contents;
if ($this->is_dir($path)) {
$this->deleteAll($path);
} else {
- $this->unlink(\OCP\USER::getUser() . '/' . $path); // TODO: make unlink use same system path as is_dir
+ $this->unlink($path);
}
}
}
- //$this->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
- if ($empty == false) {
+ if ($empty === false) {
if (!$this->rmdir($directory)) {
return false;
}
@@ -300,6 +295,13 @@ abstract class Common implements \OC\Files\Storage\Storage {
return $this->watcher;
}
+ public function getStorageCache(){
+ if (!isset($this->storageCache)) {
+ $this->storageCache = new \OC\Files\Cache\Storage($this);
+ }
+ return $this->storageCache;
+ }
+
/**
* get the owner of a path
*
@@ -361,7 +363,7 @@ abstract class Common implements \OC\Files\Storage\Storage {
* get the free space in the storage
*
* @param $path
- * return int
+ * @return int
*/
public function free_space($path) {
return \OC\Files\FREE_SPACE_UNKNOWN;