]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix touch for creating new files
authorRobin Appelman <icewind@owncloud.com>
Wed, 10 Apr 2013 11:45:36 +0000 (13:45 +0200)
committerRobin Appelman <icewind@owncloud.com>
Wed, 10 Apr 2013 12:52:56 +0000 (14:52 +0200)
lib/files/storage/local.php
tests/lib/files/storage/storage.php

index 0eca6003eaa056afba991de46eaabdf9330ea02a..f4d7626219b61e515e51ca49ceda242cddf05a39 100644 (file)
@@ -95,7 +95,7 @@ class Local extends \OC\Files\Storage\Common{
                // sets the modification time of the file to the given value.
                // If mtime is nil the current time is set.
                // note that the access time of the file always changes to the current time.
-               if(!$this->isUpdatable($path)) {
+               if($this->file_exists($path) and !$this->isUpdatable($path)) {
                        return false;
                }
                if(!is_null($mtime)) {
index 3d68efea5fc78c5358636d1996a9121cb5cc6c4f..0e22f26ae838f79c7fe76f8500d1dbf5670006a0 100644 (file)
@@ -257,4 +257,10 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
                $content = stream_get_contents($fh);
                $this->assertEquals(file_get_contents($textFile), $content);
        }
+
+       public function testTouchCreateFile(){
+               $this->assertFalse($this->instance->file_exists('foo'));
+               $this->instance->touch('foo');
+               $this->assertTrue($this->instance->file_exists('foo'));
+       }
 }