]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix using touch to create a file for smb
authorRobin Appelman <icewind@owncloud.com>
Tue, 1 Oct 2013 20:31:22 +0000 (22:31 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 1 Oct 2013 20:31:22 +0000 (22:31 +0200)
apps/files_external/lib/streamwrapper.php

index beb4ec5605f47900c8a556ed6e42d3967cbc82f9..a110c006529923de16f4af2ffbe8163dfe71442a 100644 (file)
@@ -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, '');
                }
        }