From: Robin Appelman Date: Tue, 1 Oct 2013 20:31:22 +0000 (+0200) Subject: fix using touch to create a file for smb X-Git-Tag: v6.0.0alpha2~53^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=29deef38b27f2b33eec8925cab7f6f323a35ea96;p=nextcloud-server.git fix using touch to create a file for smb --- diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index beb4ec5605f..a110c006529 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,7 @@ abstract class StreamWrapper extends Common{ } public function rmdir($path) { - if($this->file_exists($path)) { + if ($this->file_exists($path)) { $success = rmdir($this->constructUrl($path)); clearstatcache(); return $success; @@ -34,11 +34,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 +55,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, ''); } }