diff options
Diffstat (limited to 'apps/files_external/lib/streamwrapper.php')
-rw-r--r-- | apps/files_external/lib/streamwrapper.php | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index beb4ec5605f..4a63dfb6e02 100644 --- a/apps/files_external/lib/streamwrapper.php +++ b/apps/files_external/lib/streamwrapper.php @@ -8,7 +8,7 @@ namespace OC\Files\Storage; -abstract class StreamWrapper extends Common{ +abstract class StreamWrapper extends Common { abstract public function constructUrl($path); public function mkdir($path) { @@ -16,7 +16,15 @@ abstract class StreamWrapper extends Common{ } public function rmdir($path) { - if($this->file_exists($path)) { + if ($this->file_exists($path)) { + $dh = $this->opendir($path); + while (($file = readdir($dh)) !== false) { + if ($this->is_dir($path . '/' . $file)) { + $this->rmdir($path . '/' . $file); + } else { + $this->unlink($path . '/' . $file); + } + } $success = rmdir($this->constructUrl($path)); clearstatcache(); return $success; @@ -34,11 +42,11 @@ abstract class StreamWrapper extends Common{ } public function isReadable($path) { - return true;//not properly supported + return true; //not properly supported } public function isUpdatable($path) { - return true;//not properly supported + return true; //not properly supported } public function file_exists($path) { @@ -55,15 +63,19 @@ abstract class StreamWrapper extends Common{ return fopen($this->constructUrl($path), $mode); } - public function touch($path, $mtime=null) { - if(is_null($mtime)) { - $fh = $this->fopen($path, 'a'); - fwrite($fh, ''); - fclose($fh); - - return true; + public function touch($path, $mtime = null) { + if ($this->file_exists($path)) { + if (is_null($mtime)) { + $fh = $this->fopen($path, 'a'); + fwrite($fh, ''); + fclose($fh); + + return true; + } else { + return false; //not supported + } } else { - return false;//not supported + $this->file_put_contents($path, ''); } } |