summaryrefslogtreecommitdiffstats
path: root/lib/private/files/storage/local.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-10-24 16:07:45 +0200
committerRobin Appelman <icewind@owncloud.com>2014-10-24 16:47:58 +0200
commit283c10f010f5da4ca0b6b7658ac1fa730b8858bf (patch)
treea6011bee6bb26fc2d97bd25f361c7f7b61fd3989 /lib/private/files/storage/local.php
parent9739a25547e5f8f7500b0a962780cb9267b47cd1 (diff)
downloadnextcloud-server-283c10f010f5da4ca0b6b7658ac1fa730b8858bf.tar.gz
nextcloud-server-283c10f010f5da4ca0b6b7658ac1fa730b8858bf.zip
Generate stable etags for local files
Diffstat (limited to 'lib/private/files/storage/local.php')
-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);
+ }
+ }
}
}