summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-06-03 17:20:25 +0200
committerJoas Schilling <nickvergessen@gmx.de>2015-06-03 17:20:25 +0200
commitbb0cb0aaec597aa0a79c061166ce8929bcc02fdd (patch)
tree13746fc19d3e866d616b9ee8491a93037ffeb9c7 /lib
parent8d860e564af1e8a5255e6c1ab1d075e2dc1e0e57 (diff)
parent120588dd7a22af9f1e85ad85e192c5aede92b32c (diff)
downloadnextcloud-server-bb0cb0aaec597aa0a79c061166ce8929bcc02fdd.tar.gz
nextcloud-server-bb0cb0aaec597aa0a79c061166ce8929bcc02fdd.zip
Merge pull request #15895 from owncloud/dav-getremoteetag
Get etag from remote OC server
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/dav.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index 0ddfde15047..15f513585fe 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -682,7 +682,7 @@ class DAV extends Common {
public function getPermissions($path) {
$this->init();
$path = $this->cleanPath($path);
- $response = $this->client->propfind($this->encodePath($path), array('{http://owncloud.org/ns}permissions'));
+ $response = $this->propfind($path);
if (isset($response['{http://owncloud.org/ns}permissions'])) {
return $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
} else if ($this->is_dir($path)) {
@@ -694,6 +694,17 @@ class DAV extends Common {
}
}
+ /** {@inheritdoc} */
+ public function getETag($path) {
+ $this->init();
+ $path = $this->cleanPath($path);
+ $response = $this->propfind($path);
+ if (isset($response['{DAV:}getetag'])) {
+ return trim($response['{DAV:}getetag'], '"');
+ }
+ return parent::getEtag($path);
+ }
+
/**
* @param string $permissionsString
* @return int
@@ -733,8 +744,11 @@ class DAV extends Common {
$response = $this->propfind($path);
if (isset($response['{DAV:}getetag'])) {
$cachedData = $this->getCache()->get($path);
- $etag = trim($response['{DAV:}getetag'], '"');
- if ($cachedData['etag'] !== $etag) {
+ $etag = null;
+ if (isset($response['{DAV:}getetag'])) {
+ $etag = trim($response['{DAV:}getetag'], '"');
+ }
+ if (!empty($etag) && $cachedData['etag'] !== $etag) {
return true;
} else if (isset($response['{http://owncloud.org/ns}permissions'])) {
$permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);