summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-10 05:43:47 -0700
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-10 05:43:47 -0700
commit91230efa9613a5d3d3f324b99451427c0b76aa66 (patch)
tree9a0e1554b175d0e3e6572df267a40211e84bb08a
parent6cd36c10e8e55c18277035644e8fe66fa494d292 (diff)
parent258ad38fd3c1e3cdc4ec20238b166e78c334b814 (diff)
downloadnextcloud-server-91230efa9613a5d3d3f324b99451427c0b76aa66.tar.gz
nextcloud-server-91230efa9613a5d3d3f324b99451427c0b76aa66.zip
Merge pull request #2850 from owncloud/touch-newfile
Fix touch for creating new files
-rw-r--r--lib/files/storage/local.php2
-rw-r--r--tests/lib/files/storage/storage.php6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/files/storage/local.php b/lib/files/storage/local.php
index c3a643fe980..81e32587fca 100644
--- a/lib/files/storage/local.php
+++ b/lib/files/storage/local.php
@@ -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)) {
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 3d68efea5fc..0e22f26ae83 100644
--- a/tests/lib/files/storage/storage.php
+++ b/tests/lib/files/storage/storage.php
@@ -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'));
+ }
}