diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-09 03:05:51 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-09 03:05:51 -0700 |
commit | 9637ca3ae839b11b85e2c26e49d728429aee2834 (patch) | |
tree | 674ce14f14ab374cd414e1601a0a2f7be417cc62 /apps/files_external/lib | |
parent | b4df4cc61d897703176b0ca5cad7fa687ddd059b (diff) | |
parent | 51c34777c4accae634b7877fac970fd2a2e2550c (diff) | |
download | nextcloud-server-9637ca3ae839b11b85e2c26e49d728429aee2834.tar.gz nextcloud-server-9637ca3ae839b11b85e2c26e49d728429aee2834.zip |
Merge pull request #5070 from owncloud/smb-streamwrapper-fixes
Various fixes for the streamwrapper based SMB backend
Diffstat (limited to 'apps/files_external/lib')
-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, ''); } } |