summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2014-10-27 15:30:30 +0100
committerRobin Appelman <robin@icewind.nl>2014-10-27 15:30:30 +0100
commit8de287f2efe2eafcbda8c54590e363486719257e (patch)
treeaf9ffc656aae0cfd66bbee260e80768cf11dd857 /lib
parent290e9cd5b27d5ef4835674a8f7ec40eebb9a3e5c (diff)
parent283c10f010f5da4ca0b6b7658ac1fa730b8858bf (diff)
downloadnextcloud-server-8de287f2efe2eafcbda8c54590e363486719257e.tar.gz
nextcloud-server-8de287f2efe2eafcbda8c54590e363486719257e.zip
Merge pull request #11763 from owncloud/stable-etags
Generate stable etags for local files
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/local.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 0a612ae505b..1c5fafc12fa 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -90,6 +90,7 @@ if (\OC_Util::runningOnWindows()) {
}
public function stat($path) {
+ clearstatcache();
$fullPath = $this->datadir . $path;
$statResult = stat($fullPath);
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
@@ -276,5 +277,25 @@ if (\OC_Util::runningOnWindows()) {
public function isLocal() {
return true;
}
+
+ /**
+ * get the ETag for a file or folder
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getETag($path) {
+ if ($this->is_file($path)) {
+ $stat = $this->stat($path);
+ return md5(
+ $stat['mtime'] .
+ $stat['ino'] .
+ $stat['dev'] .
+ $stat['size']
+ );
+ } else {
+ return parent::getETag($path);
+ }
+ }
}
}