Get etag from remote OC server

This commit is contained in:
Vincent Petry 2015-04-27 17:41:02 +02:00
parent d2f3710ede
commit 30d7f92763
1 changed files with 17 additions and 3 deletions

View File

@ -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 = null;
if (isset($response['{DAV:}getetag'])) {
$etag = trim($response['{DAV:}getetag'], '"');
if ($cachedData['etag'] !== $etag) {
}
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']);