Merge pull request #2850 from owncloud/touch-newfile

Fix touch for creating new files
This commit is contained in:
Bernhard Posselt 2013-04-10 05:43:47 -07:00
commit 91230efa96
2 changed files with 7 additions and 1 deletions

View File

@ -95,7 +95,7 @@ class Local extends \OC\Files\Storage\Common{
// sets the modification time of the file to the given value. // sets the modification time of the file to the given value.
// If mtime is nil the current time is set. // If mtime is nil the current time is set.
// note that the access time of the file always changes to the current time. // 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; return false;
} }
if(!is_null($mtime)) { if(!is_null($mtime)) {

View File

@ -257,4 +257,10 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$content = stream_get_contents($fh); $content = stream_get_contents($fh);
$this->assertEquals(file_get_contents($textFile), $content); $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'));
}
} }