[Pkg-owncloud-commits] [owncloud] 85/273: update hasUpdated description, overwrtie testStat for objectstore test
David Prévot
taffit at moszumanska.debian.org
Fri Jul 4 03:13:01 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit ab93f1949dab8e71299b27552e527beb04f89de4
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date: Fri Jun 27 12:14:31 2014 +0200
update hasUpdated description, overwrtie testStat for objectstore test
---
.../files/objectstore/objectstorestorage.php | 4 ++--
lib/private/files/storage/common.php | 5 +++++
tests/lib/files/objectstore/swift.php | 25 +++++++++++++++++++++-
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php
index 4bc258a..09114d2 100644
--- a/lib/private/files/objectstore/objectstorestorage.php
+++ b/lib/private/files/objectstore/objectstorestorage.php
@@ -407,11 +407,11 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
}
/**
- * external changes are not supported
+ * external changes are not supported, exclusive access to the object storage is assumed
*
* @param string $path
* @param int $time
- * @return bool
+ * @return false
*/
public function hasUpdated($path, $time) {
return false;
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index ecc7529..9657b51 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -279,6 +279,11 @@ abstract class Common implements \OC\Files\Storage\Storage {
/**
* check if a file or folder has been updated since $time
*
+ * The method is only used to check if the cache needs to be updated. Storage backends that don't support checking
+ * the mtime should always return false here. As a result storage implementations that always return false expect
+ * exclusive access to the backend and will not pick up files that have been added in a way that circumvents
+ * ownClouds filesystem.
+ *
* @param string $path
* @param int $time
* @return bool
diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/swift.php
index 8ac8992..7f3b45c 100644
--- a/tests/lib/files/objectstore/swift.php
+++ b/tests/lib/files/objectstore/swift.php
@@ -77,7 +77,30 @@ class Swift extends \Test\Files\Storage\Storage {
}
$this->objectStorage->deleteContainer(true);
$this->instance->getCache()->clear();
- //TODO how do I clear hooks?
+ }
+
+ public function testStat() {
+ $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
+ $ctimeStart = time();
+ $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
+ $this->assertTrue($this->instance->isReadable('/lorem.txt'));
+ $ctimeEnd = time();
+ $mTime = $this->instance->filemtime('/lorem.txt');
+
+ // check that ($ctimeStart - 5) <= $mTime <= ($ctimeEnd + 1)
+ $this->assertGreaterThanOrEqual(($ctimeStart - 5), $mTime);
+ $this->assertLessThanOrEqual(($ctimeEnd + 1), $mTime);
+ $this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt'));
+
+ $stat = $this->instance->stat('/lorem.txt');
+ //only size and mtime are required in the result
+ $this->assertEquals($stat['size'], $this->instance->filesize('/lorem.txt'));
+ $this->assertEquals($stat['mtime'], $mTime);
+
+ if ($this->instance->touch('/lorem.txt', 100) !== false) {
+ $mTime = $this->instance->filemtime('/lorem.txt');
+ $this->assertEquals($mTime, 100);
+ }
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list